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/TOrderMapper.xml |  111 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 107 insertions(+), 4 deletions(-)

diff --git a/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TOrderMapper.xml b/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TOrderMapper.xml
index 0a1fd14..3312641 100644
--- a/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TOrderMapper.xml
+++ b/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TOrderMapper.xml
@@ -58,10 +58,18 @@
 
     <sql id="Base_Column_Order">
         o.id, o.code, o.userId, o.driverId, o.`source`, o.agentId, o.branchOfficeId, o.startTime, o.startAddress, o.startLat, o.startLng, o.endAddress, o.endLat, o.endLng,
-            o.boardingTime, o.getoffTime, o.estimatedPrice, o.orderMoney, o.payMoney, o.discountedPrice, o.couponId, o.payType, o.payTime, o.`state`, o.status, o.createTime,
-            o.startDistance,o.startPrice,o.overDriveDistance,o.overDrivePrice,o.longDistance,o.longDistancePrice,o.overLongDistance,o.overLongDistancePrice,
-o.waitTime,o.waitTimePrice,o.outWaitTime,o.outWaitTimePrice,o.badWeatherDistance,o.badWeatherPrice,o.overBadWeatherDistance,o.overBadWeatherPrice,a.nickname AS userName,
-            a.phone AS userPhone,a.cancelCount,a.status AS userStatus,d.name AS driverName,d.phone AS driverPhone
+        o.boardingTime, o.getoffTime, o.estimatedPrice, o.orderMoney, o.payMoney, o.discountedPrice, o.couponId, o.payType, o.payTime, o.`state`, o.status, o.createTime,
+        o.startDistance,o.startPrice,o.overDriveDistance,o.overDrivePrice,o.longDistance,o.longDistancePrice,o.overLongDistance,o.overLongDistancePrice,
+        o.waitTime,o.waitTimePrice,o.outWaitTime,o.outWaitTimePrice,o.badWeatherDistance,o.badWeatherPrice,o.overBadWeatherDistance,o.overBadWeatherPrice,a.nickname AS userName,
+        a.phone AS userPhone,a.cancelCount,a.status AS userStatus,d.name AS driverName,d.phone AS driverPhone
+    </sql>
+
+    <sql id="Base_Column_Server_Order">
+        o.id, o.code, o.userId, o.driverId, o.`source`, o.agentId, o.branchOfficeId, o.startTime, o.startAddress, o.startLat, o.startLng, o.endAddress, o.endLat, o.endLng,
+        o.boardingTime, o.getoffTime, o.estimatedPrice, o.orderMoney, o.payMoney, o.discountedPrice, o.couponId, o.payType, o.payTime, o.`state`, o.status, o.createTime,
+        o.startDistance,o.startPrice,o.overDriveDistance,o.overDrivePrice,o.longDistance,o.longDistancePrice,o.overLongDistance,o.overLongDistancePrice,
+        o.waitTime,o.waitTimePrice,o.outWaitTime,o.outWaitTimePrice,o.badWeatherDistance,o.badWeatherPrice,o.overBadWeatherDistance,o.overBadWeatherPrice,
+        d.name AS driverName,d.phone AS driverPhone
     </sql>
 
     <select id="getOrderList" resultType="com.stylefeng.guns.modular.system.controller.resp.TOrderResp">
@@ -103,5 +111,100 @@
         </where>
         ORDER BY o.createTime
     </select>
+    <select id="getDataStatisticsByYear" resultType="com.stylefeng.guns.modular.system.controller.resp.DataStatisticsOrderYearResp">
+        SELECT createTime AS `month`,COUNT(id) AS orderCount
+        FROM t_order
+        <where>
+            <if test="agentId != null">
+                AND agentId = #{agentId}
+            </if>
+            <if test="yearDate != null and yearDate != ''">
+                AND date_format(createTime, '%Y') LIKE concat('',#{yearDate},'%')
+            </if>
+        </where>
+        GROUP BY date_format(createTime, '%Y-%m')
+    </select>
+    <select id="getDataStatisticsOrderCount" resultType="com.stylefeng.guns.modular.system.controller.resp.PerformanceTableResp">
+        SELECT date_format(o.createTime, '%Y-%m') AS monthTime,COUNT(o.id) AS amount,d.name AS userName
+        FROM t_order o
+        LEFT JOIN t_driver d ON o.driverId = d.id
+        <where>
+            <if test="agentId != null">
+                AND o.agentId = #{agentId}
+            </if>
+            <if test="monthDate != null and monthDate != ''">
+                AND date_format(o.createTime, '%Y-%m') LIKE concat('',#{monthDate},'%')
+            </if>
+            AND (o.`state` = 108 OR o.`state` = 109)
+        </where>
+        GROUP BY monthTime,userName
+        ORDER BY amount DESC
+    </select>
+    <select id="getDataStatisticsCount" resultType="java.lang.Integer">
+        SELECT COUNT(id)
+        FROM t_order
+        <where>
+            <if test="agentId != null">
+                AND agentId = #{agentId}
+            </if>
+            <if test="type != null">
+                AND `state` = #{type}
+            </if>
+            <if test="localDate != null">
+                AND date_format(createTime, '%Y-%m-%d') LIKE concat('',#{localDate},'%')
+            </if>
+        </where>
+    </select>
+    <select id="getDataStatisticsServerCount" resultType="java.lang.Integer">
+        SELECT COUNT(id)
+        FROM t_order
+        <where>
+            <if test="agentId != null">
+                AND agentId = #{agentId}
+            </if>
+            <if test="localDate != null">
+                AND date_format(createTime, '%Y-%m-%d') LIKE concat('',#{localDate},'%')
+            </if>
+            AND (`state` = 102
+                OR `state` = 103
+                OR `state` = 104
+                OR `state` = 105
+                OR `state` = 106
+                OR `state` = 107
+            )
+        </where>
+    </select>
+    <select id="getDataStatisticsServerList" resultType="com.stylefeng.guns.modular.system.controller.resp.TOrderServerResp">
+        select <include refid="Base_Column_Server_Order"></include>
+        FROM t_order o
+        LEFT JOIN t_driver d ON o.driverId = d.id
+        <where>
+            <if test="agentId != null">
+                AND o.agentId = #{agentId}
+            </if>
+            <if test="localDate != null">
+                AND date_format(o.createTime, '%Y-%m-%d') LIKE concat('',#{localDate},'%')
+            </if>
+            AND (o.`state` = 102
+            OR o.`state` = 103
+            OR o.`state` = 104
+            OR o.`state` = 105
+            OR o.`state` = 106
+            OR o.`state` = 107
+            )
+        </where>
+    </select>
+    <select id="getDataStatisticsAllList" resultType="com.stylefeng.guns.modular.system.model.TOrder">
+        select <include refid="Base_Column_List"></include>
+        FROM t_order
+        <where>
+            <if test="agentId != null">
+                AND agentId = #{agentId}
+            </if>
+            <if test="localDate != null">
+                AND date_format(createTime, '%Y-%m-%d') LIKE concat('',#{localDate},'%')
+            </if>
+        </where>
+    </select>
 
 </mapper>

--
Gitblit v1.7.1