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

---
 DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/DriverMapper.xml |   52 +++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 43 insertions(+), 9 deletions(-)

diff --git a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/DriverMapper.xml b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/DriverMapper.xml
index f965994..0643a44 100644
--- a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/DriverMapper.xml
+++ b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/DriverMapper.xml
@@ -115,18 +115,18 @@
     <select id="queryHomeData" resultType="map">
         select
         b.carLicensePlate as licensePlate,
-        CONCAT(d.`name`, c.`name`, ' . ', b.carColor) as brand,
+        CONCAT(d.`name`, ' ', c.`name`, ' . ', b.carColor) as brand,
         (
         (select count(id) from t_order_private_car where driverId = a.id and state in (7, 8, 9) and to_days(insertTime) = to_days(now())) +
         (select count(id) from t_order_taxi where driverId = a.id and state in (7, 8, 9) and to_days(insertTime) = to_days(now())) +
         (select count(id) from t_order_cross_city where driverId = a.id and state in (6, 8, 9) and to_days(insertTime) = to_days(now())) +
-        (select count(id) from t_order_logistics where driverId = a.id and state in (6, 9) and to_days(insertTime) = to_days(now()))
+        (select count(id) from t_order_logistics where driverId = a.id and state in (7, 8, 9) and to_days(insertTime) = to_days(now()))
         ) as dayNum,
         (
         (select count(id) from t_order_private_car where driverId = a.id and state in (7, 8, 9) and DATE_FORMAT(insertTime, '%Y%m') = DATE_FORMAT(now(), '%Y%m')) +
         (select count(id) from t_order_taxi where driverId = a.id and state in (7, 8, 9) and DATE_FORMAT(insertTime, '%Y%m') = DATE_FORMAT(now(), '%Y%m')) +
         (select count(id) from t_order_cross_city where driverId = a.id and state in (6, 8, 9) and DATE_FORMAT(insertTime, '%Y%m') = DATE_FORMAT(now(), '%Y%m')) +
-        (select count(id) from t_order_logistics where driverId = a.id and state in (6, 9) and DATE_FORMAT(insertTime, '%Y%m') = DATE_FORMAT(now(), '%Y%m'))
+        (select count(id) from t_order_logistics where driverId = a.id and state in (7, 8, 9) and DATE_FORMAT(insertTime, '%Y%m') = DATE_FORMAT(now(), '%Y%m'))
         ) as mouthNum,
         ((select sum(fraction) from t_order_evaluate where driverId = a.id) / (select count(fraction) from t_order_evaluate where driverId = a.id)) as score,
         if((select count(id) from t_driver_work where driverId = a.id and state = 1) != 0, 1, 2) as `work`
@@ -177,12 +177,10 @@
         b.carLicensePlate as licensePlate,
         b.carColor as carColor,
         b.vehicleId,
-        CONCAT(d.`name`, c.`name`) as brand,
+        CONCAT(d.`name`, ' ', c.`name`) as brand,
         (
-        (select count(id) from t_order_private_car where driverId = a.id and state in (7, 8, 9)) +
-        (select count(id) from t_order_taxi where driverId = a.id and state in (7, 8, 9)) +
-        (select count(id) from t_order_cross_city where driverId = a.id and state in (6, 8, 9)) +
-        (select count(id) from t_order_logistics where driverId = a.id and state in (6, 9))
+        (select count(id) from t_order_private_car where driverId = a.id and state in (6, 7, 8, 9)) +
+        (select count(id) from t_order_logistics where driverId = a.id and state in (6, 7, 8, 9))
         ) as orderNum,
         ((select sum(fraction) from t_order_evaluate where driverId = a.id) / (select count(fraction) from t_order_evaluate where driverId = a.id)) as score
         from t_driver a
@@ -217,7 +215,7 @@
 
     <select id="queryByCompanyId" resultType="Driver">
         select *
-        from t_driver where flag != 3
+        from t_driver where flag != 3 and authState = 2
         <choose>
             <when test="companyId == 1">
                 and (companyId = 1 or companyId is null or companyId = 0) and (franchiseeId = 0 or franchiseeId is null)
@@ -309,4 +307,40 @@
             date_format(insertTime, '%Y-%m-%d')
         ) = YEARWEEK(now())
     </select>
+    
+    
+    <select id="queryIdleDriver_" resultType="Driver">
+        select * from (
+        select
+        *
+        from t_driver
+        where flag != 3 and state = 2 and authState = 2
+        <if test="null != companyId">
+            <choose>
+                <when test="companyId != 1">
+                    and companyId = #{companyId} or franchiseeId = #{companyId}
+                </when>
+                <otherwise>
+                    and companyId is null or companyId = 0 or companyId = 1 or franchiseeId is null or franchiseeId = 0
+                </otherwise>
+            </choose>
+        
+        </if>
+        and id in
+        (
+        select driverId from t_driver_work where startTime &lt; now() and state = 1 and `type` like CONCAT('%', #{type}, '%')
+        )
+        and id in (select driverId from t_driver_orders where `type` = #{type})
+        and carId in (select carId from t_car_service where `type` = #{type}
+        
+        <if test="null != serverCarModelId">
+            and serverCarModelId = #{serverCarModelId}
+        </if>
+        )
+        ) as aa <!--where aa.id not in (
+        select driverId from t_order_private_car where isDelete = 1 and driverPay = 1 and state in (7, 8, 9)
+        union all
+        select driverId from t_order_logistics where isDelete = 1 and driverPay = 1 and state != 10
+        )-->
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.7.1