From aea5a0cc3bbd5c2d131a504e5aa2a124d9f131b3 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期一, 10 四月 2023 11:46:54 +0800
Subject: [PATCH] 优化功能
---
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/OrderMapper.xml | 130 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 129 insertions(+), 1 deletions(-)
diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/OrderMapper.xml b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/OrderMapper.xml
index e4c19a6..1f80e47 100644
--- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/OrderMapper.xml
+++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/OrderMapper.xml
@@ -13,6 +13,9 @@
<result column="source" property="source" />
<result column="agentId" property="agentId" />
<result column="branchOfficeId" property="branchOfficeId" />
+ <result column="orderTakingTime" property="orderTakingTime"/>
+ <result column="goToAppointmentPointTime" property="goToAppointmentPointTime"/>
+ <result column="arrivalTimeAtTheAppointmentPoint" property="arrivalTimeAtTheAppointmentPoint"/>
<result column="startTime" property="startTime" />
<result column="startAddress" property="startAddress" />
<result column="startLat" property="startLat" />
@@ -38,6 +41,7 @@
<result column="badWeatherPrice" property="badWeatherPrice" />
<result column="overBadWeatherDistance" property="overBadWeatherDistance" />
<result column="overBadWeatherPrice" property="overBadWeatherPrice" />
+ <result column="weather" property="weather"/>
<result column="estimatedPrice" property="estimatedPrice" />
<result column="estimatedMileage" property="estimatedMileage"/>
<result column="orderMoney" property="orderMoney" />
@@ -45,9 +49,12 @@
<result column="payMoney" property="payMoney" />
<result column="discountedPrice" property="discountedPrice" />
<result column="couponId" property="couponId" />
+ <result column="discountAmount" property="discountAmount"/>
+ <result column="discount" property="discount"/>
<result column="payType" property="payType" />
<result column="payTime" property="payTime" />
<result column="hallOrder" property="hallOrder"/>
+ <result column="startWaitTime" property="startWaitTime"/>
<result column="state" property="state" />
<result column="oldState" property="oldState"/>
<result column="status" property="status" />
@@ -77,6 +84,127 @@
a.startPrice
from t_order a
left join t_app_user b on (a.userId = b.id)
- where a.`status` = 1 and a.hallOrder = 1 order by a.createTime desc
+ where a.`status` = 1 and a.hallOrder = 1 and a.state = 101 order by a.createTime desc
+ </select>
+
+
+
+ <select id="queryOrderInfo" resultType="com.supersavedriving.driver.modular.system.warpper.OrderInfoWarpper">
+ select
+ a.id,
+ b.avatar,
+ a.userName,
+ a.userPhone,
+ (select count(1) from t_order where userPhone = a.userPhone and state in (107, 108)) as orderTimes,
+ (select count(1) from t_order where userPhone = a.userPhone and state in (301)) as cancelTimes,
+ a.source,
+ UNIX_TIMESTAMP(a.createTime) * 1000 as createTime,
+ a.startAddress,
+ a.startLat,
+ a.startLng,
+ a.endAddress,
+ a.endLat,
+ a.endLng,
+ a.estimatedPrice,
+ a.estimatedMileage,
+ a.startPrice,
+ a.waitTime,
+ a.actualMileage,
+ a.state,
+ (UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(a.startTime)) / 60 as travelTime
+ from t_order a
+ left join t_app_user b on (a.userId = b.id)
+ where a.id = #{orderId}
+ </select>
+
+
+ <select id="queryDriverOrderList" resultType="com.supersavedriving.driver.modular.system.warpper.DriverOrderListWarpper">
+ select
+ id,
+ '超省新代驾订单' as title,
+ UNIX_TIMESTAMP(createTime) * 1000 as createTime,
+ startAddress,
+ endAddress,
+ state,
+ source
+ from t_order where status = 1 and driverId = #{driverId}
+ <if test="null != state and 107 == state">
+ and state = #{state}
+ </if>
+ <if test="null != state and 109 == state">
+ and state in (108, 109)
+ </if>
+ <if test="null != state and 301 == state">
+ and state = #{state}
+ </if>
+ order by createTime desc limit #{pageNum}, #{pageSize}
+ </select>
+
+
+ <select id="queryInviteList" resultType="com.supersavedriving.driver.modular.system.warpper.InviteListWarpper">
+ select * from (
+ select
+ a.id,
+ a.nickname,
+ min(UNIX_TIMESTAMP(b.createTime) * 1000) as time,
+ 1 as type
+ from t_app_user a
+ left join t_order b on (a.id = b.userId)
+ where a.`status` = 1 and a.inviterType = 2 and a.inviterId = #{driverId}
+ <if test="null != time and '' != time">
+ and DATE_FORMAT(b.createTime, '%Y年%m月') = #{time}
+ </if>
+ group by a.id, a.nickname
+
+ union all
+
+ select
+ a.id,
+ a.`name`,
+ min(UNIX_TIMESTAMP(b.createTime) * 1000) as time,
+ 2 as type
+ from t_driver a
+ left join t_order b on (a.id = b.driverId)
+ where a.`status` = 1 and a.approvalStatus = 2 and a.inviterType = 2 and a.inviterId = #{driverId}
+ <if test="null != time and '' != time">
+ and DATE_FORMAT(b.createTime, '%Y年%m月') = #{time}
+ </if>
+ group by a.id, a.`name`
+ ) as aa where aa.time is not null order by aa.time desc limit #{pageNum}, #{pageSize}
+ </select>
+
+
+ <select id="queryDriverRank" resultType="com.supersavedriving.driver.modular.system.warpper.PerformanceRankingWarpper">
+ select
+ aa.driverId,
+ aa.name,
+ UNIX_TIMESTAMP(aa.createTime) * 1000 as createTime,
+ aa.number as amountOfData
+ from (
+ select
+ a.driverId,
+ b.`name`,
+ MAX(a.createTime) as createTime,
+ count(1) as number
+ from t_order a
+ left join t_driver b on (a.driverId = b.id)
+ where a.state in (107, 108, 108) and a.`status` = 1
+ <if test="null != dayType and 1 == dayType"><!--天-->
+ <if test="null != time and '' != time">
+ and DATE_FORMAT(a.createTime, '%Y年%m月%d日') = #{time}
+ </if>
+ </if>
+ <if test="null != dayType and 2 == dayType"><!--月-->
+ <if test="null != time and '' != time">
+ and DATE_FORMAT(a.createTime, '%Y年%m月') = #{time}
+ </if>
+ </if>
+ <if test="null != dayType and 3 == dayType"><!--年-->
+ <if test="null != time and '' != time">
+ and DATE_FORMAT(a.createTime, '%Y年') = #{time}
+ </if>
+ </if>
+ group by a.driverId,b.`name`
+ ) as aa order by aa.number desc
</select>
</mapper>
\ No newline at end of file
--
Gitblit v1.7.1