Pu Zhibing
2024-12-13 73b750200f25df08aa64124da49e7461f9de6653
DriverNTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TOrderTransferMapper.xml
@@ -167,7 +167,7 @@
        <if test="state == 1">
            select
            id as id,
            (1) as type,
            (7) as type,
            ('接送机订单') as `name`,
            DATE_FORMAT(travelTime, '%Y-%m-%d %H:%i:%s') as time,
            startAddress as startAddress,
@@ -185,7 +185,7 @@
            select
            id as id,
            (1) as type,
            (7) as type,
            ('接送机订单') as `name`,
            DATE_FORMAT(travelTime, '%Y-%m-%d %H:%i:%s') as time,
            startAddress as startAddress,
@@ -202,7 +202,7 @@
        <if test="state == 2">
            select
            id as id,
            (1) as type,
            (7) as type,
            ('接送机订单') as `name`,
            DATE_FORMAT(travelTime, '%Y-%m-%d %H:%i:%s') as time,
            startAddress as startAddress,
@@ -217,5 +217,94 @@
            and state = 2 and (UNIX_TIMESTAMP(travelTime) - UNIX_TIMESTAMP(now())) &gt;= 1800
        </if>
    </select>
    <select id="queryPushOrder" resultType="map">
        select
            id as orderId,
            state as orderState,
            ('接送机订单') as orderName,
            DATE_FORMAT(travelTime, '%m月%d日 %H:%i') as travelTime,
            startAddress as startAddress,
            endAddress as endAddress,
            startLon as startLon,
            startLat as startLat,
            endLon as endLon,
            endLat as endLat,
            isReassign as isReassign,
            orderType as reservation,
            orderSource as orderSource,
            orderType as orderType,
            isReassign as isReassign,
            companyId as companyId
        from t_order_transfer where id = #{orderId}
    </select>
    <select id="queryMyAllOrder" resultType="map">
        select
        id as id,
        (7) as type,
        ('接送机订单') as `name`,
        DATE_FORMAT(travelTime, '%Y-%m-%d %H:%i:%s') as time,
        startAddress as startAddress,
        endAddress as endAddress,
        state as state,
        orderType as reservation,
        orderMoney as orderMoney,
        payManner as payManner,
        UNIX_TIMESTAMP(travelTime) as travelTime,
        remark as remark
        from t_order_transfer where driverId = #{driverId}
        <if test="state == 1">
            and state != 1
        </if>
        <if test="state == 2">
            and state = 7
        </if>
        <if test="state == 3">
            and state = 10
        </if>
        <if test="state == 4">
            and state in (6, 7, 8, 9)
        </if>
        order by insertTime desc
    </select>
    <select id="queryOrderInfo" resultType="map">
        select
            a.id as orderId,
            a.userId as userId,
            a.driverId as driverId,
            a.state as orderState,
            DATE_FORMAT(a.travelTime, '%m月%d日 %H:%i') as travelTime_,
            DATE_FORMAT(a.travelTime, '%Y-%m-%d %H:%i:%s') as travelTime,
            DATE_FORMAT(a.arriveTime, '%Y-%m-%d %H:%i:%s') as arriveTime,
            a.startAddress as startAddress,
            a.endAddress as endAddress,
            a.startLon as startLon,
            a.startLat as startLat,
            a.endLon as endLon,
            a.endLat as endLat,
            a.orderMoney as orderMoney,
            a.payManner as payManner,
            a.trackId as trackId,
            b.nickName as nickName,
            a.passengersPhone as phone,
            a.orderType as reservation,
            a.telX as telX,
            a.bindId as bindId,
            (
                (select count(id) from t_order_private_car where userId = b.id and state in (8, 9)) +
                (select count(id) from t_order_taxi where userId = b.id and state in (8, 9)) +
                (select count(id) from t_order_cross_city where userId = b.id and state in (8, 9))
                ) as historyNum,
            (select phone from t_phone where companyId = a.companyId and `type` = 1) as emergencyCall,
            c.reason as cancelReason,
            c.remark as cancelRemark,
            c.money as cancelPayMoney,
            if(c.userType = 1, '用户取消', '平台取消') as cancelUser,
            (select isSpecialCar from t_sys_reformist where companyId = a.companyId) as reassign
        from t_order_transfer a
                 left join t_user b on (a.userId = b.id)
                 left join t_order_cancel c on (a.id = c.orderId and c.orderType = 1 and c.state = 2)
        where a.id = #{orderId}
    </select>
</mapper>