From 0ecd24b3b8101c4717adc2775bbb498261253948 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期六, 08 二月 2025 17:56:17 +0800
Subject: [PATCH] 开发新增加功能

---
 ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TDriverMapper.xml |   64 ++++++++++++++++++++++++++++++-
 1 files changed, 61 insertions(+), 3 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 5e6f2c4..97e2007 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
@@ -340,8 +340,22 @@
                 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(topc4.taxiMoney, 0) + IFNULL(topc11.taxiMoney, 0) as privateCarTotalMoney,
                 IFNULL(topc5.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) as privateCarTotalMoney,
+                IFNULL(topc10.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) as privateCarTotalMoney,
+                IFNULL(topc5.taxiMoney, 0) + IFNULL(topc10.taxiMoney, 0) as privateCarNotPayMoney,
             </if>
             td.state as driverState,
             td.phone as driverPhone
@@ -349,7 +363,7 @@
         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">
+        <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}
@@ -368,7 +382,7 @@
             </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>
@@ -380,6 +394,50 @@
             </if>
         GROUP BY driverId
         ) AS topc5 ON topc5.driverId = td.id
+        LEFT JOIN ( SELECT SUM(money) AS taxiMoney, objectId as driverId FROM t_income WHERE type = 3 and userType = 2 and orderType = 1
+        <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 objectId
+        ) AS topc11 ON topc11.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,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 topc10 ON topc10.driverId = td.id
+            LEFT JOIN ( SELECT SUM(money) AS taxiMoney, objectId as driverId FROM t_income WHERE type = 3 and userType = 2 and orderType = 4
+            <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 objectId
+            ) AS topc12 ON topc12.driverId = td.id
         </if>
         <where>
             <if test="null!= companyId and '' != companyId">

--
Gitblit v1.7.1