From 3b58972c757734f0dc4b1ff29a0a179ed564ab64 Mon Sep 17 00:00:00 2001
From: Administrator <zhubaomin>
Date: 星期三, 17 七月 2024 11:47:42 +0800
Subject: [PATCH] 2024-07-17 朱宝民 重构命令日志表,返回结果改为text类型
---
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeCardOperateMapper.xml | 166 ++++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 132 insertions(+), 34 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 ce7af1c..8baa1e8 100644
--- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeCardOperateMapper.xml
+++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeCardOperateMapper.xml
@@ -235,12 +235,12 @@
select
COUNT(*) AS recordCount
FROM se_card_operate ope
- INNER JOIN se_client_card card ON ope.card_id = card.id
- INNER JOIN se_client cli ON ope.client_id = cli.id
- INNER JOIN ba_user us ON ope.operator = us.id
- Left JOIN se_payment_method pay ON ope.payment_id = pay.id
+ INNER JOIN se_client_card card ON ope.card_id = card.id
+ INNER JOIN se_client cli ON ope.client_id = cli.id
+ INNER JOIN ba_user us ON ope.operator = us.id
+ Left JOIN se_payment_method pay ON ope.payment_id = pay.id
<where>
- AND ope.operate_type in(2, 5)
+ AND ope.operate_type in(1, 2, 5)
<if test = "clientName != null and clientName !=''">
AND cli.name like CONCAT('%',#{clientName},'%')
</if>
@@ -253,38 +253,52 @@
AND card.cardNum like CONCAT('%',#{cardNum},'%')
</if>
- <if test = "paymentId != null and paymentId > 0">
- AND ope.payment_id = ${paymentId}
- </if>
+ <!-- <if test = "paymentId != null and paymentId > 0">-->
+ <!-- AND ope.payment_id = ${paymentId}-->
+ <!-- </if>-->
- <if test = "rechargeTimeStart != null and rechargeTimeStop != null">
- AND ope.operate_dt BETWEEN #{rechargeTimeStart} AND #{rechargeTimeStop}
- </if>
+ <!-- <if test = "rechargeTimeStart != null and rechargeTimeStop != null">-->
+ <!-- AND ope.operate_dt BETWEEN #{rechargeTimeStart} AND #{rechargeTimeStop}-->
+ <!-- </if>-->
</where>
</select>
<!--鏍规嵁鎸囧畾鏉′欢鑾峰彇鍏呭�艰褰�-->
<select id="getRecharges" resultType="com.dy.pipIrrGlobal.voSe.VoRecharge">
SELECT
- CAST(ope.id AS char) AS id,
- cli.name AS clientName,
- cli.clientNum,
- CAST(card.cardNum AS char) AS cardNum,
- IFNULL(ope.trade_amount, 0) AS amount,
- IFNULL(ope.refund_amount, 0) AS refundAmount,
- (IFNULL(ope.money, 0) + IFNULL(ope.trade_amount, 0)) AS afterRecharge,
- -- ope.payment_id AS paymentId,
- pay.name AS paymentName,
- ope.price,
- us.name AS operator,
- ope.operate_dt
+ ope.id AS opeId,
+ card.id AS cardId,
+ cli.name AS clientName,
+ cli.phone,
+ cli.idCard,
+ cli.clientNum,
+ cli.address,
+ card.money,
+ cardNum,
+<!-- CASE-->
+<!-- WHEN card.cardNum LIKE '10%' THEN CONCAT(SUBSTRING(card.cardNum, 7, 6),SUBSTRING(card.cardNum, 14, 4))-->
+<!-- ELSE card.cardNum-->
+<!-- END AS cardNum,-->
+ IFNULL(ope.card_cost,0) AS cardCost,
+ IFNULL(ope.trade_amount, 0) AS amount,
+ IFNULL(ope.refund_amount, 0) AS refundAmount,
+ (IFNULL(ope.money, 0) + IFNULL(ope.trade_amount, 0)) AS afterRecharge,
+ pay.name AS paymentName,
+ ope.price,
+ us.name AS opr,
+ (CASE
+ WHEN ope.operate_type = 1 THEN "寮�鍗�"
+ WHEN ope.operate_type = 2 THEN "鍏呭��"
+ WHEN ope.operate_type = 5 THEN "杩旇繕"
+ END) AS operateType,
+ ope.operate_dt
FROM se_card_operate ope
INNER JOIN se_client_card card ON ope.card_id = card.id
- INNER JOIN se_client cli ON ope.client_id = cli.id
- INNER JOIN ba_user us ON ope.operator = us.id
- Left JOIN se_payment_method pay ON ope.payment_id = pay.id
+ INNER JOIN se_client cli ON ope.client_id = cli.id
+ INNER JOIN ba_user us ON ope.operator = us.id
+ Left JOIN se_payment_method pay ON ope.payment_id = pay.id
<where>
- AND ope.operate_type in(2, 5)
+ AND ope.operate_type in(1, 2, 5)
<if test = "clientName != null and clientName !=''">
AND cli.name like CONCAT('%',#{clientName},'%')
</if>
@@ -297,13 +311,13 @@
AND card.cardNum like CONCAT('%',#{cardNum},'%')
</if>
- <if test = "paymentId != null and paymentId > 0">
- AND ope.payment_id = ${paymentId}
- </if>
+<!-- <if test = "paymentId != null and paymentId > 0">-->
+<!-- AND ope.payment_id = ${paymentId}-->
+<!-- </if>-->
- <if test = "rechargeTimeStart != null and rechargeTimeStop != null">
- AND ope.operate_dt BETWEEN #{rechargeTimeStart} AND #{rechargeTimeStop}
- </if>
+<!-- <if test = "rechargeTimeStart != null and rechargeTimeStop != null">-->
+<!-- AND ope.operate_dt BETWEEN #{rechargeTimeStart} AND #{rechargeTimeStop}-->
+<!-- </if>-->
</where>
ORDER BY ope.operate_dt DESC
<trim prefix="limit " >
@@ -387,7 +401,7 @@
</select>
<!--鏍规嵁鎸囧畾鏉′欢鑾峰彇寮�鍗¤褰�-->
- <select id="getActiveCards" resultType="com.dy.pipIrrGlobal.voSe.VoActiveCardNew">
+ <select id="getActiveCards" resultType="com.dy.pipIrrGlobal.voSe.VoActiveCard">
SELECT
CAST(ope.id AS char) AS id ,
cli.name AS clientName,
@@ -481,6 +495,76 @@
<if test = "activeTimeStart != null and activeTimeStop != null">
AND ope.operate_dt BETWEEN #{reissueCardTimeStart} AND #{reissueCardTimeStop}
+ </if>
+ </where>
+ ORDER BY ope.operate_dt DESC
+ <trim prefix="limit " >
+ <if test="start != null and count != null">
+ #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
+ </if>
+ </trim>
+ </select>
+
+ <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇閫氱敤鎿嶄綔璁板綍鏁伴噺-->
+ <select id="getCommonOperationRecordCount" parameterType="java.util.Map" resultType="java.lang.Long">
+ select
+ COUNT(*) AS recordCount
+ FROM se_card_operate ope
+ INNER JOIN se_client cli ON ope.client_id = cli.id
+ INNER JOIN se_client_card card ON ope.card_id = card.id
+ INNER JOIN ba_user us ON ope.operator = us.id
+ <where>
+ <if test = "operateType != null and operateType > 0">
+ AND ope.operate_type = ${operateType}
+ </if>
+
+ <if test = "clientName != null and clientName !=''">
+ AND cli.name like CONCAT('%',#{clientName},'%')
+ </if>
+
+ <if test = "cardNum != null and cardNum !=''">
+ AND card.cardNum like CONCAT('%',#{cardNum},'%')
+ </if>
+
+ <if test = "timeStart != null and timeStop != null">
+ AND ope.operate_dt BETWEEN #{timeStart} AND #{timeStop}
+ </if>
+ </where>
+ </select>
+
+ <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇閫氱敤鎿嶄綔璁板綍-->
+ <select id="getCommonOperations" resultType="com.dy.pipIrrGlobal.voSe.VoOperate">
+ SELECT
+ cli.name AS clientName,
+ cli.clientNum,
+ CAST(card.cardNum AS char) AS cardNum,
+ us.name AS operator,
+ ope.operate_dt AS operateDt,
+ IFNULL(ope.trade_amount,0) AS refund,
+ (CASE
+ WHEN ope.payment_id = 1 THEN "鐜伴噾"
+ END) AS refundTypeName,
+ card.money,
+ IFNULL(ope.system_balance,0) AS systemBalance
+ FROM se_card_operate ope
+ INNER JOIN se_client cli ON ope.client_id = cli.id
+ INNER JOIN se_client_card card ON ope.card_id = card.id
+ INNER JOIN ba_user us ON ope.operator = us.id
+ <where>
+ <if test = "operateType != null and operateType > 0">
+ AND ope.operate_type = ${operateType}
+ </if>
+
+ <if test = "clientName != null and clientName !=''">
+ AND cli.name like CONCAT('%',#{clientName},'%')
+ </if>
+
+ <if test = "cardNum != null and cardNum !=''">
+ AND card.cardNum like CONCAT('%',#{cardNum},'%')
+ </if>
+
+ <if test = "timeStart != null and timeStop != null">
+ AND ope.operate_dt BETWEEN #{timeStart} AND #{timeStop}
</if>
</where>
ORDER BY ope.operate_dt DESC
@@ -595,4 +679,18 @@
</if>
</where>
</select>
+
+ <!--鏍规嵁姘村崱缂栧彿鑾峰彇鍏舵寕澶辨椂閫�娆鹃噾棰濓紙琛ュ崱鏃跺垽鏂娇鐢級-->
+ <select id="getTradeAmountByCardNo" resultType="java.lang.Double">
+ SELECT
+ ope.trade_amount AS tradeAmount
+ FROM se_client_card card
+ INNER JOIN se_card_operate ope ON ope.card_id = card.id
+ <where>
+ AND ope.operate_type = 6
+ AND card.cardNum = #{cardNum}
+ </where>
+ ORDER BY ope.operate_dt DESC
+ LIMIT 0,1
+ </select>
</mapper>
\ No newline at end of file
--
Gitblit v1.8.0