From 5fa6e6f8410ef9d057174bcff2a3c5038c54a551 Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期日, 27 四月 2025 18:41:20 +0800
Subject: [PATCH] bug修改

---
 ruoyi-system/src/main/resources/mapper/system/TBankFlowMapper.xml |   39 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/ruoyi-system/src/main/resources/mapper/system/TBankFlowMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TBankFlowMapper.xml
index 61d5859..06126b6 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TBankFlowMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TBankFlowMapper.xml
@@ -26,4 +26,43 @@
         id, bank_serial_number, flow_money, deduction_money, remaining_money, pay_time, payer, flow_status, pay_type, payment_bill_id, create_time, update_time, create_by, update_by, disabled
     </sql>
 
+
+    <!-- 定义结果映射 -->
+    <resultMap id="PaymentStatsResultMap" type="com.ruoyi.system.vo.TBankFlowStatisticsVo">
+        <result property="totalFlowMoney" column="totalFlowMoney" />
+        <result property="totalDeductionMoney" column="totalDeductionMoney" />
+        <result property="totalRemainingMoney" column="totalRemainingMoney" />
+    </resultMap>
+
+    <!-- 统计总额和微信支付金额 -->
+    <select id="getPaymentStats" resultMap="PaymentStatsResultMap">
+        SELECT
+        ifnull(SUM(flow_money),0) AS totalFlowMoney,
+        ifnull(SUM(deduction_money),0) AS totalDeductionMoney,
+        ifnull(SUM(remaining_money),0) AS totalRemainingMoney
+        FROM
+        t_bank_flow
+        <where>
+            <if test="req.bankSerialNumber != null and req.bankSerialNumber != ''">
+                and bank_serial_number = #{req.bankSerialNumber}
+            </if>
+            <if test="req.payer != null and req.payer != ''">
+                and payer like concat('%', #{req.payer}, '%')
+            </if>
+            <if test="req.flowStatus != null and req.flowStatus != ''">
+                and flow_status = #{req.flowStatus}
+            </if>
+            <if test="req.payStartTime != null and req.payStartTime != ''">
+                and pay_time &gt;= #{req.payStartTime}
+            </if>
+            <if test="req.payEndTime != null and req.payEndTime != ''">
+                and pay_time &lt;= #{req.payEndTime}
+            </if>
+            <if test='businessDeptId != null and businessDeptId != "" and businessDeptId != "0"'>
+                and business_dept_id = #{businessDeptId}
+            </if>
+            AND disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
+        </where>
+    </select>
+
 </mapper>

--
Gitblit v1.7.1