From 95c8bc9732420f5b8f29534a17f4072edfa136b9 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Tue, 27 Dec 2022 16:33:53 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):?= =?UTF-8?q?=20=E7=A6=81=E6=AD=A2=E6=89=B9=E9=87=8F=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E4=B8=AD=E7=9A=84=E6=B5=8B=E8=AF=95=E8=AE=A1?= =?UTF-8?q?=E5=88=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1020150 --user=陈建星 【测试跟踪】正在执行的计划,批量删除也成功了 https://www.tapd.cn/55049933/s/1319968 --- .../base/mapper/ext/ExtTestPlanReportContentMapper.java | 4 ++++ .../base/mapper/ext/ExtTestPlanReportContentMapper.xml | 9 +++++++++ .../metersphere/plan/service/TestPlanReportService.java | 4 ++++ .../io/metersphere/plan/service/TestPlanService.java | 3 +++ 4 files changed, 20 insertions(+) diff --git a/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanReportContentMapper.java b/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanReportContentMapper.java index fe5b784d56..c7d6d95b1d 100644 --- a/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanReportContentMapper.java +++ b/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanReportContentMapper.java @@ -3,6 +3,8 @@ package io.metersphere.base.mapper.ext; import io.metersphere.base.domain.TestPlanReportContentWithBLOBs; import org.apache.ibatis.annotations.Param; +import java.util.List; + public interface ExtTestPlanReportContentMapper { boolean isDynamicallyGenerateReport(@Param("reportId") String reportId); @@ -10,4 +12,6 @@ public interface ExtTestPlanReportContentMapper { TestPlanReportContentWithBLOBs selectForPassRate(@Param("reportId") String reportId); boolean hasRunningReport(@Param("planId") String planId); + + boolean hasRunningReportByPlanIds(@Param("planIds") List planIds); } diff --git a/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanReportContentMapper.xml b/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanReportContentMapper.xml index 64126a20ee..e3bec52a18 100644 --- a/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanReportContentMapper.xml +++ b/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanReportContentMapper.xml @@ -28,4 +28,13 @@ where test_plan_id = #{planId} and status = 'RUNNING' order by create_time desc limit 1; + diff --git a/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanReportService.java b/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanReportService.java index 4b418248b3..24864afe71 100644 --- a/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanReportService.java +++ b/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanReportService.java @@ -140,6 +140,10 @@ public class TestPlanReportService { return extTestPlanReportContentMapper.hasRunningReport(planId); } + public boolean hasRunningReport(List planIds) { + return extTestPlanReportContentMapper.hasRunningReportByPlanIds(planIds); + } + public void setTestPlanReportPassRate(List list) { for (TestPlanReportDTO testPlanReportDTO : list) { // 如果数据库查询成功率字段为空或 0 则重新计算一次 diff --git a/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanService.java b/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanService.java index 8b7065a1c7..cc1b279083 100644 --- a/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanService.java +++ b/test-track/backend/src/main/java/io/metersphere/plan/service/TestPlanService.java @@ -1996,6 +1996,9 @@ public class TestPlanService { ids.removeAll(request.getUnSelectIds()); } } + if (testPlanReportService.hasRunningReport(ids)) { + MSException.throwException(Translator.get("test_plan_delete_exec_error")); + } this.deleteTestPlans(ids); }