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 |   60 +++++++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 39 insertions(+), 21 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 3d5137c..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
@@ -32,12 +32,12 @@
     <!--根据条件查询专车改派订单列表-->
     <select id="getPrivateCarReassignOrderList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page">
         SELECT * FROM (SELECT rr.id,rr.insertTime,
-        dd1.name as originalDriverName,dd1.phone as originalDriverPhone,
-        CONCAT(dd1.name,'-',dd1.phone) as originalDriver,rr.reason,opc.orderNum,
+        CONCAT(dd1.firstName, " ", dd1.lastName) as originalDriverName,dd1.phone as originalDriverPhone,
+        CONCAT(dd1.firstName, " ", dd1.lastName,'-',dd1.phone) as originalDriver,rr.reason,opc.orderNum,
         CONCAT(uu1.nickName,'-',uu1.phone) as addOrderUser,opc.travelTime,opc.startAddress,opc.endAddress,
         CONCAT(cb1.`name`,'-',cc1.carLicensePlate) as originalCar,rr.money,opc.state as orderState,
-        dd2.name as nowDriverName,dd2.phone as nowDriverPhone,
-        CONCAT(dd2.name,'-',dd2.phone) as nowDriver,CONCAT(cb2.`name`,'-',cc2.carLicensePlate) as nowCar,
+        CONCAT(dd2.firstName, " ", dd2.lastName) as nowDriverName,dd2.phone as nowDriverPhone,
+        CONCAT(dd2.firstName, " ", dd2.lastName,'-',dd2.phone) as nowDriver,CONCAT(cb2.`name`,'-',cc2.carLicensePlate) as nowCar,
         opc.companyId,rr.state,rr.orderType FROM t_reassign as rr
         LEFT JOIN t_driver as dd1 on dd1.id = rr.originalDriverId
         LEFT JOIN t_order_private_car as opc on opc.id = rr.orderId
@@ -87,12 +87,21 @@
     <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.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 dd.name LIKE CONCAT('%',#{name},'%')
+                and CONCAT(dd.firstName, ' ', dd.lastName) LIKE CONCAT('%',#{name},'%')
             </if>
             <if test="phone != null and phone != ''">
                 and dd.phone LIKE CONCAT('%',#{phone},'%')
@@ -106,12 +115,21 @@
     <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.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 dd.name LIKE CONCAT('%',#{name},'%')
+                and CONCAT(dd.firstName, ' ', dd.lastName) LIKE CONCAT('%',#{name},'%')
             </if>
             <if test="phone != null and phone != ''">
                 and dd.phone LIKE CONCAT('%',#{phone},'%')
@@ -125,11 +143,11 @@
     <select id="getCrossReassignOrderList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page">
         SELECT * FROM (SELECT rr.id,rr.insertTime,
         dd1.name as originalDriverName,dd1.phone as originalDriverPhone,
-        CONCAT(dd1.name,'-',dd1.phone) as originalDriver,rr.reason,opc.orderNum,
+        CONCAT(dd1.firstName, ' ', dd1.lastName,'-',dd1.phone) as originalDriver,rr.reason,opc.orderNum,
         CONCAT(uu1.nickName,'-',uu1.phone) as addOrderUser,opc.travelTime,opc.startAddress,opc.endAddress,
         CONCAT(cb1.`name`,'-',cc1.carLicensePlate) as originalCar,rr.money,opc.state as orderState,
         dd2.name as nowDriverName,dd2.phone as nowDriverPhone,
-        CONCAT(dd2.name,'-',dd2.phone) as nowDriver,CONCAT(cb2.`name`,'-',cc2.carLicensePlate) as nowCar,
+        CONCAT(dd2.firstName, ' ', dd2.lastName,'-',dd2.phone) as nowDriver,CONCAT(cb2.`name`,'-',cc2.carLicensePlate) as nowCar,
         opc.companyId,rr.state,rr.orderType FROM t_reassign as rr
         LEFT JOIN t_driver as dd1 on dd1.id = rr.originalDriverId
         LEFT JOIN t_order_cross_city as opc on opc.id = rr.orderId
@@ -180,12 +198,12 @@
     <!--根据条件查询跨城改派订单列表-->
     <select id="getSmallPieceLogisticsList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page">
         SELECT * FROM (SELECT rr.id,rr.insertTime,
-        dd1.name as originalDriverName,dd1.phone as originalDriverPhone,
-        CONCAT(dd1.name,'-',dd1.phone) as originalDriver,rr.reason,opc.orderNum,
+        CONCAT(dd1.firstName, " ", dd1.lastName) as originalDriverName,dd1.phone as originalDriverPhone,
+        CONCAT(dd1.firstName, " ", dd1.lastName,'-',dd1.phone) as originalDriver,rr.reason,opc.orderNum,
         CONCAT(uu1.nickName,'-',uu1.phone) as addOrderUser,opc.travelTime,opc.startAddress,opc.endAddress,
         CONCAT(cb1.`name`,'-',cc1.carLicensePlate) as originalCar,rr.money,opc.state as orderState,
-        dd2.name as nowDriverName,dd2.phone as nowDriverPhone,
-        CONCAT(dd2.name,'-',dd2.phone) as nowDriver,CONCAT(cb2.`name`,'-',cc2.carLicensePlate) as nowCar,
+        CONCAT(dd2.firstName, " ", dd2.lastName) as nowDriverName,dd2.phone as nowDriverPhone,
+        CONCAT(dd2.firstName, " ", dd2.lastName,'-',dd2.phone) as nowDriver,CONCAT(cb2.`name`,'-',cc2.carLicensePlate) as nowCar,
         opc.companyId,rr.state,rr.orderType FROM t_reassign as rr
         LEFT JOIN t_driver as dd1 on dd1.id = rr.originalDriverId
         LEFT JOIN t_order_logistics as opc on opc.id = rr.orderId
@@ -246,14 +264,14 @@
         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})
         and a.id != #{driverId}
         <if test="name != null and name != ''">
-            and a.name LIKE CONCAT('%',#{name},'%')
+            and CONCAT(a.firstName, ' ', a.lastName) LIKE CONCAT('%',#{name},'%')
         </if>
         <if test="phone != null and phone != ''">
             and a.phone LIKE CONCAT('%',#{phone},'%')

--
Gitblit v1.7.1