From bfa0b11dfbfe5b71e11f4544e688e4d9f325d1b5 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期一, 09 六月 2025 10:26:51 +0800
Subject: [PATCH] 修改bug和管理后台报表

---
 ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TReassignMapper.xml |   36 ++++++++++++++++++++++++++----------
 1 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TReassignMapper.xml b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TReassignMapper.xml
index 6872f9d..8ce8edb 100644
--- a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TReassignMapper.xml
+++ b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TReassignMapper.xml
@@ -87,11 +87,19 @@
     <select id="getCanSelectPrivateCarDriverList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page">
         SELECT dd.*,c1.name as companyName,c2.name as franchiseeName from t_driver AS dd
         LEFT JOIN t_company as c1 on c1.id = dd.companyId
-        LEFT JOIN t_company as c2 on c2.id = dd.franchiseeId
-        LEFT JOIN (SELECT * from t_driver_service where type = 1) as ds on ds.driverId = dd.id
+        LEFT JOIN t_company as c2 on c2.id = dd.companyId
         <where>
-            dd.id != driverId and
-            (dd.companyId = #{companyId} or dd.franchiseeId = #{companyId}) and dd.authState = 2 and dd.state = 2 and (ds.id is not null ) and (dd.carId is not null)
+            dd.id != #{driverId} and dd.authState = 2 and dd.state = 2
+            and dd.id in
+            (
+            select driverId from t_driver_work where startTime &lt; now() and state = 1 and `type` like CONCAT('%', #{type}, '%')
+            )
+            and dd.id in (select driverId from t_driver_orders where `type` = #{type})
+            and dd.carId in (select carId from t_car_service where `type` = #{type}
+            <if test="null != serverCarModelId">
+                and serverCarModelId = #{serverCarModelId}
+            </if>
+            )
             <if test="name != null and name != ''">
                 and CONCAT(dd.firstName, ' ', dd.lastName) LIKE CONCAT('%',#{name},'%')
             </if>
@@ -107,11 +115,19 @@
     <select id="getCanSelectSmallDriverList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page">
         SELECT dd.*,c1.name as companyName,c2.name as franchiseeName from t_driver AS dd
         LEFT JOIN t_company as c1 on c1.id = dd.companyId
-        LEFT JOIN t_company as c2 on c2.id = dd.franchiseeId
-        LEFT JOIN (SELECT * from t_driver_service where type = #{type}) as ds on ds.driverId = dd.id
+        LEFT JOIN t_company as c2 on c2.id = dd.companyId
         <where>
-            dd.id != driverId and
-            (dd.companyId = #{companyId} or dd.franchiseeId = #{companyId}) and dd.authState = 2 and dd.state = 2 and (ds.id is not null ) and (dd.carId is not null)
+            dd.id != #{driverId} and dd.authState = 2 and dd.state = 2
+            and dd.id in
+            (
+            select driverId from t_driver_work where startTime &lt; now() and state = 1 and `type` like CONCAT('%', #{type}, '%')
+            )
+            and dd.id in (select driverId from t_driver_orders where `type` = #{type})
+            and dd.carId in (select carId from t_car_service where `type` = #{type}
+            <if test="null != serverCarModelId">
+                and serverCarModelId = #{serverCarModelId}
+            </if>
+            )
             <if test="name != null and name != ''">
                 and CONCAT(dd.firstName, ' ', dd.lastName) LIKE CONCAT('%',#{name},'%')
             </if>
@@ -248,8 +264,8 @@
         left join t_driver_line f on (a.id = f.driverId)
         left join t_line_shift g on (f.lineId = g.lineId)
         left join t_company as h on (h.id = a.companyId)
-        left join t_company as i on (i.id = a.franchiseeId)
-        where a.authState = 2 and a.state != 1 and a.flag != 3 and if(a.franchiseeId is null or a.franchiseeId = 0, a.companyId = #{companyId}, a.franchiseeId = #{companyId})
+        left join t_company as i on (i.id = a.companyId)
+        where a.authState = 2 and a.state != 1 and a.flag != 3 and a.companyId = #{companyId}
         and a.id in (select driverId from t_driver_work where state = 1 and type like '%3%')
         and b.type = 3 and c.type = 3 and e.type = 3 and e.serverCarModelId = #{serverCarModelId} and f.lineId = #{lineId} and g.id = #{lineShiftId}
         and a.id in (select driverId from t_line_shift_driver where lineShiftId = #{lineShiftId} and DATE_FORMAT(`day`, '%Y-%m-%d') = DATE_FORMAT(#{time}, '%Y-%m-%d') and laveSeat >= #{num})

--
Gitblit v1.7.1