fix(测试跟踪): 功能用例批量删除的问题

--bug=1015479 --user=宋昌昌 【测试跟踪】功能用例-批量选择用例-选择所有数据(24条)-批量删除只删除当前页10条用例 https://www.tapd.cn/55049933/s/1215152
This commit is contained in:
song-cc-rock 2022-07-29 14:10:34 +08:00 committed by f2c-ci-robot[bot]
parent e4fd5f1900
commit 6a733aca3f
3 changed files with 11 additions and 4 deletions

View File

@ -343,7 +343,7 @@ public class TestCaseController {
@SendNotice(taskType = NoticeConstants.TaskType.TRACK_TEST_CASE_TASK, target = "#targetClass.findByBatchRequest(#request)", targetClass = TestCaseService.class, @SendNotice(taskType = NoticeConstants.TaskType.TRACK_TEST_CASE_TASK, target = "#targetClass.findByBatchRequest(#request)", targetClass = TestCaseService.class,
event = NoticeConstants.Event.DELETE, subject = "测试用例通知") event = NoticeConstants.Event.DELETE, subject = "测试用例通知")
public void deleteToGcBatch(@RequestBody TestCaseBatchRequest request) { public void deleteToGcBatch(@RequestBody TestCaseBatchRequest request) {
testCaseService.deleteToGcBatch(request.getIds()); testCaseService.deleteToGcBatch(request);
} }
@PostMapping("/batch/movePublic/deleteToGc") @PostMapping("/batch/movePublic/deleteToGc")

View File

@ -204,7 +204,7 @@ public class TestCaseNodeService extends NodeTreeService<TestCaseNodeDTO> {
List<String> testCaseIdList = this.selectCaseIdByNodeIds(nodeIds); List<String> testCaseIdList = this.selectCaseIdByNodeIds(nodeIds);
TestCaseBatchRequest request = new TestCaseBatchRequest(); TestCaseBatchRequest request = new TestCaseBatchRequest();
request.setIds(testCaseIdList); request.setIds(testCaseIdList);
testCaseService.deleteToGcBatch(request.getIds()); testCaseService.deleteToGcBatch(request);
TestCaseNodeExample testCaseNodeExample = new TestCaseNodeExample(); TestCaseNodeExample testCaseNodeExample = new TestCaseNodeExample();
testCaseNodeExample.createCriteria().andIdIn(nodeIds); testCaseNodeExample.createCriteria().andIdIn(nodeIds);

View File

@ -682,7 +682,14 @@ public class TestCaseService {
return extTestCaseMapper.deleteToGc(request); return extTestCaseMapper.deleteToGc(request);
} }
public int deleteToGcBatch(List<String> ids) { public int deleteToGcBatch(TestCaseBatchRequest request) {
List<String> ids = new ArrayList<String>();
if (request.getCondition() != null && request.getCondition().isSelectAll()) {
List<TestCaseDTO> testCaseDTOS = listTestCase(request.getCondition());
ids = testCaseDTOS.stream().map(TestCaseDTO::getId).collect(Collectors.toList());
} else {
ids = request.getIds();
}
return deleteToGcBatch(ids, null); return deleteToGcBatch(ids, null);
} }
@ -2273,7 +2280,7 @@ public class TestCaseService {
public void reduction(TestCaseBatchRequest request) { public void reduction(TestCaseBatchRequest request) {
List<String> ids = new ArrayList<>(); List<String> ids = new ArrayList<>();
if (request.getCondition().isSelectAll()) { if (request.getCondition() != null && request.getCondition().isSelectAll()) {
List<TestCaseDTO> allReductionTestCases = listTestCase(request.getCondition()); List<TestCaseDTO> allReductionTestCases = listTestCase(request.getCondition());
ids = allReductionTestCases.stream().map(TestCaseDTO::getId).collect(Collectors.toList()); ids = allReductionTestCases.stream().map(TestCaseDTO::getId).collect(Collectors.toList());
} else { } else {