From be6fe24b607c560d4608531f28b9b37b84602a5c Mon Sep 17 00:00:00 2001 From: song-cc-rock Date: Fri, 18 Oct 2024 14:05:39 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92):=20?= =?UTF-8?q?=E8=AE=A1=E5=88=92=E8=AF=A6=E6=83=85=E8=B7=A8=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E7=AD=9B=E9=80=89=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/mapper/ExtApiTestCaseMapper.xml | 9 +- .../metersphere/system/mapper/BaseMapper.xml | 16 +- .../plan/mapper/ExtTestPlanApiCaseMapper.xml | 184 ++++++++++++++---- .../mapper/ExtTestPlanApiScenarioMapper.xml | 22 ++- .../ExtTestPlanFunctionalCaseMapper.xml | 22 ++- .../plan/service/TestPlanApiCaseService.java | 5 +- .../service/TestPlanApiScenarioService.java | 6 +- .../TestPlanFunctionalCaseService.java | 6 +- 8 files changed, 211 insertions(+), 59 deletions(-) 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 989a6fb8b9..9b17fbd557 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 @@ -604,10 +604,17 @@ - + + + + + + + + diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/BaseMapper.xml b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/BaseMapper.xml index 7dca602964..598c096411 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/BaseMapper.xml +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/BaseMapper.xml @@ -3,6 +3,16 @@ + + + + + + + + + + @@ -15,12 +25,6 @@ - - - - - - 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 b496171598..7eb7d96a99 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 @@ -90,7 +90,7 @@ project_version.name as version_name from api_definition a left join project_version on project_version.id = a.version_id where a.deleted = false - + and exists ( select id from api_test_case atc @@ -107,7 +107,7 @@ - + and a.module_id in @@ -135,8 +135,10 @@ - + + + @@ -383,6 +385,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + a.id in ( + select api_definition_id from api_test_case where deleted = ${deleted} + and project_id = '${projectId}' + ) + + + a.id not in ( + select api_definition_id from api_test_case where deleted = ${deleted} + and project_id = '${projectId}' + ) + + + 1=2 + + + + a.id not in ( + select api_definition_id from api_test_case where deleted = ${deleted} + and project_id = '${projectId}' + ) + + OR + + + + a.id in ( + select api_definition_id from api_test_case where deleted = ${deleted} + and project_id = '${projectId}' + group by api_definition_id having + + + + + ) + + + + + + + + + + + + + + + + + + + @@ -399,10 +501,27 @@ - + + + + + + concat(a.project_id, '_', a.module_id) in + + #{v} + + + + concat(a.project_id, '_', a.module_id) not in + + #{v} + + + + @@ -450,16 +569,16 @@ atc.id in ( - select atcr.api_test_case_id as id - from api_report ar left join api_test_case_record atcr on atcr.api_report_id = ar.id - group by atcr.api_test_case_id + select atcr.api_test_case_id as id + from api_report ar left join api_test_case_record atcr on atcr.api_report_id = ar.id + group by atcr.api_test_case_id ) atc.id not in ( - select atcr.api_test_case_id as id - from api_report ar left join api_test_case_record atcr on atcr.api_report_id = ar.id - group by atcr.api_test_case_id + select atcr.api_test_case_id as id + from api_report ar left join api_test_case_record atcr on atcr.api_report_id = ar.id + group by atcr.api_test_case_id ) @@ -467,15 +586,15 @@ atc.id in ( - select rate_tmp.id from ( - select atcr.api_test_case_id as id, format(sum(if(ar.`status` = 'success', 1, 0)) / count(ar.id) * 100, 2) as passRate - from api_report ar left join api_test_case_record atcr on atcr.api_report_id = ar.id - group by atcr.api_test_case_id having - - - - - ) rate_tmp + select rate_tmp.id from ( + select atcr.api_test_case_id as id, format(sum(if(ar.`status` = 'success', 1, 0)) / count(ar.id) * 100, 2) as passRate + from api_report ar left join api_test_case_record atcr on atcr.api_report_id = ar.id + group by atcr.api_test_case_id having + + + + + ) rate_tmp ) @@ -506,14 +625,14 @@ t.id in ( - select distinct brc.test_plan_case_id from bug_relation_case brc join bug b on brc.bug_id = b.id - where b.deleted = false and brc.test_plan_id = '${planId}' and brc.case_type = 'API' + select distinct brc.test_plan_case_id from bug_relation_case brc join bug b on brc.bug_id = b.id + where b.deleted = false and brc.test_plan_id = '${planId}' and brc.case_type = 'API' ) t.id not in ( - select distinct brc.test_plan_case_id from bug_relation_case brc join bug b on brc.bug_id = b.id - where b.deleted = false and brc.test_plan_id = '${planId}' and brc.case_type = 'API' + select distinct brc.test_plan_case_id from bug_relation_case brc join bug b on brc.bug_id = b.id + where b.deleted = false and brc.test_plan_id = '${planId}' and brc.case_type = 'API' ) @@ -522,8 +641,8 @@ t.id not in ( - select distinct brc.test_plan_case_id from bug_relation_case brc join bug b on brc.bug_id = b.id - where b.deleted = false and brc.test_plan_id = '${planId}' and brc.case_type = 'API' + select distinct brc.test_plan_case_id from bug_relation_case brc join bug b on brc.bug_id = b.id + where b.deleted = false and brc.test_plan_id = '${planId}' and brc.case_type = 'API' ) OR @@ -531,12 +650,12 @@ t.id in ( - select brc.test_plan_case_id from bug_relation_case brc join bug b on brc.bug_id = b.id - where b.deleted = false and brc.test_plan_id = '${planId}' and brc.case_type = 'API' group by brc.test_plan_case_id having - - - - + select brc.test_plan_case_id from bug_relation_case brc join bug b on brc.bug_id = b.id + where b.deleted = false and brc.test_plan_id = '${planId}' and brc.case_type = 'API' group by brc.test_plan_case_id having + + + + ) @@ -561,8 +680,7 @@ - SELECT CASE WHEN api_scenario.module_id = 'root' THEN CONCAT(api_scenario.project_id, '_', - api_scenario.module_id) ELSE api_scenario.module_id END AS moduleId, + SELECT concat(api_scenario.project_id, '_', api_scenario.module_id) as moduleId, count(api_scenario.id) AS dataCount, api_scenario.project_id AS projectId, project.name AS projectName FROM test_plan_api_scenario INNER JOIN api_scenario on api_scenario.id = test_plan_api_scenario.api_scenario_id 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 577561ffe3..22eda0f636 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 @@ -310,10 +310,27 @@ - + + + + + + concat(functional_case.project_id, '_', functional_case.module_id) in + + #{v} + + + + concat(functional_case.project_id, '_', functional_case.module_id) not in + + #{v} + + + + @@ -552,8 +569,7 @@