From a180931acef6562560faec9fb01a46b9d4337532 Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期六, 12 十月 2024 09:41:10 +0800
Subject: [PATCH] 2024-10-12 朱宝民 4个接口改造、新增通知接口、10个原因接口优化

---
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeGeneralMapper.xml |   38 ++++++++++++++++++++++++++++++++++----
 1 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeGeneralMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeGeneralMapper.xml
index aac929f..8fbf4cd 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeGeneralMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeGeneralMapper.xml
@@ -253,6 +253,7 @@
     SUM(ope.trade_amount) AS tradeAmount
     FROM se_card_operate ope
     <where>
+      AND ope.operate_valid = 2
       <if test = "tradeDate != null and tradeDate !=''">
         AND Date(ope.operate_dt) = #{tradeDate}
       </if>
@@ -265,7 +266,7 @@
         AND ope.operator = #{cashierId}
       </if>
     </where>
-    GROUP BY ope.payment_id,  Date(ope.operate_dt)
+<!--    GROUP BY ope.payment_id,  Date(ope.operate_dt)-->
   </select>
 
   <!--  璐㈠姟瀵硅处瀹℃牳椤碉紝鏀堕摱鍛�+鏃ユ湡鍒嗙粍锛屾帓闄や氦鏄撶被鍨嬪垎缁勶紝璁板綍鏁�-->
@@ -286,17 +287,46 @@
 
   <!--寮�鍗$郴缁熶氦鏄撶粺璁★紝鏀堕摱鍛�+鏃ユ湡+绫诲瀷鍒嗙粍-->
   <select id="getSummaries" resultType="com.dy.pipIrrGlobal.voSe.VoTransactionStatistics">
-    SELECT * FROM v_trade_summary
+    SELECT
+        CASE
+            WHEN ope.operate_type = 1 THEN '寮�鍗�'
+            WHEN ope.operate_type = 2 THEN '鍏呭��'
+            WHEN ope.operate_type = 3 THEN '閿�鍗�'
+            WHEN ope.operate_type = 4 THEN '琛ュ崱'
+            WHEN ope.operate_type = 5 THEN '杩旇繕'
+        END AS operateType,
+        Date(ope.operate_dt) AS tradeDate,
+        COUNT(*) AS count,
+        (IFNULL(SUM(ope.trade_amount), 0) + IFNULL(SUM(ope.card_cost), 0)) AS received,
+        IFNULL(SUM(ope.gift), 0) AS gift,
+        IFNULL(sum(ope.refund_amount),0) AS refundAmount,
+        us.id AS cashierId
+    FROM se_card_operate ope
+        INNER JOIN ba_user us ON us.id = ope.operator
     <where>
+      AND ope.operate_type IN(1,2,3,4,5)
       <if test = "cashierId != null and cashierId > 0">
-        AND cashierId = #{cashierId}
+        AND us.id = #{cashierId}
       </if>
 
       <if test = "timeStart != null and timeStop != null">
-        AND Date(tradeDate) BETWEEN #{timeStart} AND #{timeStop}
+        AND Date(ope.operate_dt) BETWEEN #{timeStart} AND #{timeStop}
       </if>
     </where>
+    GROUP BY ope.operate_type,  Date(ope.operate_dt), us.id
     ORDER BY tradeDate
+
+<!--    SELECT * FROM v_trade_summary-->
+<!--    <where>-->
+<!--      <if test = "cashierId != null and cashierId > 0">-->
+<!--        AND cashierId = #{cashierId}-->
+<!--      </if>-->
+
+<!--      <if test = "timeStart != null and timeStop != null">-->
+<!--        AND Date(tradeDate) BETWEEN #{timeStart} AND #{timeStop}-->
+<!--      </if>-->
+<!--    </where>-->
+<!--    ORDER BY tradeDate-->
   </select>
 
   <!--  鏍规嵁鏀堕摱鍛業D鍙婃棩鏈熻幏鍙栬储鍔″璐浜ゆ槗鏄庣粏璁板綍鏁�-->

--
Gitblit v1.8.0