From 44937043c65a7bb82f96dce7f813f1c82e85a159 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期三, 29 四月 2026 13:02:52 +0800
Subject: [PATCH] fix: 合并回款与收付款方式相关修复

---
 src/main/resources/mapper/account/AccountIncomeMapper.xml |   49 +++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 47 insertions(+), 2 deletions(-)

diff --git a/src/main/resources/mapper/account/AccountIncomeMapper.xml b/src/main/resources/mapper/account/AccountIncomeMapper.xml
index bfb6d73..f2cfbe2 100644
--- a/src/main/resources/mapper/account/AccountIncomeMapper.xml
+++ b/src/main/resources/mapper/account/AccountIncomeMapper.xml
@@ -17,7 +17,26 @@
         <if test="accountIncome.incomeType != null and accountIncome.incomeType != '' ">
             AND income_type = #{accountIncome.incomeType}
         </if>
-        <if test="accountIncome.incomeMethod != null and accountIncome.incomeMethod != '' ">
+        <if test="accountIncome.incomeMethodLabel != null and accountIncome.incomeMethodLabel != ''">
+            AND (
+            (
+            business_type = 1
+            AND income_method in
+            <foreach collection="accountIncome.receiptPaymentMethodList" item="method" open="(" separator="," close=")">
+                #{method}
+            </foreach>
+            )
+            OR
+            (
+            business_type is null
+            AND income_method in
+            <foreach collection="accountIncome.paymentMethodList" item="method" open="(" separator="," close=")">
+                #{method}
+            </foreach>
+            )
+            )
+        </if>
+        <if test="(accountIncome.incomeMethodLabel == null or accountIncome.incomeMethodLabel == '') and accountIncome.incomeMethod != null and accountIncome.incomeMethod != '' ">
             AND income_method = #{accountIncome.incomeMethod}
         </if>
     </select>
@@ -43,7 +62,7 @@
     <select id="report" resultType="com.ruoyi.account.dto.AccountDto2">
         SELECT
         sdd.dict_label typeName,
-        sum(income_money) account
+        ifnull(sum(income_money),0) account
         FROM account_income ai
         left join sys_dict_data sdd on ai.income_type = sdd.dict_value and  sdd.dict_type='income_types'
         where
@@ -56,4 +75,30 @@
         </if>
         group by income_type
     </select>
+    <select id="report1" resultType="java.math.BigDecimal">
+        SELECT
+        ifnull(sum(income_money),0) account
+        FROM account_income ai
+        where
+        income_type=#{dictValue}
+        <if test="dateQueryDto.entryDateStart != null and dateQueryDto.entryDateStart != '' ">
+            AND income_date &gt;= DATE_FORMAT(#{dateQueryDto.entryDateStart},'%Y-%m-%d')
+        </if>
+        <if test="dateQueryDto.entryDateEnd != null and dateQueryDto.entryDateEnd != '' ">
+            AND income_date &lt;= DATE_FORMAT(#{dateQueryDto.entryDateEnd},'%Y-%m-%d')
+        </if>
+    </select>
+
+    <select id="selectIncomeStats"
+            resultType="com.ruoyi.home.dto.IncomeExpenseAnalysisDto">
+        SELECT DATE_FORMAT(income_date, #{dateFormat}) AS dateStr,
+               IFNULL(SUM(income_money), 0)            AS amount
+        FROM account_income
+        WHERE income_date BETWEEN #{startDate} AND #{endDate}
+#           AND business_type = 1
+        GROUP BY dateStr
+        ORDER BY dateStr
+
+    </select>
+
 </mapper>

--
Gitblit v1.9.3