xuhy
2025-08-01 98a7cb217d580d8c2642570dc8298e9226551928
ManagementOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TOrderTaxiMapper.xml
@@ -66,11 +66,14 @@
    <!--根据条件查询出租车订单列表-->
    <select id="getTaxiOrderList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page">
        SELECT * FROM (SELECT ui.nickName as userName,ui.phone as userPhone,CONCAT(di.`name`,'-',di.phone) as driver,CONCAT(cb.`name`,'-',ci.carLicensePlate) as car,
        ot.* FROM t_order_taxi as ot
        com.name as company,ptd.money as commission, ot.* FROM t_order_taxi 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_company as com on com.id = ci.companyId
        LEFT JOIN t_pub_transaction_details as ptd on ptd.orderId = ot.id and ptd.orderType = 6 and ptd.type = 1 and ptd.userType = 2
        ) as o
        <where>
            o.isDelete = 1 and o.type = 1
            <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
@@ -122,7 +125,7 @@
        when ot.orderSource = 3 then '小程序下单'
        when ot.orderSource = 4 then '司机下单'
        when ot.orderSource = 5 then '调度下单'
        when ot.orderSource = 6 then '道行龙城下单' else '' end orderSourceStr,
        when ot.orderSource = 6 then '电话下单' else '' end orderSourceStr,
        ui.nickName as userName,ui.phone as userPhone,
        case when ot.payType = 1 then '微信'
        when ot.payType = 2 then '支付宝'
@@ -250,15 +253,104 @@
    <!--查询所有总收益-->
    <select id="getAllIncomeMoney" resultType="java.lang.Double">
        SELECT IFNULL(SUM(money),0) as value FROM t_income where userType = 1
        SELECT IFNULL(SUM(money),0) as value FROM t_pub_transaction_details where userType = 2 and orderType = 6
        <if test="companyId != null and companyId != ''">
            and objectId = #{companyId}
            and companyId = #{companyId}
        </if>
        <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
            AND (insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
        </if>
    </select>
    <select id="paymentOrderStatisticsList" resultType="map">
        select
            a.id,
            b.code as paymentCode,
            a.orderNum,
            c.phone as userPhone,
            b.amount,
            d.phone as driverPhone,
            e.name as company,
            f.money as income,
            b.orderType as orderType,
            DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as insertTime,
            DATE_FORMAT(b.insertTime, '%Y-%m-%d %H:%i:%s') as paymentTime
        from t_order_taxi a
        left join t_payment_record b on (a.id = b.orderId and b.orderType = 2 and b.state = 2)
        left join t_user c on (a.userId = c.id)
        left join t_driver d on (a.driverId = d.id)
        left join t_company e on (d.companyId = e.id)
        left join t_pub_transaction_details f on (a.id = f.orderId and f.userType = 2 and f.state = 2)
        where a.state in (8, 9) and a.isDelete = 1 and a.payManner = 1
        <if test="null != paymentCode and '' != paymentCode">
            and b.code like CONCAT('%', #{paymentCode}, '%')
        </if>
        <if test="null != orderCode and '' != orderCode">
            and a.orderNum like CONCAT('%', #{orderCode}, '%')
        </if>
        <if test="null != orderType">
            and b.orderType = #{orderType}
        </if>
        <if test="null != userPhone and '' != userPhone">
            and c.phone like CONCAT('%', #{userPhone}, '%')
        </if>
        <if test="null != driverPhone and '' != driverPhone">
            and d.phone like CONCAT('%', #{driverPhone}, '%')
        </if>
        <if test="null != createTimeStart and '' != createTimeStart and null != createTimeEnd and '' != createTimeEnd">
            and a.insertTime between #{createTimeStart} and #{createTimeEnd}
        </if>
        <if test="null != paymentTimeStart and '' != paymentTimeStart and null != paymentTimeEnd and '' != paymentTimeEnd">
            and b.insertTime between #{paymentTimeStart} and #{paymentTimeEnd}
        </if>
        order by a.insertTime desc
    </select>
    <select id="offlineOrderStatisticsList" resultType="map">
        select
        a.id,
        a.orderNum,
        c.phone as userPhone,
        d.phone as driverPhone,
        e.name as company,
        f.money as income,
        DATE_FORMAT(a.insertTime, '%Y-%m-%d %H:%i:%s') as insertTime,
        a.orderSource,
        a.oldPeople,
        a.payManner
        from t_order_taxi a
        left join t_user c on (a.userId = c.id)
        left join t_driver d on (a.driverId = d.id)
        left join t_company e on (d.companyId = e.id)
        left join t_pub_transaction_details f on (a.id = f.orderId and f.userType = 2 and f.state = 2)
        where a.state in (8, 9) and a.isDelete = 1 and (a.orderSource in (5, 6) or a.oldPeople = 1 or a.payManner = 2)
        <if test="null != orderCode and '' != orderCode">
            and a.orderNum like CONCAT('%', #{orderCode}, '%')
        </if>
        <if test="null != userPhone and '' != userPhone">
            and c.phone like CONCAT('%', #{userPhone}, '%')
        </if>
        <if test="null != driverPhone and '' != driverPhone">
            and d.phone like CONCAT('%', #{driverPhone}, '%')
        </if>
        <if test="null != createTimeStart and '' != createTimeStart and null != createTimeEnd and '' != createTimeEnd">
            and a.insertTime between #{createTimeStart} and #{createTimeEnd}
        </if>
        <if test="null != orderSource and 1 == orderSource">
            and a.orderSource = 6
        </if>
        <if test="null != orderSource and 2 == orderSource">
            and a.oldPeople = 1
        </if>
        <if test="null != orderSource and 3 == orderSource">
            and a.payManner = 2
        </if>
        <if test="null != orderSource and 4 == orderSource">
            and a.orderSource = 5
        </if>
        order by a.insertTime desc
    </select>
</mapper>