From 2651949754a60afae6152977a0f83a1b4704cba5 Mon Sep 17 00:00:00 2001
From: yeg <1347747024@qq.com>
Date: 星期四, 27 八月 2026 20:57:17 +0800
Subject: [PATCH] fix(test): address configuration review findings

---
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TTestServiceImpl.java |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TTestServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TTestServiceImpl.java
index de2f8b9..6a30d81 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TTestServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TTestServiceImpl.java
@@ -135,7 +135,7 @@
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public int deleteTestByIds(Long[] testIds, String updateBy)
+    public int deleteTestByIds(Long[] testIds, Long operatorId, String updateBy)
     {
         if (testIds == null || testIds.length == 0) throw new ServiceException("请选择要删除的测试");
         int rows = 0;
@@ -144,7 +144,12 @@
             TTest current = testMapper.selectTestByIdForUpdate(testId);
             if (current == null) throw new ServiceException("测试不存在");
             if (!NOT_MONITORED.equals(current.getMonitoringStatus())) throw new ServiceException("开始监测后不能删除测试");
-            rows += testMapper.deleteTestById(testId, updateBy);
+            loadConfiguration(current);
+            int deleted = testMapper.deleteTestById(testId, updateBy);
+            if (deleted != 1) throw new ServiceException("测试配置已变更,请刷新后重试");
+            testMapper.insertTestAudit(testId, "TEST_DELETED", operatorId, updateBy,
+                    JSON.toJSONString(current), null);
+            rows += deleted;
         }
         return rows;
     }

--
Gitblit v1.7.1