From c2eefadb8239df552ef43d7ba55d5735bb603ed1 Mon Sep 17 00:00:00 2001
From: yeg <1347747024@qq.com>
Date: 星期日, 30 八月 2026 14:50:28 +0800
Subject: [PATCH] 实现测试暂停继续接收区间

---
 ruoyi-system/src/main/resources/mapper/system/TTestMapper.xml |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 48 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 d432575..fd242ba 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TTestMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TTestMapper.xml
@@ -399,4 +399,52 @@
         values(#{testId}, #{bindingId}, #{sourceType}, #{sourceId}, #{sourceChannelCode}, #{actionAtUtc},
                #{startBoundaryAtUtc}, #{boundaryNote}, #{intervalStatus})
     </insert>
+    <select id="selectOpenReceptionIntervalsForUpdate" parameterType="Long"
+            resultType="com.ruoyi.system.domain.TTestReceptionInterval">
+        select interval_id intervalId, test_id testId, binding_id bindingId, source_type sourceType,
+               source_id sourceId, source_channel_code sourceChannelCode, action_at_utc actionAtUtc,
+               start_boundary_at_utc startBoundaryAtUtc, end_boundary_at_utc endBoundaryAtUtc,
+               boundary_note boundaryNote, interval_status intervalStatus
+        from t_test_reception_interval
+        where test_id = #{testId} and interval_status = 'OPEN'
+        order by interval_id
+        for update
+    </select>
+    <select id="selectReceptionIntervals" parameterType="Long"
+            resultType="com.ruoyi.system.domain.TTestReceptionInterval">
+        select interval_id intervalId, test_id testId, binding_id bindingId, source_type sourceType,
+               source_id sourceId, source_channel_code sourceChannelCode, action_at_utc actionAtUtc,
+               start_boundary_at_utc startBoundaryAtUtc, end_boundary_at_utc endBoundaryAtUtc,
+               boundary_note boundaryNote, interval_status intervalStatus
+        from t_test_reception_interval
+        where test_id = #{testId}
+        order by interval_id
+    </select>
+    <select id="selectLatestReceptionIntervalForUpdate" resultType="com.ruoyi.system.domain.TTestReceptionInterval">
+        select interval_id intervalId, test_id testId, binding_id bindingId, source_type sourceType,
+               source_id sourceId, source_channel_code sourceChannelCode, action_at_utc actionAtUtc,
+               start_boundary_at_utc startBoundaryAtUtc, end_boundary_at_utc endBoundaryAtUtc,
+               boundary_note boundaryNote, interval_status intervalStatus
+        from t_test_reception_interval
+        where test_id = #{testId} and source_type = #{sourceType} and source_id = #{sourceId}
+          and (source_channel_code = #{sourceChannelCode} or (source_channel_code is null and #{sourceChannelCode} is null))
+        order by interval_id desc
+        limit 1
+        for update
+    </select>
+    <update id="closeReceptionInterval">
+        update t_test_reception_interval
+        set end_boundary_at_utc = #{endBoundaryAtUtc}, boundary_note = #{boundaryNote}, interval_status = 'CLOSED'
+        where interval_id = #{intervalId} and interval_status = 'OPEN'
+    </update>
+    <update id="updateReceptionPaused">
+        update t_test
+        set test_status = 'PAUSED', reception_status = 'PAUSED', update_by = #{updateBy}, update_time = #{updatedAtUtc}
+        where test_id = #{testId} and reception_status = 'RECEIVING' and del_flag = 0
+    </update>
+    <update id="updateReceptionResumed">
+        update t_test
+        set test_status = 'RUNNING', reception_status = 'RECEIVING', update_by = #{updateBy}, update_time = #{updatedAtUtc}
+        where test_id = #{testId} and reception_status = 'PAUSED' and del_flag = 0
+    </update>
 </mapper>

--
Gitblit v1.7.1