diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiTestCaseMapper.java b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiTestCaseMapper.java index f2b752a8d7..27191eda7e 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiTestCaseMapper.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiTestCaseMapper.java @@ -108,5 +108,5 @@ public interface ExtApiTestCaseMapper { List getListBySelectIds(@Param("projectId") String projectId, @Param("ids") List ids, @Param("testPlanId") String testPlanId, @Param("protocols") List protocols); - List getCaseListBySelectIds(@Param("projectId") String projectId, @Param("ids") List ids, @Param("testPlanId") String testPlanId, @Param("protocols") List protocols); + List getCaseListBySelectIds(@Param("isRepeat") boolean isRepeat, @Param("projectId") String projectId, @Param("ids") List ids, @Param("testPlanId") String testPlanId, @Param("protocols") List protocols); } \ No newline at end of file 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 baec5ee9f1..e5c2c1ef7a 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 @@ -712,6 +712,11 @@ #{protocol} + + AND api_test_case.id not in ( + select api_case_id from test_plan_api_case where test_plan_id = #{testPlanId} + ) + 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 4bd8ec1a6a..9e2a446dcf 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 @@ -644,7 +644,7 @@ 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(apiCase.getModules().getProjectId(), dto.getSelectIds(), testPlan.getId(), apiCase.getModules().getProtocols()); + List selectIdList = extApiTestCaseMapper.getCaseListBySelectIds(isRepeat, apiCase.getModules().getProjectId(), dto.getSelectIds(), testPlan.getId(), apiCase.getModules().getProtocols()); apiTestCaseList.addAll(selectIdList); }