From 8b09fbc19a96b57bf1d0e4d7c79b51a76aeca554 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期五, 28 三月 2025 19:57:56 +0800 Subject: [PATCH] 修改bug --- ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TDriverMapper.xml | 96 ++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 89 insertions(+), 7 deletions(-) diff --git a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TDriverMapper.xml b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TDriverMapper.xml index fd22eb4..d2162c5 100644 --- a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TDriverMapper.xml +++ b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TDriverMapper.xml @@ -337,11 +337,25 @@ tc1.name as companyName, tc2.name as franchiseeName, <if test="1 == type"> - topc1.num as privateCarTotalNum, + IFNULL(topc1.num, 0) as privateCarTotalNum, IFNULL(topc2.num, 0) as privateCarNotPayNum, IFNULL(topc3.num, 0) as privateCarcancelNum, - IFNULL(topc4.taxiMoney, 0) as privateCarTotalMoney, - IFNULL(topc5.taxiMoney, 0) as privateCarNotPayMoney, + IFNULL(topc4.taxiMoney, 0) + IFNULL(topc11.taxiMoney, 0) + IFNULL(topc13.taxiMoney, 0) as privateCarTotalMoney, + IFNULL(topc5.taxiMoney, 0) + IFNULL(topc13.taxiMoney, 0) as privateCarNotPayMoney, + </if> + <if test="4 == type"> + IFNULL(topc6.num, 0) as privateCarTotalNum, + IFNULL(topc7.num, 0) as privateCarNotPayNum, + IFNULL(topc8.num, 0) as privateCarcancelNum, + IFNULL(topc9.taxiMoney, 0) + IFNULL(topc12.taxiMoney, 0) + IFNULL(topc14.taxiMoney, 0) as privateCarTotalMoney, + IFNULL(topc10.taxiMoney, 0) + IFNULL(topc14.taxiMoney, 0) as privateCarNotPayMoney, + </if> + <if test="null == type"> + IFNULL(topc1.num, 0) + IFNULL(topc6.num, 0) as privateCarTotalNum, + IFNULL(topc2.num, 0) + IFNULL(topc7.num, 0) as privateCarNotPayNum, + IFNULL(topc3.num, 0) + IFNULL(topc8.num, 0) as privateCarcancelNum, + IFNULL(topc4.taxiMoney, 0) + IFNULL(topc9.taxiMoney, 0) + IFNULL(topc11.taxiMoney, 0) + IFNULL(topc12.taxiMoney, 0) + IFNULL(topc13.taxiMoney, 0) + IFNULL(topc14.taxiMoney, 0) as privateCarTotalMoney, + IFNULL(topc5.taxiMoney, 0) + IFNULL(topc10.taxiMoney, 0) + IFNULL(topc13.taxiMoney, 0) + IFNULL(topc14.taxiMoney, 0) as privateCarNotPayMoney, </if> td.state as driverState, td.phone as driverPhone @@ -349,8 +363,8 @@ t_driver td LEFT JOIN (SELECT id,name FROM t_company WHERE FIND_IN_SET(type, '1,2') AND flag != 3 ) AS tc1 ON td.companyId=tc1.id LEFT JOIN ( SELECT id,name FROM t_company WHERE type = 3 AND flag != 3 ) AS tc2 ON tc2.id = td.franchiseeId - <if test="1 == type"> - INNER JOIN ( SELECT COUNT(id) AS num, driverId FROM t_order_private_car WHERE FIND_IN_SET(state, '7,8,9,10,12') + <if test="null == type or 1 == type"> + LEFT JOIN ( SELECT COUNT(id) AS num, driverId FROM t_order_private_car WHERE FIND_IN_SET(state, '7,8,9,10,12') <if test="null != start and '' != start and null != end and '' != end"> and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end} </if> @@ -368,18 +382,86 @@ </if> GROUP BY driverId ) AS topc3 ON topc3.driverId = td.id - LEFT JOIN ( SELECT SUM(orderMoney) AS taxiMoney, driverId FROM t_order_private_car WHERE FIND_IN_SET(state, '7,8,9,12') + LEFT JOIN ( SELECT SUM(orderMoney) AS taxiMoney, driverId FROM t_order_private_car WHERE FIND_IN_SET(state, '8,9') <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 driverId ) AS topc4 ON topc4.driverId = td.id - LEFT JOIN ( SELECT SUM(orderMoney) AS taxiMoney, driverId FROM t_order_private_car WHERE FIND_IN_SET(state, '7,12') + LEFT JOIN ( SELECT SUM(orderMoney) AS taxiMoney, driverId FROM t_order_private_car WHERE FIND_IN_SET(state, '7') <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 driverId ) AS topc5 ON topc5.driverId = td.id + LEFT JOIN ( + SELECT SUM(a.money) AS taxiMoney, b.driverId FROM t_order_cancel a + left join t_order_private_car b on (a.orderId = b.id and a.orderType = 1) + where FIND_IN_SET(b.state, '10') + <if test="null != start and '' != start and null != end and '' != end"> + and DATE_FORMAT(b.travelTime, '%Y-%m-%d') between #{start} and #{end} + </if> + group by b.driverId + ) AS topc11 ON topc11.driverId = td.id + LEFT JOIN ( + SELECT SUM(a.money) AS taxiMoney, b.driverId FROM t_order_cancel a + left join t_order_private_car b on (a.orderId = b.id and a.orderType = 1) + where FIND_IN_SET(b.state, '12') + <if test="null != start and '' != start and null != end and '' != end"> + and DATE_FORMAT(b.travelTime, '%Y-%m-%d') between #{start} and #{end} + </if> + group by b.driverId + ) AS topc13 ON topc13.driverId = td.id + </if> + <if test="null == type or 4 == type"> + LEFT JOIN ( SELECT COUNT(id) AS num, driverId FROM t_order_logistics WHERE FIND_IN_SET(state, '7,8,9,10,12') + <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 driverId + ) AS topc6 ON topc6.driverId = td.id + LEFT JOIN ( SELECT COUNT(id) AS num, driverId FROM t_order_logistics WHERE FIND_IN_SET(state, '7,12') + <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 driverId + ) AS topc7 ON topc7.driverId = td.id + LEFT JOIN ( SELECT COUNT(id) AS num, driverId FROM t_order_logistics WHERE FIND_IN_SET(state, '10,12') + <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 driverId + ) AS topc8 ON topc8.driverId = td.id + LEFT JOIN ( SELECT SUM(orderMoney) AS taxiMoney, driverId FROM t_order_logistics WHERE FIND_IN_SET(state, '8,9') + <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 driverId + ) AS topc9 ON topc9.driverId = td.id + LEFT JOIN ( SELECT SUM(orderMoney) AS taxiMoney, driverId FROM t_order_logistics WHERE FIND_IN_SET(state, '7') + <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 driverId + ) AS topc10 ON topc10.driverId = td.id + LEFT JOIN ( + SELECT SUM(a.money) AS taxiMoney, b.driverId FROM t_order_cancel a + left join t_order_logistics b on (a.orderId = b.id and a.orderType = 4) + where FIND_IN_SET(b.state, '10') + <if test="null != start and '' != start and null != end and '' != end"> + and DATE_FORMAT(b.travelTime, '%Y-%m-%d') between #{start} and #{end} + </if> + group by b.driverId + ) AS topc12 ON topc12.driverId = td.id + LEFT JOIN ( + SELECT SUM(a.money) AS taxiMoney, b.driverId FROM t_order_cancel a + left join t_order_logistics b on (a.orderId = b.id and a.orderType = 4) + where FIND_IN_SET(b.state, '12') + <if test="null != start and '' != start and null != end and '' != end"> + and DATE_FORMAT(b.travelTime, '%Y-%m-%d') between #{start} and #{end} + </if> + group by b.driverId + ) AS topc14 ON topc14.driverId = td.id </if> <where> <if test="null!= companyId and '' != companyId"> -- Gitblit v1.7.1