From 3d781111a5289987fdda13ce45bcfcabad207644 Mon Sep 17 00:00:00 2001
From: yeg <1347747024@qq.com>
Date: 星期二, 01 九月 2026 00:48:33 +0800
Subject: [PATCH] 实现控制台数据修订导入删除

---
 ruoyi-system/src/main/resources/mapper/system/TTestMapper.xml |   53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 53 insertions(+), 0 deletions(-)

diff --git a/ruoyi-system/src/main/resources/mapper/system/TTestMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TTestMapper.xml
index 0364b4d..7f26929 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TTestMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TTestMapper.xml
@@ -784,4 +784,57 @@
         where exception_fact.test_id = #{testId} and exception_fact.interval_status = 'OPEN'
         order by exception_fact.opened_at_utc, exception_fact.interval_id
     </select>
+    <resultMap id="TTestDataOverrideResultMap" type="com.ruoyi.system.domain.TTestDataOverride">
+        <id property="overrideId" column="override_id"/><result property="testId" column="test_id"/>
+        <result property="dataType" column="data_type"/><result property="stableIdentity" column="stable_identity"/>
+        <result property="fieldValues" column="field_values"/><result property="deleted" column="deleted"/>
+        <result property="actionId" column="action_id"/><result property="createdAtUtc" column="created_at_utc"/>
+    </resultMap>
+    <insert id="insertDataRevisionAction" parameterType="com.ruoyi.system.domain.TTestDataRevisionAction"
+            useGeneratedKeys="true" keyProperty="actionId">
+        insert into t_test_data_revision_action
+        (test_id, data_type, operation_type, scope_summary, identity_summary, changes_summary,
+         reason, operator_id, operator_name, created_at_utc)
+        values (#{testId}, #{dataType}, #{operationType}, #{scopeSummary}, cast(#{identitySummary} as json),
+                cast(#{changesSummary} as json), #{reason}, #{operatorId}, #{operatorName}, #{createdAtUtc})
+    </insert>
+    <insert id="upsertDataOverride" parameterType="com.ruoyi.system.domain.TTestDataOverride">
+        insert into t_test_data_override
+        (test_id, data_type, stable_identity, field_values, deleted, action_id, created_at_utc)
+        values (#{testId}, #{dataType}, #{stableIdentity}, cast(#{fieldValues} as json), #{deleted}, #{actionId}, #{createdAtUtc})
+        on duplicate key update field_values = values(field_values), deleted = values(deleted),
+            action_id = values(action_id), created_at_utc = values(created_at_utc)
+    </insert>
+    <select id="selectDataOverrides" resultMap="TTestDataOverrideResultMap">
+        select override_id, test_id, data_type, stable_identity, field_values, deleted, action_id, created_at_utc
+        from t_test_data_override where test_id = #{testId} and data_type = #{dataType}
+        order by override_id
+    </select>
+    <delete id="deleteBtsSamplesByIds">
+        delete from t_test_sample where test_id = #{testId} and sample_id in
+        <foreach collection="sampleIds" item="id" open="(" separator="," close=")">#{id}</foreach>
+    </delete>
+    <delete id="deleteBtsMeasurementsBySampleIds">
+        delete from t_test_sample_measurement where sample_id in
+        <foreach collection="sampleIds" item="id" open="(" separator="," close=")">#{id}</foreach>
+    </delete>
+    <delete id="deleteCollectorSamplesByIds">
+        delete from t_test_collector_sample where test_id = #{testId} and sample_id in
+        <foreach collection="sampleIds" item="id" open="(" separator="," close=")">#{id}</foreach>
+    </delete>
+    <select id="selectBtsSampleIdByChannelSequence" resultType="long">
+        select sample_id from t_test_sample
+        where test_id = #{testId} and channel_id = #{channelId} and seq_id = #{sequenceId}
+        limit 1
+    </select>
+    <insert id="insertConsoleImportRecord" parameterType="com.ruoyi.system.domain.TTestConsoleImportRecord"
+            useGeneratedKeys="true" keyProperty="importRecordId">
+        insert into t_test_console_import_record
+        (test_id, data_type, stable_identity, row_values, action_id, created_at_utc)
+        values (#{testId}, #{dataType}, #{stableIdentity}, cast(#{rowValues} as json), #{actionId}, #{createdAtUtc})
+    </insert>
+    <select id="countTestBatteryNo" resultType="int">
+        select count(1) from t_test_battery
+        where test_id = #{testId} and battery_no = #{batteryNo} and del_flag = 0
+    </select>
 </mapper>

--
Gitblit v1.7.1