From d959a545c69237d376f3bdef7f11d10013353c7a Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期三, 19 三月 2025 15:55:05 +0800
Subject: [PATCH] bug修改 订单数据查询优化 数据上传行政区划代码更换为订单所属行政区划代码

---
 ManagementZYTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TOrderPrivateCarMapper.xml |  122 ++++++++++++++++++++++++++++++++--------
 1 files changed, 98 insertions(+), 24 deletions(-)

diff --git a/ManagementZYTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TOrderPrivateCarMapper.xml b/ManagementZYTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TOrderPrivateCarMapper.xml
index a3a9f4d..ce393f7 100644
--- a/ManagementZYTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TOrderPrivateCarMapper.xml
+++ b/ManagementZYTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TOrderPrivateCarMapper.xml
@@ -77,58 +77,132 @@
 
     <!--根据条件查询专车订单列表-->
     <select id="getPrivateCarOrderList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page">
-        SELECT * FROM (SELECT ui.nickName as userName,ui.phone as userPhone,CONCAT(di.`name`,'-',di.phone) as driver,CONCAT(cb.`name`,'-',ci.carLicensePlate) as car,
-        sc.`name` as serverCarModel,ot.* FROM t_order_private_car as ot
-        LEFT JOIN t_user as ui on ui.id = ot.userId
-        LEFT JOIN t_driver as di on di.id = ot.driverId
-        LEFT JOIN t_car as ci on ci.id= ot.carId
-        LEFT JOIN t_car_brand as cb on cb.id = ci.carBrandId
-        LEFT JOIN t_server_carmodel as sc on sc.id = ot.serverCarModelId
-        ) as o
+        SELECT
+        ui.nickName as userName,
+        ui.phone as userPhone,
+        CONCAT(di.`name`, '-', di.phone) as driver,
+        CONCAT(cb.`name`, '-', ci.carLicensePlate) as car,
+        sc.`name` as serverCarModel,
+        ot.id,
+        ot.type,
+        ot.userId,
+        ot.driverId,
+        ot.carId,
+        ot.orderNum,
+        ot.placementLon,
+        ot.placementLat,
+        ot.placementAddress,
+        ot.startLon,
+        ot.startLat,
+        ot.endLon,
+        ot.startAddress,
+        ot.endLat,
+        ot.endAddress,
+        ot.boardingLon,
+        ot.boardingLat,
+        ot.boardingAddress,
+        ot.boardingTime,
+        ot.getoffLon,
+        ot.getoffLat,
+        ot.getoffAddress,
+        ot.getoffTime,
+        ot.mileage,
+        ot.payManner,
+        ot.payType,
+        ot.orderMoney,
+        ot.startMoney,
+        ot.mileageMoney,
+        ot.durationMoney,
+        ot.longDistanceMoney,
+        ot.parkMoney,
+        ot.roadTollMoney,
+        ot.redPacketMoney,
+        ot.couponMoney,
+        ot.redPacketId,
+        ot.couponId,
+        ot.discount,
+        ot.discountMoney,
+        ot.activityId,
+        ot.companyId,
+        ot.payMoney,
+        ot.substitute,
+        ot.passengers,
+        ot.passengersPhone,
+        ot.state,
+        ot.insertTime,
+        ot.travelTime,
+        ot.snatchOrderTime,
+        ot.setOutTime,
+        ot.arriveTime,
+        ot.startServiceTime,
+        ot.endServiceTime,
+        ot.orderType,
+        ot.orderSource,
+        ot.invoiceId,
+        ot.isReassign,
+        ot.reassignNotice,
+        ot.trackId,
+        ot.isDelete,
+        ot.oldState,
+        ot.telX,
+        ot.bindId,
+        ot.serverCarModelId
+        FROM
+        t_order_private_car as ot
+        LEFT JOIN
+        t_user as ui ON ui.id = ot.userId
+        LEFT JOIN
+        t_driver as di ON di.id = ot.driverId
+        LEFT JOIN
+        t_car as ci ON ci.id = ot.carId
+        LEFT JOIN
+        t_car_brand as cb ON cb.id = ci.carBrandId
+        LEFT JOIN
+        t_server_carmodel as sc ON sc.id = ot.serverCarModelId
         <where>
-            o.isDelete = 1 and o.type = 1
+            ot.isDelete = 1
+            AND ot.type = 1
             <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
-                AND (o.insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
+                AND (ot.insertTime BETWEEN CONCAT(#{beginTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59'))
             </if>
             <if test="orderNum != null and orderNum != ''">
-                and o.orderNum  LIKE CONCAT('%',#{orderNum},'%')
+                AND ot.orderNum LIKE CONCAT('%', #{orderNum}, '%')
             </if>
             <if test="orderSource != null and orderSource != ''">
-                and o.orderSource = #{orderSource}
+                AND ot.orderSource = #{orderSource}
             </if>
             <if test="userName != null and userName != ''">
-                and o.userName  LIKE CONCAT('%',#{userName},'%')
+                AND ui.nickName LIKE CONCAT('%', #{userName}, '%')
             </if>
             <if test="userPhone != null and userPhone != ''">
-                and o.userPhone  LIKE CONCAT('%',#{userPhone},'%')
+                AND ui.phone LIKE CONCAT('%', #{userPhone}, '%')
             </if>
             <if test="passengers != null and passengers != ''">
-                and o.passengers  LIKE CONCAT('%',#{passengers},'%')
+                AND ot.passengers LIKE CONCAT('%', #{passengers}, '%')
             </if>
             <if test="passengersPhone != null and passengersPhone != ''">
-                and o.passengersPhone  LIKE CONCAT('%',#{passengersPhone},'%')
+                AND ot.passengersPhone LIKE CONCAT('%', #{passengersPhone}, '%')
             </if>
             <if test="serverCarModelId != null and serverCarModelId != ''">
-                and o.serverCarModelId  = #{serverCarModelId}
+                AND ot.serverCarModelId = #{serverCarModelId}
             </if>
             <if test="driver != null and driver != ''">
-                and o.driver  LIKE CONCAT('%',#{driver},'%')
+                AND (di.`name` LIKE CONCAT('%', #{driver}, '%') OR di.phone LIKE CONCAT('%', #{driver}, '%'))
             </if>
             <if test="state != null and state != ''">
-                and o.state = #{state}
+                AND ot.state = #{state}
             </if>
-
             <if test="smsNumber != null and smsNumber != ''">
-                and o.smsNumber = #{smsNumber}
+                AND ot.smsNumber = #{smsNumber}
             </if>
             <if test="roleType != null and roleType != '' and roleType == 2">
-                and (o.companyId = #{nowUserId} or FIND_IN_SET(o.companyId,(SELECT GROUP_CONCAT(id) as ids FROM t_company where superiorId = #{nowUserId} GROUP BY superiorId)))
+                AND (ot.companyId = #{nowUserId} OR FIND_IN_SET(ot.companyId, (SELECT GROUP_CONCAT(id) as ids FROM t_company WHERE superiorId = #{nowUserId} GROUP BY superiorId)))
             </if>
             <if test="roleType != null and roleType != '' and roleType == 3">
-                and o.companyId = #{nowUserId}
+                AND ot.companyId = #{nowUserId}
             </if>
         </where>
-        order by o.id desc
+        order by ot.id desc
     </select>
 
     <!--根据专车订单ID获取专车订单详情-->

--
Gitblit v1.7.1