From f2102f5288540ef73a9bafcbc1bcecd9fc101448 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Wed, 16 Feb 2022 11:12:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AE=9A=E6=97=B6=E6=B8=85=E7=90=86?= =?UTF-8?q?=E5=9C=BA=E6=99=AF=E6=8A=A5=E5=91=8A=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/ApiScenarioReportService.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java index c7ca407d1e..2d2b78e48f 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java @@ -494,6 +494,13 @@ public class ApiScenarioReportService { public void delete(String id) { apiScenarioReportDetailMapper.deleteByPrimaryKey(id); apiScenarioReportMapper.deleteByPrimaryKey(id); + ApiScenarioReportResultExample example = new ApiScenarioReportResultExample(); + example.createCriteria().andReportIdEqualTo(id); + apiScenarioReportResultMapper.deleteByExample(example); + + ApiScenarioReportStructureExample structureExample = new ApiScenarioReportStructureExample(); + structureExample.createCriteria().andReportIdEqualTo(id); + apiScenarioReportStructureMapper.deleteByExample(structureExample); } public void deleteByIds(List ids) { @@ -503,6 +510,14 @@ public class ApiScenarioReportService { detailExample.createCriteria().andReportIdIn(ids); apiScenarioReportDetailMapper.deleteByExample(detailExample); apiScenarioReportMapper.deleteByExample(example); + + ApiScenarioReportResultExample reportResultExample = new ApiScenarioReportResultExample(); + reportResultExample.createCriteria().andReportIdIn(ids); + apiScenarioReportResultMapper.deleteByExample(reportResultExample); + + ApiScenarioReportStructureExample structureExample = new ApiScenarioReportStructureExample(); + structureExample.createCriteria().andReportIdIn(ids); + apiScenarioReportStructureMapper.deleteByExample(structureExample); } public void deleteAPIReportBatch(APIReportBatchRequest reportRequest) { @@ -742,7 +757,10 @@ public class ApiScenarioReportService { List apiScenarioReports = apiScenarioReportMapper.selectByExample(example); List ids = apiScenarioReports.stream().map(ApiScenarioReport::getId).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(ids)) { - deleteByIds(ids); + APIReportBatchRequest request = new APIReportBatchRequest(); + request.setIds(ids); + request.setSelectAllDate(false); + deleteAPIReportBatch(request); } }