diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMockMapper.xml b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMockMapper.xml index e34d3dbedc..6ab11c604a 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMockMapper.xml +++ b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMockMapper.xml @@ -180,7 +180,7 @@ - + diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiScenarioMapper.xml b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiScenarioMapper.xml index c8ac6e11b2..232a638888 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiScenarioMapper.xml +++ b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiScenarioMapper.xml @@ -333,7 +333,7 @@ - + @@ -346,13 +346,6 @@ - - - - - - - diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiTestCaseMapper.xml b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiTestCaseMapper.xml index 5d2379385b..48e3ce5af0 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiTestCaseMapper.xml +++ b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiTestCaseMapper.xml @@ -587,12 +587,12 @@ - + - + @@ -677,7 +677,7 @@ - + diff --git a/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugMapper.xml b/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugMapper.xml index ac6134682b..ba68055af3 100644 --- a/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugMapper.xml +++ b/backend/services/bug-management/src/main/java/io/metersphere/bug/mapper/ExtBugMapper.xml @@ -231,12 +231,12 @@ - + - + @@ -340,12 +340,6 @@ or b.tags like concat('%', #{request.keyword},'%') ) - - - - - - 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 f3992c2ab1..7989b5a001 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 @@ -310,18 +310,21 @@ + + + @@ -331,6 +334,7 @@ + diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/constants/UserViewType.java b/backend/services/system-setting/src/main/java/io/metersphere/system/constants/UserViewType.java index 61919c22a0..f850d2bec4 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/constants/UserViewType.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/constants/UserViewType.java @@ -28,7 +28,29 @@ public enum UserViewType implements ValueEnum { API_SCENARIO("api-scenario", List.of(InternalUserView.ALL_DATA, InternalUserView.MY_FOLLOW, InternalUserView.MY_CREATE)), BUG("bug", - List.of(InternalUserView.ALL_DATA, InternalUserView.MY_FOLLOW, InternalUserView.MY_CREATE)); + List.of(InternalUserView.ALL_DATA, InternalUserView.MY_FOLLOW, InternalUserView.MY_CREATE)), + /** + * 计划详情用例&&缺陷列表 + */ + PLAN_FUNCTIONAL_CASE("plan-functional-case", + List.of(InternalUserView.ALL_DATA, InternalUserView.MY_CREATE)), + PLAN_API_CASE("plan-api-case", + List.of(InternalUserView.ALL_DATA, InternalUserView.MY_CREATE)), + PLAN_API_SCENARIO("plan-api-scenario", + List.of(InternalUserView.ALL_DATA, InternalUserView.MY_CREATE)), + PLAN_BUG("plan-bug", + List.of(InternalUserView.ALL_DATA, InternalUserView.MY_CREATE)), + /** + * 计划关联用例&&缺陷弹窗 + */ + PLAN_FUNCTIONAL_CASE_DRAWER("plan-functional-case-drawer", + List.of(InternalUserView.ALL_DATA, InternalUserView.MY_CREATE)), + PLAN_API_CASE_DRAWER("plan-api-case-drawer", + List.of(InternalUserView.ALL_DATA, InternalUserView.MY_CREATE)), + PLAN_API_SCENARIO_DRAWER("plan-api-scenario-drawer", + List.of(InternalUserView.ALL_DATA, InternalUserView.MY_CREATE)), + PLAN_BUG_DRAWER("plan-bug--drawer", + List.of(InternalUserView.ALL_DATA, InternalUserView.MY_CREATE)); private String value; diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanApiCaseMapper.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanApiCaseMapper.java index 2f7ab5f8e7..fe5e778a28 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanApiCaseMapper.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanApiCaseMapper.java @@ -16,6 +16,7 @@ import io.metersphere.plan.dto.response.TestPlanApiCasePageResponse; import io.metersphere.project.dto.DropNode; import io.metersphere.project.dto.ModuleCountDTO; import io.metersphere.project.dto.NodeSortQueryParam; +import io.metersphere.system.interceptor.BaseConditionFilter; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -36,8 +37,10 @@ public interface ExtTestPlanApiCaseMapper { List selectCaseExecResultCount(String testPlanId); + @BaseConditionFilter List list(@Param("request") TestPlanApiRequest request, @Param("isRepeat") boolean isRepeat); + @BaseConditionFilter List relateApiCaseList(@Param("request") TestPlanApiCaseRequest request, @Param("deleted") boolean deleted); List countModuleIdByRequest(@Param("request") TestPlanApiCaseRequest request, @Param("deleted") boolean deleted); @@ -52,6 +55,7 @@ public interface ExtTestPlanApiCaseMapper { List selectBaseByProjectIdAndTestPlanId(@Param("testPlanId") String testPlanId); + @BaseConditionFilter List getIds(@Param("request") TestPlanApiCaseBatchRequest request, @Param("deleted") boolean deleted); void batchUpdateExecutor(@Param("ids") List ids, @Param("userId") String userId); diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanApiCaseMapper.xml b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanApiCaseMapper.xml index 18fa36b080..c3e753e6f3 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanApiCaseMapper.xml +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanApiCaseMapper.xml @@ -84,53 +84,49 @@ - and api_definition.module_id in + and a.module_id in #{moduleId} and ( - api_definition.name like concat('%', #{request.keyword},'%') - or api_definition.num like concat('%', #{request.keyword},'%') - or api_definition.path like concat('%', #{request.keyword},'%') - or api_definition.tags like concat('%', #{request.keyword},'%') + a.name like concat('%', #{request.keyword},'%') + or a.num like concat('%', #{request.keyword},'%') + or a.path like concat('%', #{request.keyword},'%') + or a.tags like concat('%', #{request.keyword},'%') ) - and api_definition.project_id = #{request.projectId} + and a.project_id = #{request.projectId} - AND api_definition.protocol in + and a.protocol in #{protocol} @@ -138,19 +134,13 @@ - - - AND - - - - and ( - - ) - - + + + + + - + @@ -200,195 +190,6 @@ - - - - - - - - 1=1 - - - - - - api_definition.name - - - - - - - - - - api_definition.num - - - - - - - - - - api_definition.moduleId - - - - - - - - - - api_definition.create_user - - - - - - - - - - api_definition.create_time - - - - - - - - - - api_definition.update_user - - - - - - - - - - api_definition.update_time - - - - - - - - - - api_definition.status - - - - - - - - - - api_definition.path - - - - - - - - - - api_definition.method - - - - - - - - - - - - - - - - - api_definition.id ${custom.operator} ( - select api_id from api_definition_custom_field where field_id = #{custom.id} - - - and JSON_CONTAINS(`value`, json_array(#{custom.value})) - - - and `value` - - - - - - and trim(both '"' from `value`) - - - - - - ) - - - - - - - - - - - ( - api_definition.tags is null or api_definition.tags = '[]' or - - !JSON_CONTAINS(api_definition.tags, JSON_ARRAY(#{tag})) - - ) - - - - - - - - JSON_CONTAINS(api_definition.tags, JSON_ARRAY(#{tag})) - - - - - - - - (api_definition.tags is null or api_definition.tags = '[]') - - - - - - - - - - AND - - - OR - - - - @@ -437,6 +238,7 @@ and t.test_plan_id = #{request.testPlanId} + list(@Param("request") TestPlanBugPageRequest request); /** diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanBugMapper.xml b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanBugMapper.xml index 64ee80da77..a971bfb472 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanBugMapper.xml +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanBugMapper.xml @@ -16,9 +16,9 @@ - - - + + + group by brc.bug_id @@ -102,180 +102,108 @@ - - and ( - - - - - - - - - - b.num - - - - - - - - - - b.title - - - - - - - - - - b.platform - - - - - - - - - - b.handle_user - - - - - - - - - - b.status - - - - - - - - - - b.create_user - - - - - - - - - - b.create_time - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - b.id not in ( + + + + + + + + + + + + - - b.id in ( + + + + + + - select bug_id from bug_custom_field where field_id = #{custom.id} and - - - - JSON_CONTAINS(`value`, JSON_ARRAY(#{val})) - - - - left(replace(unix_timestamp(trim(both '"' from `value`)), '.', ''), 13) - - - - - - trim(both '"' from `value`) - - - - - - ) - - - - ) - - - - - - - 1 = 1 - - - 1 = 2 - - - - - - - - and - - - or - - - - - - - - - - - ( - b.tags is null or b.tags = '[]' or - - !JSON_CONTAINS(b.tags, JSON_ARRAY(#{tag})) - - ) - - - - - - - - JSON_CONTAINS(b.tags, JSON_ARRAY(#{tag})) - - - - - - - - (b.tags is null or b.tags = '[]') - + + + + + + + + + + + + b.id in ( + select distinct b.id from bug b join bug_relation_case brc on b.id = brc.bug_id + where deleted = ${deleted} and project_id = '${projectId}' + ) + + + b.id not in ( + select distinct b.id from bug b join bug_relation_case brc on b.id = brc.bug_id + where deleted = ${deleted} and project_id = '${projectId}' + ) + + + 1=2 + + + + b.id not in ( + select distinct b.id from bug b join bug_relation_case brc on b.id = brc.bug_id + where deleted = ${deleted} and project_id = '${projectId}' + ) + + OR + + + + b.id in ( + select distinct b.id from bug b join bug_relation_case brc on b.id = brc.bug_id + where deleted = ${deleted} and project_id = '${projectId}' group b.id having + + + + + ) + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanFunctionalCaseMapper.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanFunctionalCaseMapper.java index a2690de29f..279e357c18 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanFunctionalCaseMapper.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanFunctionalCaseMapper.java @@ -16,6 +16,7 @@ import io.metersphere.plan.dto.response.TestPlanCasePageResponse; import io.metersphere.project.dto.DropNode; import io.metersphere.project.dto.ModuleCountDTO; import io.metersphere.project.dto.NodeSortQueryParam; +import io.metersphere.system.interceptor.BaseConditionFilter; import org.apache.ibatis.annotations.Param; import java.util.Collection; @@ -37,6 +38,7 @@ public interface ExtTestPlanFunctionalCaseMapper { DropNode selectNodeByPosOperator(NodeSortQueryParam nodeSortQueryParam); + @BaseConditionFilter List getCasePage(@Param("request") TestPlanCaseRequest request, @Param("deleted") boolean deleted, @Param("sort") String sort); List selectByTestPlanIdAndNotDeleted(String testPlanId); @@ -49,6 +51,7 @@ public interface ExtTestPlanFunctionalCaseMapper { long caseCount(@Param("request") TestPlanCaseRequest request, @Param("deleted") boolean deleted); + @BaseConditionFilter List getIds(@Param("request") BasePlanCaseBatchRequest request, @Param("deleted") boolean deleted); /** diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanFunctionalCaseMapper.xml b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanFunctionalCaseMapper.xml index a7e262d2c0..da6016a949 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanFunctionalCaseMapper.xml +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanFunctionalCaseMapper.xml @@ -166,17 +166,9 @@ - - - AND - - - - and ( - - ) - - + + + @@ -210,17 +202,9 @@ - - - AND - - - - and ( - - ) - - + + + @@ -308,131 +292,128 @@ - - - - - - - - 1=1 - - - - - - - - - - 1=1 - - - - functional_case.name - - - - - - - - - - functional_case.num - - - - - - - - - - functional_case.moduleId - - - - - - - - - - functional_case.create_user - - - - - - - - - - functional_case.create_time - - - - - - - - - - functional_case.update_user - - - - - - - - - - functional_case.update_time - - - - - - - - - - - - - - - - - functional_case.id ${custom.operator} ( - select case_id from functional_case_custom_field where field_id = #{custom.id} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + and + + + or + + + + + + + + + + + + + + + + + + + + + + + + + functional_case.id not in ( + select file_association.source_id from file_association where file_association.source_type = 'FUNCTIONAL_CASE' + ) + + + ( + functional_case.id + + not + + in ( + select file_association.source_id from file_association join file_metadata on file_association.file_id = file_metadata.id + and file_association.source_type = 'FUNCTIONAL_CASE' and - - and JSON_CONTAINS(`value`, json_array(#{custom.value})) - - - and `value` - - + + + + - and trim(both '"' from `value`) - + + ) - - - - - + ) + +