diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtIssuesMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtIssuesMapper.xml
index d4a8aed3e3..afc89b1fd7 100644
--- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtIssuesMapper.xml
+++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtIssuesMapper.xml
@@ -261,10 +261,10 @@
and issues.id in (
select resource_id from custom_field_issues
where concat('custom_multiple-',field_id) = #{key}
- and JSON_CONTAINS(value,
-
- #{value}
- )
+ and
+
+ JSON_CONTAINS(value, #{value})
+
)
@@ -309,18 +309,11 @@
- and issues.id in (
+ and issues.id ${custom.operator} (
select resource_id from custom_field_issues where field_id = #{custom.id}
-
-
- and JSON_CONTAINS(`value`, #{custom.value})
-
-
- and NOT JSON_CONTAINS(`value`, #{custom.value})
-
-
+ and ${custom.value}
and left(replace(unix_timestamp(trim(both '"' from `value`)), '.', ''), 13)
@@ -341,7 +334,7 @@
- )
+ )
diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml
index 361f22ec7c..4e7124cf1a 100644
--- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml
+++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml
@@ -108,38 +108,31 @@
- and test_case.id in (
- select resource_id from custom_field_test_case where field_id = #{custom.id}
-
-
-
-
- and JSON_CONTAINS(`value`, #{custom.value})
-
-
- and NOT JSON_CONTAINS(`value`, #{custom.value})
-
-
-
-
- and left(replace(unix_timestamp(trim(both '"' from `value`)), '.', ''), 13)
-
-
-
-
-
- and text_value
-
-
-
-
-
- and trim(both '"' from value)
-
-
-
-
-
+ and test_case.id ${custom.operator} (
+ select resource_id from custom_field_test_case where field_id = #{custom.id}
+
+
+ and ${custom.value}
+
+
+ and left(replace(unix_timestamp(trim(both '"' from `value`)), '.', ''), 13)
+
+
+
+
+
+ and text_value
+
+
+
+
+
+ and trim(both '"' from value)
+
+
+
+
+
)
@@ -605,10 +598,10 @@
and test_case.id in (
select resource_id from custom_field_test_case where concat('custom_multiple-',field_id) = #{key}
- and JSON_CONTAINS(value,
-
- #{value}
- )
+ and
+
+ JSON_CONTAINS(value, #{value})
+
)
diff --git a/backend/src/main/java/io/metersphere/commons/utils/ServiceUtils.java b/backend/src/main/java/io/metersphere/commons/utils/ServiceUtils.java
index 7a9cb658e8..c82b101b82 100644
--- a/backend/src/main/java/io/metersphere/commons/utils/ServiceUtils.java
+++ b/backend/src/main/java/io/metersphere/commons/utils/ServiceUtils.java
@@ -1,9 +1,11 @@
package io.metersphere.commons.utils;
+import com.alibaba.fastjson.JSONArray;
import io.metersphere.base.domain.Project;
import io.metersphere.base.domain.ProjectVersion;
import io.metersphere.base.domain.User;
import io.metersphere.base.domain.Workspace;
+import io.metersphere.commons.constants.CustomFieldType;
import io.metersphere.commons.exception.MSException;
import io.metersphere.controller.request.BaseQueryRequest;
import io.metersphere.controller.request.OrderRequest;
@@ -13,6 +15,8 @@ import io.metersphere.service.ProjectService;
import io.metersphere.service.ProjectVersionService;
import io.metersphere.service.UserService;
import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.collections.MapUtils;
+import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession;
@@ -419,4 +423,31 @@ public class ServiceUtils {
.distinct()
.collect(Collectors.toList());
}
+
+ @SuppressWarnings("unchecked")
+ public static void setBaseQueryRequestCustomMultipleFields(BaseQueryRequest request) {
+ // filter中自定义多选字段
+ if (MapUtils.isNotEmpty(request.getFilters())) {
+ request.getFilters().entrySet().forEach(entry -> {
+ if (entry.getKey().startsWith("custom_multiple") && CollectionUtils.isNotEmpty(entry.getValue())) {
+ List customValues = JSONArray.parseArray(entry.getValue().get(0), String.class);
+ List jsonValues = customValues.stream().map(item -> "[\"".concat(item).concat("\"]")).collect(Collectors.toList());
+ entry.setValue(jsonValues);
+ }
+ });
+ }
+ // 高级搜索中自定义多选字段
+ if (MapUtils.isNotEmpty(request.getCombine()) && ObjectUtils.isNotEmpty((request.getCombine().get("customs")))) {
+ List