From 0bc5e07b24c08c41f14b066597d693026ec5fb89 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期六, 24 六月 2023 09:28:40 +0800
Subject: [PATCH] 修改bug
---
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/RevenueMapper.xml | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/RevenueMapper.xml b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/RevenueMapper.xml
index 79eed9b..8dec2cb 100644
--- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/RevenueMapper.xml
+++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/RevenueMapper.xml
@@ -10,7 +10,51 @@
<result column="userId" property="userId" />
<result column="orderId" property="orderId" />
<result column="amount" property="amount" />
+ <result column="balance" property="balance"/>
<result column="createTime" property="createTime" />
</resultMap>
+
+ <select id="queryTotalAmount" resultType="double">
+ select sum(amount) as amount from t_revenue where userType = 2 and userId = #{driverId}
+ </select>
+
+
+ <select id="queryDriverRank" resultType="com.supersavedriving.driver.modular.system.warpper.PerformanceRankingWarpper">
+ select
+ aa.driverId,
+ @ROW :=@ROW + 1 as rank,
+ aa.`name`,
+ UNIX_TIMESTAMP(aa.createTime) * 1000 as createTime,
+ aa.number as amountOfData
+ from (
+ select
+ a.userId as driverId,
+ b.`name`,
+ MAX(a.createTime) as createTime,
+ sum(a.amount) as number
+ from t_revenue a
+ left join t_driver b on (a.userId = b.id)
+ where a.userType = 2
+ <if test="null != type">
+ and a.type = #{type}
+ </if>
+ <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.userId,b.`name`
+ ) as aa,( SELECT @ROW := 0 ) AS itable order by aa.number desc
+ </select>
</mapper>
--
Gitblit v1.7.1