Pu Zhibing
2025-03-28 8b09fbc19a96b57bf1d0e4d7c79b51a76aeca554
ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TOrderLogisticsMapper.xml
@@ -72,11 +72,13 @@
    <!--根据条件查询小件物流订单列表-->
    <select id="getLogisticsOrderList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page">
        SELECT * FROM (SELECT ui.nickName as userName,ui.phone as userPhone,CONCAT(di.firstName, " ", di.lastName,'-',di.phone) as driver,CONCAT(cb.`name`,'-',ci.carLicensePlate) as car,
        ot.* FROM t_order_logistics as ot
        ot.*,ifnull(oc.money, 0) as cancel_money FROM t_order_logistics as ot
        LEFT JOIN t_user as ui on ui.id = ot.userId
        LEFT JOIN t_driver as di on di.id = ot.driverId
        LEFT JOIN t_car as ci on ci.id= ot.carId
        LEFT JOIN t_car_brand as cb on cb.id = ci.carBrandId) as o
        LEFT JOIN t_car_brand as cb on cb.id = ci.carBrandId
        left join t_order_cancel as oc on (ot.id = oc.orderId and oc.orderType = 4 and oc.state = 2)
        ) as o
        <where>
            o.isDelete = 1
            <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
@@ -133,16 +135,35 @@
        when ot.payType = 2 then '银行卡支付'
        when ot.payType = 3 then '余额支付' else '现金支付' end as payTypeStr,
        ui.nickName as userName,ui.phone as userPhone,
        case when income1.type = 1 then income1.money else 0 end as platIncome,
        case when income1.type = 2 then income1.money else 0 end as companyIncome,
        case when income1.type = 3 then income1.money else 0 end as franchiseeIncome,
        IFNULL(sd.price, 0) as settlementPrice,
        IFNULL(income2.money,0) as driverIncome,
        CONCAT(di.firstName, " ", di.lastName,'-',di.phone) as driver,CONCAT(cb.`name`,'-',ci.carLicensePlate) as car,
        '市内小件物流' as typeStr,
        dd.name as companyName,
        ot.* FROM t_order_logistics as ot
        cc.type as companyType,
        cc.name as companyName,
        ot.*,
        oc.money as cancelMoney,
        case when oc.payType = 1 then '手机支付'
             when oc.payType = 2 then '银行卡支付'
             when oc.payType = 3 then '余额支付' else '现金支付' end as cancelPayTypeStr
        FROM t_order_logistics as ot
        LEFT JOIN t_user as ui on ui.id = ot.userId
        LEFT JOIN t_driver as di on di.id = ot.driverId
        LEFT JOIN t_car as ci on ci.id= ot.carId
        LEFT JOIN t_car_brand as cb on cb.id = ci.carBrandId
        LEFT JOIN t_company as cc on cc.id = ot.companyId
        LEFT JOIN t_company as dd on dd.id = ci.companyId
        LEFT JOIN t_order_cancel as oc on ot.id = oc.orderId and oc.orderType = 4
        LEFT JOIN (
            SELECT sum(ii.money) as money,ii.incomeId,cc.type FROM t_income as ii
            LEFT JOIN t_company as cc on ii.objectId = cc.id
            where ii.userType = 1 and ii.type != 1 and ii.orderType = 4 group by ii.incomeId, cc.type
        ) as income1 on income1.incomeId = ot.id
        LEFT JOIN (SELECT incomeId, sum(money) as money FROM t_income where userType = 2 and type != 1 and orderType = 4 group by incomeId) as income2 on income2.incomeId = ot.id
        LEFT JOIN t_settlement_detail sd on ot.id = sd.orderId and sd.orderType = 4
        where ot.id = #{orderId}
    </select>