From 1a0c0fc8b02415e919e17c0b6ffbf99d08dec8f5 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期五, 07 四月 2023 17:40:53 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TRevenueMapper.xml |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TRevenueMapper.xml b/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TRevenueMapper.xml
index 70c34c8..d36f124 100644
--- a/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TRevenueMapper.xml
+++ b/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TRevenueMapper.xml
@@ -125,5 +125,43 @@
         WHERE
             cw.type = 2 AND cw.businessType = #{type} AND cw.code = #{code}
     </select>
+    <select id="getDataStatisticsIncomeOrCommission" resultType="com.stylefeng.guns.modular.system.controller.resp.PerformanceTableResp">
+        SELECT date_format(r.createTime, '%Y-%m') AS monthTime,COUNT(o.id) AS amount,d.name AS userName
+        FROM t_revenue r
+        LEFT JOIN t_driver d ON r.userId = d.id
+        LEFT JOIN t_order o ON r.orderId = o.id
+        <where>
+            <if test="agentId != null">
+                AND o.agentId = #{agentId}
+            </if>
+            <if test="monthDate != null and monthDate != ''">
+                AND date_format(r.createTime, '%Y-%m') LIKE concat('',#{monthDate},'%')
+            </if>
+            AND r.type = 1
+            AND r.userType = 2
+        </where>
+        GROUP BY monthTime,userName
+    </select>
+
+    <select id="getDataStatisticsCommission" resultType="com.stylefeng.guns.modular.system.controller.resp.PerformanceTableResp">
+        SELECT date_format(r.createTime, '%Y-%m') AS monthTime,SUM(r.amount) AS amount,d.name AS userName
+        FROM t_revenue r
+        LEFT JOIN t_driver d ON r.userId = d.id
+        LEFT JOIN t_order o ON r.orderId = o.id
+        <where>
+            <if test="agentId != null">
+                AND o.agentId = #{agentId}
+            </if>
+            <if test="monthDate != null and monthDate != ''">
+                AND date_format(r.createTime, '%Y-%m') LIKE concat('',#{monthDate},'%')
+            </if>
+            <if test="type != null">
+                AND r.type = #{type}
+            </if>
+            AND r.userType = 2
+        </where>
+        GROUP BY monthTime,userName
+        ORDER BY amount DESC
+    </select>
 
 </mapper>

--
Gitblit v1.7.1