fix(测试计划): 修复关联问题

--bug=1044413 --user=王旭 【测试计划】测试规划-接口用例-选中模块后再取消勾选一个接口关联数据错误 https://www.tapd.cn/55049933/s/1554109
This commit is contained in:
WangXu10 2024-07-25 11:25:46 +08:00 committed by Craftsman
parent a58083f3b1
commit 3652b3db10
1 changed files with 3 additions and 3 deletions

View File

@ -642,7 +642,6 @@ public class TestPlanApiCaseService extends TestPlanResourceService {
} }
if (CollectionUtils.isNotEmpty(dto.getSelectIds())) { if (CollectionUtils.isNotEmpty(dto.getSelectIds())) {
CollectionUtils.removeAll(dto.getSelectIds(), apiTestCaseList.stream().map(ApiTestCase::getId).toList());
//获取选中的ids数据 //获取选中的ids数据
List<ApiTestCase> selectIdList = extApiTestCaseMapper.getCaseListBySelectIds(isRepeat, apiCase.getModules().getProjectId(), dto.getSelectIds(), testPlan.getId(), apiCase.getModules().getProtocols()); List<ApiTestCase> selectIdList = extApiTestCaseMapper.getCaseListBySelectIds(isRepeat, apiCase.getModules().getProjectId(), dto.getSelectIds(), testPlan.getId(), apiCase.getModules().getProtocols());
apiTestCaseList.addAll(selectIdList); apiTestCaseList.addAll(selectIdList);
@ -650,8 +649,9 @@ public class TestPlanApiCaseService extends TestPlanResourceService {
if (CollectionUtils.isNotEmpty(dto.getExcludeIds())) { if (CollectionUtils.isNotEmpty(dto.getExcludeIds())) {
//排除的ids //排除的ids
List<String> excludeIds = dto.getExcludeIds(); List<ApiTestCase> excludeList = extApiTestCaseMapper.getCaseListBySelectIds(isRepeat, apiCase.getModules().getProjectId(), dto.getExcludeIds(), testPlan.getId(), apiCase.getModules().getProtocols());
apiTestCaseList = apiTestCaseList.stream().filter(item -> !excludeIds.contains(item.getId())).toList(); List<String> excludeIds = excludeList.stream().map(ApiTestCase::getId).toList();
apiTestCaseList = apiTestCaseList.stream().filter(item -> !excludeIds.contains(item.getId())).distinct().toList();
} }
if (CollectionUtils.isNotEmpty(apiTestCaseList)) { if (CollectionUtils.isNotEmpty(apiTestCaseList)) {