From 3652b3db1008f8ac9dcb0f1cfeb80fcf67f5cb92 Mon Sep 17 00:00:00 2001 From: WangXu10 Date: Thu, 25 Jul 2024 11:25:46 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=85=B3=E8=81=94=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1044413 --user=王旭 【测试计划】测试规划-接口用例-选中模块后再取消勾选一个接口关联数据错误 https://www.tapd.cn/55049933/s/1554109 --- .../io/metersphere/plan/service/TestPlanApiCaseService.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 9e2a446dcf..892e6c864a 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 @@ -642,7 +642,6 @@ public class TestPlanApiCaseService extends TestPlanResourceService { } if (CollectionUtils.isNotEmpty(dto.getSelectIds())) { - CollectionUtils.removeAll(dto.getSelectIds(), apiTestCaseList.stream().map(ApiTestCase::getId).toList()); //获取选中的ids数据 List selectIdList = extApiTestCaseMapper.getCaseListBySelectIds(isRepeat, apiCase.getModules().getProjectId(), dto.getSelectIds(), testPlan.getId(), apiCase.getModules().getProtocols()); apiTestCaseList.addAll(selectIdList); @@ -650,8 +649,9 @@ public class TestPlanApiCaseService extends TestPlanResourceService { if (CollectionUtils.isNotEmpty(dto.getExcludeIds())) { //排除的ids - List excludeIds = dto.getExcludeIds(); - apiTestCaseList = apiTestCaseList.stream().filter(item -> !excludeIds.contains(item.getId())).toList(); + List excludeList = extApiTestCaseMapper.getCaseListBySelectIds(isRepeat, apiCase.getModules().getProjectId(), dto.getExcludeIds(), testPlan.getId(), apiCase.getModules().getProtocols()); + List excludeIds = excludeList.stream().map(ApiTestCase::getId).toList(); + apiTestCaseList = apiTestCaseList.stream().filter(item -> !excludeIds.contains(item.getId())).distinct().toList(); } if (CollectionUtils.isNotEmpty(apiTestCaseList)) {