mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-04 21:19:52 +08:00
refactor(测试跟踪): 禁止批量删除运行中的测试计划
--bug=1020150 --user=陈建星 【测试跟踪】正在执行的计划,批量删除也成功了 https://www.tapd.cn/55049933/s/1319968
This commit is contained in:
parent
923215ce05
commit
95c8bc9732
@ -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<String> planIds);
|
||||
}
|
||||
|
@ -28,4 +28,13 @@
|
||||
where test_plan_id = #{planId} and status = 'RUNNING'
|
||||
order by create_time desc limit 1;
|
||||
</select>
|
||||
<select id="hasRunningReportByPlanIds" resultType="java.lang.Boolean">
|
||||
select count(1) > 0 from test_plan_report
|
||||
where test_plan_id in
|
||||
<foreach collection="planIds" item="planId" separator="," open="(" close=")">
|
||||
#{planId}
|
||||
</foreach>
|
||||
and status = 'RUNNING'
|
||||
order by create_time desc limit 1;
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -140,6 +140,10 @@ public class TestPlanReportService {
|
||||
return extTestPlanReportContentMapper.hasRunningReport(planId);
|
||||
}
|
||||
|
||||
public boolean hasRunningReport(List<String> planIds) {
|
||||
return extTestPlanReportContentMapper.hasRunningReportByPlanIds(planIds);
|
||||
}
|
||||
|
||||
public void setTestPlanReportPassRate(List<TestPlanReportDTO> list) {
|
||||
for (TestPlanReportDTO testPlanReportDTO : list) {
|
||||
// 如果数据库查询成功率字段为空或 0 则重新计算一次
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user