From 6a733aca3f70a84dc4ab57ce20939ffeb5ef0248 Mon Sep 17 00:00:00 2001 From: song-cc-rock Date: Fri, 29 Jul 2022 14:10:34 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E7=94=A8=E4=BE=8B=E6=89=B9=E9=87=8F=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1015479 --user=宋昌昌 【测试跟踪】功能用例-批量选择用例-选择所有数据(24条)-批量删除只删除当前页10条用例 https://www.tapd.cn/55049933/s/1215152 --- .../track/controller/TestCaseController.java | 2 +- .../track/service/TestCaseNodeService.java | 2 +- .../io/metersphere/track/service/TestCaseService.java | 11 +++++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) 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 {