wlzboy
2025-11-22 fd047fa7234dc11643dab8ecbf38e8d7a8ba0854
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,56 @@
        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>
    <!-- 根据旧系统服务单ID查询急救转运任务扩展信息 -->
    <select id="selectByLegacyServiceOrdId" parameterType="Long" resultMap="SysTaskEmergencyResult">
        <include refid="selectSysTaskEmergencyVo"/>
        where legacy_service_ord_id = #{legacyServiceOrdId}
    </select>
    <!-- 根据旧系统调度单ID查询急救转运任务扩展信息 -->
    <select id="selectByLegacyDispatchOrdId" parameterType="Long" resultMap="SysTaskEmergencyResult">
        <include refid="selectSysTaskEmergencyVo"/>
        where legacy_dispatch_ord_id = #{legacyDispatchOrdId}
    </select>
</mapper>