diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseMapper.xml b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseMapper.xml
index 06d8eadc2d..1f5e68e010 100644
--- a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseMapper.xml
+++ b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseMapper.xml
@@ -102,6 +102,9 @@
+
+
+
@@ -121,13 +124,20 @@
and functional_case.version_id in
-
- and functional_case.id in (
- select case_id from functional_case_custom_field where field_id =
+
+ and test_case.id in (
+ select resource_id from custom_field_test_case where concat('custom_single-',field_id) =
#{key}
- and JSON_CONTAINS(value, json_array(#{value}))
+ and trim(both '"' from `value`) in
+
)
+
+ and test_case.id in (
+ select resource_id from custom_field_test_case where concat('custom_multiple-',field_id) =
+ #{key}
+ and and JSON_CONTAINS(`value`, json_array(#{value}))
+
and functional_case.create_user in
@@ -179,4 +189,15 @@
+
+
+ and ${versionTable}.version_id = #{request.versionId}
+
+
+ and ${versionTable}.ref_id = #{request.refId}
+
+
+ AND ${versionTable}.latest = 0
+
+
\ No newline at end of file
diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCasePageRequest.java b/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCasePageRequest.java
index 28ce38c4e9..7d2cd2da04 100644
--- a/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCasePageRequest.java
+++ b/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCasePageRequest.java
@@ -21,4 +21,7 @@ public class FunctionalCasePageRequest extends BasePageRequest {
@Schema(description = "版本id")
private String versionId;
+
+ @Schema(description = "版本来源")
+ private String refId;
}