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

diff --git a/ruoyi-system/src/main/resources/mapper/system/TFlowManagementMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TFlowManagementMapper.xml
index 136ec5f..74c2699 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TFlowManagementMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TFlowManagementMapper.xml
@@ -39,10 +39,10 @@
 
     <!-- 统计总额和微信支付金额 -->
     <select id="getPaymentStats" resultMap="PaymentStatsResultMap">
-        SELECT ifnull(SUM(flow_money),0) AS total_amount,
-        ifnull(SUM(CASE WHEN pay_type = 1 THEN flow_money ELSE 0 END ) ,0)AS wechat_amount,
-        ifnull(SUM(CASE WHEN pay_type = 2 THEN flow_money ELSE 0 END ),0) AS alipay_amount,
-        ifnull(SUM(CASE WHEN pay_type = 3 THEN flow_money ELSE 0 END ),0) AS offline_amount
+        SELECT ifnull(SUM(pre_outstand-remaining_money),0) AS total_amount,
+        ifnull(SUM(CASE WHEN pay_type = 1 THEN (pre_outstand-remaining_money) ELSE 0 END ) ,0)AS wechat_amount,
+        ifnull(SUM(CASE WHEN pay_type = 2 THEN (pre_outstand-remaining_money) ELSE 0 END ),0) AS alipay_amount,
+        ifnull(SUM(CASE WHEN pay_type = 3 THEN (pre_outstand-remaining_money) ELSE 0 END ),0) AS offline_amount
         FROM
             t_flow_management
         <where>
@@ -64,6 +64,9 @@
             <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>

--
Gitblit v1.7.1