wujianwei
2025-12-29 db3d45754040c64bdf7f7ff62f8cf2a03b63dba3
tms/src/main/resources/mapper/tms/TmsDispatchOrderMapper.xml
@@ -157,6 +157,10 @@
        <if test="operationMode != null "> and thisTab.operation_mode = #{operationMode}</if>
        <if test="quotePlanId != null "> and thisTab.quote_plan_id = #{quotePlanId}</if>
        <if test="createBy != null  and createBy != ''"> and  thisTab.create_by like concat('%', #{createBy}, '%')</if>
        <if test="updateBy != null  and updateBy != ''"> and  thisTab.update_by like concat('%', #{updateBy}, '%')</if>
        <if test="createTimeBegin != null and createTimeBegin != '' and createTimeEnd != null and createTimeEnd != ''"> and  thisTab.create_time between #{createTimeBegin} and #{createTimeEnd}</if>
        <if test="updateTimeBegin != null and updateTimeBegin != '' and updateTimeEnd != null and updateTimeEnd != ''"> and  thisTab.update_time between #{updateTimeBegin} and #{updateTimeEnd}</if>
        <if test="confirmTimeBegin != null and confirmTimeBegin != '' and confirmTimeEnd != null and confirmTimeEnd != ''"> and  thisTab.confirm_time between #{confirmTimeBegin} and #{confirmTimeEnd}</if>
@@ -617,5 +621,51 @@
        where     tdo.id = #{dispatchId} and  tdd.driver_id = #{driverId};
    </select>
    <select id="selectselectDpData" resultType="com.ruoyi.tms.domain.vo.DpDriverDispatchVo">
        SELECT
    tdo.main_driver_name as driverName,
    tdo.dispatch_no as dispatchNo,
    tdo.license_plate as licensePlate,
      tdo.status,
    src.region_name AS startRegionName,
    erc.region_name AS endRegionName
FROM (
    SELECT id
    FROM tms_dispatch_order
    WHERE `status` IN (2, 3)
    and is_customs=0
    ORDER BY confirm_time DESC
    LIMIT 50
) tmp
JOIN tms_dispatch_order tdo ON tmp.id = tdo.id
LEFT JOIN tms_region src ON SUBSTRING_INDEX(tdo.start_region_code, ',', -1) = src.region_code
LEFT JOIN tms_region erc ON SUBSTRING_INDEX(tdo.end_region_code, ',', -1) = erc.region_code
ORDER BY tdo.confirm_time DESC
    </select>
    <select id="selectDataByNo" resultType="com.ruoyi.tms.domain.vo.DpDriverDispatchItemVo">
        SELECT
    tdo.dispatch_no as dispatchNo,
    tdo.customer_name as customerName,
    tdo.project_name as projectName
,
    tdo.transport_line as transportLine,
    tdo.confirm_time as confirmTime,
    tdo.create_time as createTime,
    tdo.main_driver_name as driverName,
    tdo.license_plate as licensePlate,
    JSON_ARRAYAGG(
        JSON_OBJECT(
            'tripTime', DATE_FORMAT(tr.trip_time, '%Y.%m.%d %H:%i:%s'),
            'status', (SELECT dict_label FROM sys_dict_data WHERE dict_type='trip_type' AND dict_value = tr.trip_type),
            'address', tr.address
        )
    ) AS trips
FROM tms_dispatch_order tdo
LEFT JOIN tms_trip tr ON tr.dispatch_order_id = tdo.id
WHERE tdo.dispatch_no = #{no}
GROUP BY tdo.id;
    </select>
</mapper>