Pu Zhibing
2025-03-28 8b09fbc19a96b57bf1d0e4d7c79b51a76aeca554
ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TCompanyMapper.xml
@@ -64,7 +64,7 @@
    <!--根据条件查询分公司列表-->
    <select id="getCompanyList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page">
        SELECT * FROM (SELECT ui.account,IFNULL(ci.num,0) as franchiseeNum,IFNULL(ca.num,0) as carNumber,IFNULL(di.num,0) as driverNumber,
        CONCAT(case when cc.isSpe = 1 then '专车,' else '' end,
        case when cc.isSpe = 1 then '专车,' else '' end,
        case when cc.isSameLogistics = 1 then '市内小件物流,' else '' end,
        cc.* FROM t_company as cc
        LEFT JOIN (SELECT * FROM sys_user where roleType = 2) as ui on ui.objectId = cc.id
@@ -115,7 +115,7 @@
    <!--根据条件查询加盟商列表-->
    <select id="getFranchiseeList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page">
        SELECT * FROM (SELECT ui.account,ci.`name` as companyName,IFNULL(ca.num,0) as carNumber,IFNULL(di.num,0) as driverNumber,
        CONCAT(case when cc.isSpe = 1 then '专车,' else '' end,
        case when cc.isSpe = 1 then '专车,' else '' end,
        case when cc.isSameLogistics = 1 then '市内小件物流,' else '' end,
        cc.* FROM t_company as cc
        LEFT JOIN (SELECT * FROM sys_user where roleType = 3) as ui on ui.objectId = cc.id
@@ -157,7 +157,6 @@
    <select id="queryOperationalData" resultType="map">
        select
        *,
        ROUND(if(orderNum != 0, cancelNum / orderNum, 0) * 100, 2) as cancelProportion,
@@ -172,7 +171,7 @@
            sum(aa.cancelNum) as cancelNum,
            sum(aa.onlinePay) as onlinePay,
            sum(aa.offlinePay) as offlinePay,
            sum(aa.money) as money,
            ROUND(sum(aa.money), 2) as money,
            sum(aa.complaint) as complaint
            from (
            select DATE_FORMAT(insertTime, '%Y-%m-%d') as time, count(id) as register, 0 as `online`, 0 as orderNum, 0 as cancelNum, 0 as onlinePay, 0 as offlinePay, 0 as money, 0 as complaint
@@ -186,19 +185,19 @@
            </if>
            group by DATE_FORMAT(insertTime, '%Y-%m-%d')
            union all
            select DATE_FORMAT(a.date, '%Y-%m-%d') as time, 0, count(a.id) as `online`, 0 as orderNum, 0 as cancelNum, 0 as onlinePay, 0 as offlinePay, 0 as money, 0 as complaint
            from t_driver_online a
            select DATE_FORMAT(a.startTime, '%Y-%m-%d') as time, 0, count(a.driverId) as `online`, 0 as orderNum, 0 as cancelNum, 0 as onlinePay, 0 as offlinePay, 0 as money, 0 as complaint
            from (select driverId, DATE_FORMAT(startTime, '%Y-%m-%d') as startTime from t_driver_work group by driverId, DATE_FORMAT(startTime, '%Y-%m-%d')) a
            left join t_driver b on (a.driverId = b.id)
            where assessment = 0
            <if test="null != companyId">
                and if(b.franchiseeId is null or b.franchiseeId = 0, b.companyId = #{companyId}, b.franchiseeId = #{companyId})
            </if>
            <if test="null != start and '' != start and null != end and '' != end">
                and DATE_FORMAT(a.date, '%Y-%m-%d') between #{start} and #{end}
                and DATE_FORMAT(a.startTime, '%Y-%m-%d') between #{start} and #{end}
            </if>
            group by DATE_FORMAT(a.date, '%Y-%m-%d')
            group by DATE_FORMAT(a.startTime, '%Y-%m-%d')
            union all
            <if test="1 == type">
            <if test="null == type or 1 == type">
                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, count(id), 0, 0, 0, 0, 0 from t_order_private_car where isDelete = 1
                <if test="null != companyId">
                    and companyId = #{companyId}
@@ -209,7 +208,7 @@
                group by DATE_FORMAT(travelTime, '%Y-%m-%d')
                union all
            </if>
            <if test="2 == type">
            <if test="null == type or 2 == type">
                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, count(id), 0, 0, 0, 0, 0 from t_order_taxi where isDelete = 1
                <if test="null != companyId">
                    and companyId = #{companyId}
@@ -220,7 +219,7 @@
                group by DATE_FORMAT(travelTime, '%Y-%m-%d')
                union all
            </if>
            <if test="3 == type">
            <if test="null == type or 3 == type">
                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, count(id), 0, 0, 0, 0, 0 from t_order_cross_city where isDelete = 1
                <if test="null != companyId">
                    and companyId = #{companyId}
@@ -231,7 +230,7 @@
                group by DATE_FORMAT(travelTime, '%Y-%m-%d')
                union all
            </if>
            <if test="4 == type">
            <if test="null == type or 4 == type">
                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, count(id), 0, 0, 0, 0, 0 from t_order_logistics where isDelete = 1
                <if test="null != companyId">
                    and companyId = #{companyId}
@@ -242,7 +241,7 @@
                group by DATE_FORMAT(travelTime, '%Y-%m-%d')
                union all
            </if>
            <if test="type == 1">
            <if test="null == type or type == 1">
                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, count(id), 0, 0, 0, 0 from t_order_private_car where isDelete = 1 and state in (10, 12)
                <if test="null != companyId">
                    and companyId = #{companyId}
@@ -253,7 +252,7 @@
                group by DATE_FORMAT(travelTime, '%Y-%m-%d')
                union all
            </if>
            <if test="type == 2">
            <if test="null == type or type == 2">
                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, count(id), 0, 0, 0, 0 from t_order_taxi where isDelete = 1 and state in (10, 12)
                <if test="null != companyId">
                    and companyId = #{companyId}
@@ -264,7 +263,7 @@
                group by DATE_FORMAT(travelTime, '%Y-%m-%d')
                union all
            </if>
            <if test="type == 3">
            <if test="null == type or type == 3">
                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, count(id), 0, 0, 0, 0 from t_order_cross_city where isDelete = 1 and state in (10, 12)
                <if test="null != companyId">
                    and companyId = #{companyId}
@@ -275,7 +274,7 @@
                group by DATE_FORMAT(travelTime, '%Y-%m-%d')
                union all
            </if>
            <if test="type == 4">
            <if test="null == type or type == 4">
                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, count(id), 0, 0, 0, 0 from t_order_logistics where isDelete = 1 and state in (10, 12)
                <if test="null != companyId">
                    and companyId = #{companyId}
@@ -286,8 +285,30 @@
                group by DATE_FORMAT(travelTime, '%Y-%m-%d')
                union all
            </if>
            <if test="type == 1">
                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, count(id), 0, sum(payMoney), 0 from t_order_private_car where isDelete = 1 and payManner = 1
            <if test="null == type or type == 1">
                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, count(id), 0, sum(payMoney), 0 from t_order_private_car where isDelete = 1 and payType in (1, 2, 3)
                <if test="null != companyId">
                    and companyId = #{companyId}
                </if>
                <if test="null != start and '' != start and null != end and '' != end">
                    and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
                </if>
                group by DATE_FORMAT(travelTime, '%Y-%m-%d')
                union all
                select DATE_FORMAT(insertTime, '%Y-%m-%d'), 0, 0, 0, 0, count(id), 0, sum(money), 0 from t_income where orderType = 1 and userType = 1 and type = 3
                <if test="null != companyId">
                    and incomeId = #{companyId}
                </if>
                <if test="null != start and '' != start and null != end and '' != end">
                    and DATE_FORMAT(insertTime, '%Y-%m-%d') between #{start} and #{end}
                </if>
                group by DATE_FORMAT(insertTime, '%Y-%m-%d')
                union all
            </if>
            <if test="null == type or type == 2">
                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, count(id), 0, sum(payMoney), 0 from t_order_taxi where isDelete = 1 and payType in (1, 2, 3)
                <if test="null != companyId">
                    and companyId = #{companyId}
                </if>
@@ -297,8 +318,8 @@
                group by DATE_FORMAT(travelTime, '%Y-%m-%d')
                union all
            </if>
            <if test="type == 2">
                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, count(id), 0, sum(payMoney), 0 from t_order_taxi where isDelete = 1 and payManner = 1
            <if test="null == type or type == 3">
                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, count(id), 0, sum(payMoney), 0 from t_order_cross_city where isDelete = 1 and payType in (1, 2, 3)
                <if test="null != companyId">
                    and companyId = #{companyId}
                </if>
@@ -308,8 +329,28 @@
                group by DATE_FORMAT(travelTime, '%Y-%m-%d')
                union all
            </if>
            <if test="type == 3">
                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, count(id), 0, sum(payMoney), 0 from t_order_cross_city where isDelete = 1 and payManner = 1
            <if test="null == type or type == 4">
                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, count(id), 0, sum(payMoney), 0 from t_order_logistics where isDelete = 1 and payType in (1, 2, 3)
                <if test="null != companyId">
                    and companyId = #{companyId}
                </if>
                <if test="null != start and '' != start and null != end and '' != end">
                    and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
                </if>
                group by DATE_FORMAT(travelTime, '%Y-%m-%d')
                union all
                select DATE_FORMAT(insertTime, '%Y-%m-%d'), 0, 0, 0, 0, count(id), 0, sum(money), 0 from t_income where orderType = 4 and userType = 1 and type = 3
                <if test="null != companyId">
                    and objectId = #{companyId}
                </if>
                <if test="null != start and '' != start and null != end and '' != end">
                    and DATE_FORMAT(insertTime, '%Y-%m-%d') between #{start} and #{end}
                </if>
                group by DATE_FORMAT(insertTime, '%Y-%m-%d')
                union all
            </if>
            <if test="null == type or type == 1">
                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, 0, count(id), sum(payMoney), 0 from t_order_private_car where isDelete = 1 and payType in (4)
                <if test="null != companyId">
                    and companyId = #{companyId}
                </if>
@@ -319,8 +360,8 @@
                group by DATE_FORMAT(travelTime, '%Y-%m-%d')
                union all
            </if>
            <if test="type == 4">
                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, count(id), 0, sum(payMoney), 0 from t_order_logistics where isDelete = 1 and payManner = 1
            <if test="null == type or type == 2">
                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, 0, count(id), sum(payMoney), 0 from t_order_taxi where isDelete = 1 and payType in (4)
                <if test="null != companyId">
                    and companyId = #{companyId}
                </if>
@@ -330,8 +371,8 @@
                group by DATE_FORMAT(travelTime, '%Y-%m-%d')
                union all
            </if>
            <if test="type == 1">
                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, 0, count(id), 0, 0 from t_order_private_car where isDelete = 1 and payManner = 2
            <if test="null == type or type == 3">
                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, 0, count(id), sum(payMoney), 0 from t_order_cross_city where isDelete = 1 and payType in (4)
                <if test="null != companyId">
                    and companyId = #{companyId}
                </if>
@@ -341,30 +382,8 @@
                group by DATE_FORMAT(travelTime, '%Y-%m-%d')
                union all
            </if>
            <if test="type == 2">
                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, 0, count(id), 0, 0 from t_order_taxi where isDelete = 1 and payManner = 2
                <if test="null != companyId">
                    and companyId = #{companyId}
                </if>
                <if test="null != start and '' != start and null != end and '' != end">
                    and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
                </if>
                group by DATE_FORMAT(travelTime, '%Y-%m-%d')
                union all
            </if>
            <if test="type == 3">
                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, 0, count(id), 0, 0 from t_order_cross_city where isDelete = 1 and payManner = 2
                <if test="null != companyId">
                    and companyId = #{companyId}
                </if>
                <if test="null != start and '' != start and null != end and '' != end">
                    and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
                </if>
                group by DATE_FORMAT(travelTime, '%Y-%m-%d')
                union all
            </if>
            <if test="type == 4">
                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, 0, count(id), 0, 0 from t_order_logistics where isDelete = 1 and payManner = 2
            <if test="null == type or type == 4">
                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, 0, count(id), sum(payMoney), 0 from t_order_logistics where isDelete = 1 and payType in (4)
                <if test="null != companyId">
                    and companyId = #{companyId}
                </if>