From 37de2f4b0f732ca5c19582d4a340ad7c987925b5 Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期三, 05 十一月 2025 22:40:47 +0800
Subject: [PATCH] feat: 部门管理多个车辆

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

diff --git a/ruoyi-system/src/main/resources/mapper/system/SysTaskEmergencyMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysTaskEmergencyMapper.xml
index cf83d3c..0eaf2d9 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysTaskEmergencyMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysTaskEmergencyMapper.xml
@@ -223,8 +223,21 @@
     <select id="selectPendingSyncTasks" resultMap="SysTaskEmergencyResult">
         <include refid="selectSysTaskEmergencyVo"/>
         where (sync_status = 0 or sync_status = 3)
+          and task_id in (
+              select task_id from sys_task 
+              where task_type = 'EMERGENCY_TRANSFER'                
+                and del_flag = '0'
+          )
         order by id asc
-        limit 100
+        <if test="offset != null and limit != null">
+            limit #{offset}, #{limit}
+        </if>
+        <if test="offset == null and limit != null">
+            limit #{limit}
+        </if>
+        <if test="offset == null and limit == null">
+            limit 100
+        </if>
     </select>
     
     <!-- 鏌ヨ寰呭悓姝ヨ皟搴﹀崟鐨勪换鍔★紙宸插悓姝ユ湇鍔″崟浣嗘湭鍚屾璋冨害鍗曪級 -->
@@ -233,8 +246,44 @@
         where sync_status = 2 
           and legacy_service_ord_id is not null 
           and (dispatch_sync_status = 0 or dispatch_sync_status = 3 or dispatch_sync_status is null)
+          and task_id in (
+              select task_id from sys_task 
+              where task_type = 'EMERGENCY_TRANSFER'
+                and task_status not in ('COMPLETED', 'CANCELLED')  <!-- 杩囨护宸插畬鎴�/宸插彇娑堢殑浠诲姟 -->
+                and del_flag = '0'
+          )
         order by id asc
-        limit 100
+        <if test="offset != null and limit != null">
+            limit #{offset}, #{limit}
+        </if>
+        <if test="offset == null and limit != null">
+            limit #{limit}
+        </if>
+        <if test="offset == null and limit == null">
+            limit 100
+        </if>
+    </select>
+    
+    <!-- 鏌ヨ宸插悓姝ヨ皟搴﹀崟涓旂姸鎬佹湭瀹屾垚鐨勪换鍔★紙鐢ㄤ簬鐘舵�佸悓姝ワ級 -->
+    <select id="selectSyncedTasksForStatusUpdate" resultMap="SysTaskEmergencyResult">
+        <include refid="selectSysTaskEmergencyVo"/>
+        where dispatch_sync_status = 2 
+          and legacy_dispatch_ord_id is not null
+          and task_id in (
+              select task_id from sys_task 
+              where task_type = 'EMERGENCY_TRANSFER'
+                and del_flag = '0'
+          )
+        order by id asc
+        <if test="offset != null and limit != null">
+            limit #{offset}, #{limit}
+        </if>
+        <if test="offset == null and limit != null">
+            limit #{limit}
+        </if>
+        <if test="offset == null and limit == null">
+            limit 200
+        </if>
     </select>
 
 </mapper>

--
Gitblit v1.9.1