From 9db8404d1cf831e671c3fc6296b6755cd6f6eb7e Mon Sep 17 00:00:00 2001 From: WangXu10 Date: Thu, 20 Jun 2024 11:26:08 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9D=A1=E4=BB=B6=E6=90=9C=E7=B4=A2=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E9=9B=86=E6=95=B0=E9=87=8F=E4=B8=8D=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1042669 --user=王旭 【测试计划】计划详情-功能/接口/场景用例列表-搜索用例-搜索后左侧测试集数量未更新 https://www.tapd.cn/55049933/s/1532646 --- .../plan/mapper/ExtTestPlanApiCaseMapper.java | 3 ++- .../plan/mapper/ExtTestPlanApiCaseMapper.xml | 18 ++++++++++-------- .../mapper/ExtTestPlanApiScenarioMapper.java | 2 +- .../mapper/ExtTestPlanApiScenarioMapper.xml | 5 +++-- .../ExtTestPlanFunctionalCaseMapper.java | 3 ++- .../mapper/ExtTestPlanFunctionalCaseMapper.xml | 5 +++-- .../plan/service/TestPlanApiCaseService.java | 2 +- .../service/TestPlanApiScenarioService.java | 2 +- .../service/TestPlanFunctionalCaseService.java | 2 +- 9 files changed, 24 insertions(+), 18 deletions(-) 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 06da44d816..653e27364a 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 @@ -9,6 +9,7 @@ import io.metersphere.plan.dto.ApiCaseModuleDTO; import io.metersphere.plan.dto.ResourceSelectParam; import io.metersphere.plan.dto.TestPlanCaseRunResultCount; import io.metersphere.plan.dto.request.TestPlanApiCaseBatchRequest; +import io.metersphere.plan.dto.request.TestPlanApiCaseModuleRequest; import io.metersphere.plan.dto.request.TestPlanApiCaseRequest; import io.metersphere.plan.dto.request.TestPlanApiRequest; import io.metersphere.plan.dto.response.TestPlanApiCasePageResponse; @@ -55,7 +56,7 @@ public interface ExtTestPlanApiCaseMapper { void batchUpdateExecutor(@Param("ids") List ids, @Param("userId") String userId); - List collectionCountByRequest(@Param("testPlanId") String testPlanId); + List collectionCountByRequest(@Param("request") TestPlanApiCaseModuleRequest request); Long getMaxPosByCollectionId(String collectionId); 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 4e1f218a15..3c84322c1a 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 @@ -641,18 +641,20 @@ - SELECT - test_plan_api_case.test_plan_collection_id AS moduleId, - count( test_plan_api_case.id ) AS dataCount + t.test_plan_collection_id AS moduleId, + count( t.id ) AS dataCount FROM - api_test_case - INNER JOIN test_plan_api_case ON api_test_case.id = test_plan_api_case.api_case_id + api_test_case atc + INNER JOIN test_plan_api_case t ON atc.id = t.api_case_id + INNER JOIN api_definition a on atc.api_definition_id = a.id WHERE - api_test_case.deleted = FALSE - AND test_plan_api_case.test_plan_id = #{testPlanId} + atc.deleted = FALSE + AND t.test_plan_id = #{request.testPlanId} + GROUP BY - test_plan_api_case.test_plan_collection_id + t.test_plan_collection_id - SELECT test_plan_api_scenario.test_plan_collection_id AS moduleId, count( test_plan_api_scenario.id ) AS dataCount @@ -360,7 +360,8 @@ INNER JOIN test_plan_api_scenario on api_scenario.id = test_plan_api_scenario.api_scenario_id WHERE api_scenario.deleted = FALSE - AND test_plan_api_scenario.test_plan_id = #{testPlanId} + AND test_plan_api_scenario.test_plan_id = #{request.testPlanId} + GROUP BY test_plan_api_scenario.test_plan_collection_id 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 a08fec9571..a552381103 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 @@ -7,6 +7,7 @@ import io.metersphere.plan.domain.TestPlanFunctionalCase; import io.metersphere.plan.dto.ResourceSelectParam; import io.metersphere.plan.dto.TestPlanCaseRunResultCount; import io.metersphere.plan.dto.request.BasePlanCaseBatchRequest; +import io.metersphere.plan.dto.request.TestPlanCaseModuleRequest; import io.metersphere.plan.dto.request.TestPlanCaseRequest; import io.metersphere.plan.dto.response.TestPlanCasePageResponse; import io.metersphere.project.dto.DropNode; @@ -62,5 +63,5 @@ public interface ExtTestPlanFunctionalCaseMapper { Long getMaxPosByCollectionId(String collectionId); - List collectionCountByRequest(@Param("testPlanId") String testPlanId); + List collectionCountByRequest(@Param("request") TestPlanCaseModuleRequest request); } 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 b67dd19953..abae013a1f 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 @@ -541,7 +541,7 @@ WHERE test_plan_collection_id = #{0} - SELECT test_plan_functional_case.test_plan_collection_id AS moduleId, count( test_plan_functional_case.id ) AS dataCount @@ -550,7 +550,8 @@ INNER JOIN test_plan_functional_case ON functional_case.id = test_plan_functional_case.functional_case_id WHERE functional_case.deleted = FALSE - AND test_plan_functional_case.test_plan_id = #{testPlanId} + AND test_plan_functional_case.test_plan_id = #{request.testPlanId} + GROUP BY test_plan_functional_case.test_plan_collection_id diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanApiCaseService.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanApiCaseService.java index 9436453a02..0b332644b9 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanApiCaseService.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanApiCaseService.java @@ -344,7 +344,7 @@ public class TestPlanApiCaseService extends TestPlanResourceService { private Map getCollectionCount(TestPlanApiCaseModuleRequest request) { request.setCollectionId(null); Map projectModuleCountMap = new HashMap<>(); - List list = extTestPlanApiCaseMapper.collectionCountByRequest(request.getTestPlanId()); + List list = extTestPlanApiCaseMapper.collectionCountByRequest(request); list.forEach(item -> { projectModuleCountMap.put(item.getModuleId(), (long) item.getDataCount()); }); diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanApiScenarioService.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanApiScenarioService.java index 81bb596f27..b6aba70d27 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanApiScenarioService.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanApiScenarioService.java @@ -478,7 +478,7 @@ public class TestPlanApiScenarioService extends TestPlanResourceService { private Map getCollectionCount(TestPlanApiScenarioModuleRequest request) { request.setCollectionId(null); Map projectModuleCountMap = new HashMap<>(); - List list = extTestPlanApiScenarioMapper.collectionCountByRequest(request.getTestPlanId()); + List list = extTestPlanApiScenarioMapper.collectionCountByRequest(request); list.forEach(item -> { projectModuleCountMap.put(item.getModuleId(), (long) item.getDataCount()); }); diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanFunctionalCaseService.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanFunctionalCaseService.java index 45efa86e0f..b2703130cf 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanFunctionalCaseService.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanFunctionalCaseService.java @@ -371,7 +371,7 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService { private Map getCollectionCount(TestPlanCaseModuleRequest request) { request.setCollectionId(null); Map projectModuleCountMap = new HashMap<>(); - List list = extTestPlanFunctionalCaseMapper.collectionCountByRequest(request.getTestPlanId()); + List list = extTestPlanFunctionalCaseMapper.collectionCountByRequest(request); list.forEach(item -> { projectModuleCountMap.put(item.getModuleId(), (long) item.getDataCount()); });