From 1473f665730d9adc30011691e7a1ec04ce134709 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期六, 14 九月 2024 08:35:52 +0800
Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV

---
 pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeCardOperateMapper.xml |   60 +++++++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 51 insertions(+), 9 deletions(-)

diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeCardOperateMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeCardOperateMapper.xml
index d413173..0d22785 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeCardOperateMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeCardOperateMapper.xml
@@ -331,39 +331,81 @@
   <select id="getTransactionRecordCount" parameterType="java.util.Map" resultType="java.lang.Long">
     SELECT
         COUNT(*) AS recordCount
-    FROM v_trade_details
+    FROM se_card_operate ope
+        INNER JOIN se_client cli ON ope.client_id = cli.id
+        INNER JOIN se_client_card card ON card.id = ope.card_id
+        LEFT JOIN se_payment_method pay ON ope.payment_id = pay.id
+        INNER JOIN ba_user us ON ope.operator = us.id
     <where>
+      AND ope.operate_type IN(1,2,3,5)
+
       <if test = "villageId != null and villageId > 0">
-        AND villageId = #{villageId}
+        AND cli.villageId = #{villageId}
       </if>
 
       <if test = "operateTimeStart != null and operateTimeStop != null">
-        AND tradeTime BETWEEN #{operateTimeStart} AND #{operateTimeStop}
+        AND ope.operate_dt BETWEEN #{operateTimeStart} AND #{operateTimeStop}
       </if>
 
       <if test = "cashierId != null and cashierId > 0">
-        AND cashierId = #{cashierId}
+        AND us.id = #{cashierId}
       </if>
     </where>
   </select>
 
   <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇浜ゆ槗璁板綍-->
   <select id="getTransactions" resultType="com.dy.pipIrrGlobal.voSe.VoTradeDetails">
-    SELECT * FROM v_trade_details
+    SELECT
+        ope.id AS orderNumber,
+        cli.name AS clientName,
+        card.cardNum AS cardNum,
+        cli.idCard,
+        cli.clientNum,
+        cli.phone,
+        (CASE ope.operate_type
+            WHEN 1 THEN '寮�鍗�'
+            WHEN 2 THEN '鍏呭��'
+            WHEN 3 THEN '閿�鍗�'
+            WHEN 5 THEN '琛ユ墸'
+        END) AS operateType,
+        (IFNULL(ope.trade_amount,0.00) + IFNULL(ope.card_cost,0.00)) AS tradeAmount,
+        IFNULL(ope.trade_amount,0.00) AS waterCost,
+        IFNULL(ope.card_cost,0.00) AS cardCost,
+        IFNULL(ope.gift,0.00) AS gift,
+        IFNULL(ope.refund_amount,0.00) AS refundAmount,
+        ope.money,
+        pay.name AS paymentName,
+        ope.operate_dt as tradeTime,
+        us.id AS cashierId,
+        us.name AS cashierName,
+        (CASE card.state
+            WHEN 1 THEN '姝e父'
+            WHEN 2 THEN '宸叉敞閿�'
+            WHEN 3 THEN '宸叉寕澶�'
+        END) AS cardState,
+        cli.districtTitle,
+        cli.villageId AS villageId
+    FROM se_card_operate ope
+        INNER JOIN se_client cli ON ope.client_id = cli.id
+        INNER JOIN se_client_card card ON card.id = ope.card_id
+        LEFT JOIN se_payment_method pay ON ope.payment_id = pay.id
+        INNER JOIN ba_user us ON ope.operator = us.id
     <where>
+      AND ope.operate_type IN(1,2,3,5)
+
       <if test = "villageId != null and villageId > 0">
-        AND villageId = #{villageId}
+        AND cli.villageId = #{villageId}
       </if>
 
       <if test = "operateTimeStart != null and operateTimeStop != null">
-        AND tradeTime BETWEEN #{operateTimeStart} AND #{operateTimeStop}
+        AND ope.operate_dt BETWEEN #{operateTimeStart} AND #{operateTimeStop}
       </if>
 
       <if test = "cashierId != null and cashierId > 0">
-        AND cashierId = #{cashierId}
+        AND us.id = #{cashierId}
       </if>
     </where>
-    ORDER BY tradeTime
+    ORDER BY ope.operate_dt
     <trim prefix="limit ">
       <if test="start != null and count != null">
         #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}

--
Gitblit v1.8.0