diff --git a/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java b/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java index 3c70e127a0..6a6819119f 100644 --- a/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java +++ b/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java @@ -343,7 +343,7 @@ public class TestCaseController { @SendNotice(taskType = NoticeConstants.TaskType.TRACK_TEST_CASE_TASK, target = "#targetClass.findByBatchRequest(#request)", targetClass = TestCaseService.class, event = NoticeConstants.Event.DELETE, subject = "测试用例通知") public void deleteToGcBatch(@RequestBody TestCaseBatchRequest request) { - testCaseService.deleteToGcBatch(request.getIds()); + testCaseService.deleteToGcBatch(request); } @PostMapping("/batch/movePublic/deleteToGc") diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseNodeService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseNodeService.java index 6b2cfc3465..a11a979644 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseNodeService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseNodeService.java @@ -204,7 +204,7 @@ public class TestCaseNodeService extends NodeTreeService { List testCaseIdList = this.selectCaseIdByNodeIds(nodeIds); TestCaseBatchRequest request = new TestCaseBatchRequest(); request.setIds(testCaseIdList); - testCaseService.deleteToGcBatch(request.getIds()); + testCaseService.deleteToGcBatch(request); TestCaseNodeExample testCaseNodeExample = new TestCaseNodeExample(); testCaseNodeExample.createCriteria().andIdIn(nodeIds); diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java index bcb450f67f..aec3ae6311 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -682,7 +682,14 @@ public class TestCaseService { return extTestCaseMapper.deleteToGc(request); } - public int deleteToGcBatch(List ids) { + public int deleteToGcBatch(TestCaseBatchRequest request) { + List ids = new ArrayList(); + if (request.getCondition() != null && request.getCondition().isSelectAll()) { + List testCaseDTOS = listTestCase(request.getCondition()); + ids = testCaseDTOS.stream().map(TestCaseDTO::getId).collect(Collectors.toList()); + } else { + ids = request.getIds(); + } return deleteToGcBatch(ids, null); } @@ -2273,7 +2280,7 @@ public class TestCaseService { public void reduction(TestCaseBatchRequest request) { List ids = new ArrayList<>(); - if (request.getCondition().isSelectAll()) { + if (request.getCondition() != null && request.getCondition().isSelectAll()) { List allReductionTestCases = listTestCase(request.getCondition()); ids = allReductionTestCases.stream().map(TestCaseDTO::getId).collect(Collectors.toList()); } else {