From 3b0d51d628c772c47845d9fd0b95ebde8a969d07 Mon Sep 17 00:00:00 2001
From: yeg <1347747024@qq.com>
Date: 星期二, 01 九月 2026 11:59:12 +0800
Subject: [PATCH] 实现数据修订行为模型

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

diff --git a/ruoyi-system/src/main/resources/mapper/system/TTestMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TTestMapper.xml
index 7f26929..1f0e210 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TTestMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TTestMapper.xml
@@ -227,6 +227,42 @@
         (#{testName}, #{creatorId}, #{principalId}, #{testTypeId}, #{testPurpose}, #{testStatus}, #{receptionStatus},
          #{monitorTimeoutMinutes}, 0, #{createBy}, #{createTime}, #{remark})
     </insert>
+    <resultMap id="TTestDataRevisionActionResultMap" type="com.ruoyi.system.domain.TTestDataRevisionAction">
+        <id property="actionId" column="action_id"/>
+        <result property="testId" column="test_id"/><result property="testName" column="test_name"/>
+        <result property="testReceptionStatus" column="reception_status"/>
+        <result property="dataType" column="data_type"/><result property="operationType" column="operation_type"/>
+        <result property="scopeSummary" column="scope_summary"/><result property="identitySummary" column="identity_summary"/>
+        <result property="changesSummary" column="changes_summary"/><result property="reason" column="reason"/>
+        <result property="operatorId" column="operator_id"/><result property="operatorName" column="operator_name"/>
+        <result property="createdAtUtc" column="created_at_utc"/>
+    </resultMap>
+    <select id="selectDataRevisionActions" parameterType="com.ruoyi.system.domain.TTestDataRevisionAction" resultMap="TTestDataRevisionActionResultMap">
+        select a.action_id, a.test_id, t.test_name, t.reception_status,
+               a.data_type, a.operation_type, a.scope_summary,
+               cast(a.identity_summary as char) identity_summary,
+               cast(a.changes_summary as char) changes_summary, a.reason,
+               a.operator_id, a.operator_name, a.created_at_utc
+        from t_test_data_revision_action a join t_test t on t.test_id = a.test_id
+        <where>
+            <if test="testId != null">and a.test_id = #{testId}</if>
+            <if test="testName != null and testName != ''">and t.test_name like concat('%', #{testName}, '%')</if>
+            <if test="dataType != null and dataType != ''">and a.data_type = #{dataType}</if>
+            <if test="operationType != null and operationType != ''">and a.operation_type = #{operationType}</if>
+            <if test="beginCreatedAt != null">and a.created_at_utc &gt;= #{beginCreatedAt}</if>
+            <if test="endCreatedAt != null">and a.created_at_utc &lt; #{endCreatedAt}</if>
+        </where>
+        order by a.created_at_utc desc, a.action_id desc
+    </select>
+    <select id="selectDataRevisionActionById" parameterType="long" resultMap="TTestDataRevisionActionResultMap">
+        select a.action_id, a.test_id, t.test_name, t.reception_status,
+               a.data_type, a.operation_type, a.scope_summary,
+               cast(a.identity_summary as char) identity_summary,
+               cast(a.changes_summary as char) changes_summary, a.reason,
+               a.operator_id, a.operator_name, a.created_at_utc
+        from t_test_data_revision_action a join t_test t on t.test_id = a.test_id
+        where a.action_id = #{actionId}
+    </select>
 
     <update id="updateTest" parameterType="TTest">
         update t_test
@@ -822,11 +858,29 @@
         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}
+    <select id="selectBtsSampleIdByDeviceChannelSequence" resultType="long">
+        select sample.sample_id
+        from t_test_sample sample
+        join t_detection_channel channel_fact on channel_fact.channel_id = sample.channel_id
+        where sample.test_id = #{testId} and channel_fact.devid = #{deviceId}
+          and channel_fact.chlid = #{channelNo} and sample.seq_id = #{sequenceId}
         limit 1
     </select>
+    <select id="selectBtsSampleIdsByDeviceChannelStep" resultType="long">
+        select sample.sample_id
+        from t_test_sample sample
+        join t_detection_channel channel_fact on channel_fact.channel_id = sample.channel_id
+        where sample.test_id = #{testId} and channel_fact.devid = #{deviceId}
+          and channel_fact.chlid = #{channelNo} and sample.cycle_no = #{cycleNo}
+          and sample.step_no = #{stepNo}
+    </select>
+    <select id="selectBtsSampleIdsByDeviceChannelCycle" resultType="long">
+        select sample.sample_id
+        from t_test_sample sample
+        join t_detection_channel channel_fact on channel_fact.channel_id = sample.channel_id
+        where sample.test_id = #{testId} and channel_fact.devid = #{deviceId}
+          and channel_fact.chlid = #{channelNo} and sample.cycle_no = #{cycleNo}
+    </select>
     <insert id="insertConsoleImportRecord" parameterType="com.ruoyi.system.domain.TTestConsoleImportRecord"
             useGeneratedKeys="true" keyProperty="importRecordId">
         insert into t_test_console_import_record

--
Gitblit v1.7.1