From 98d89a1d9484104005e6d8b43365d7f508dde985 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期一, 08 六月 2026 15:01:39 +0800
Subject: [PATCH] feat:1.收入,支出管理倒序排序 2.开票台账查询优化
---
src/main/resources/mapper/account/AccountExpenseMapper.xml | 41 +++++++++++++++++++++++++++++++++++++++--
1 files changed, 39 insertions(+), 2 deletions(-)
diff --git a/src/main/resources/mapper/account/AccountExpenseMapper.xml b/src/main/resources/mapper/account/AccountExpenseMapper.xml
index 909f372..66c62b1 100644
--- a/src/main/resources/mapper/account/AccountExpenseMapper.xml
+++ b/src/main/resources/mapper/account/AccountExpenseMapper.xml
@@ -19,6 +19,7 @@
<if test="accountExpense.expenseMethod != null and accountExpense.expenseMethod != '' ">
AND expense_method = #{accountExpense.expenseMethod}
</if>
+ order by create_time desc
</select>
<select id="accountExpenseExport" resultType="com.ruoyi.account.pojo.AccountExpense">
SELECT
@@ -44,7 +45,7 @@
sdd.dict_label typeName,
sum(expense_money) account
FROM account_expense ae
- left join sys_dict_data sdd on ae.expense_type = sdd.dict_value and sdd.dict_type='expense_types'
+ left join sys_dict_data sdd on ae.expense_type = sdd.dict_value and sdd.dict_type='expense_types'
where
1=1
<if test="dateQueryDto.entryDateStart != null and dateQueryDto.entryDateStart != '' ">
@@ -53,7 +54,43 @@
<if test="dateQueryDto.entryDateEnd != null and dateQueryDto.entryDateEnd != '' ">
AND expense_date <= DATE_FORMAT(#{dateQueryDto.entryDateEnd},'%Y-%m-%d')
</if>
- group by expense_type
+ group by sdd.dict_label, ae.expense_type
+ </select>
+
+ <select id="report1" resultType="java.math.BigDecimal">
+ SELECT
+ ifnull(sum(expense_money),0) account
+ FROM account_expense ai
+ where
+ expense_type=#{dictValue}
+ <if test="dateQueryDto.entryDateStart != null and dateQueryDto.entryDateStart != '' ">
+ AND expense_date >= DATE_FORMAT(#{dateQueryDto.entryDateStart},'%Y-%m-%d')
+ </if>
+ <if test="dateQueryDto.entryDateEnd != null and dateQueryDto.entryDateEnd != '' ">
+ AND expense_date <= DATE_FORMAT(#{dateQueryDto.entryDateEnd},'%Y-%m-%d')
+ </if>
+ </select>
+
+ <select id="selectAccountExpenseStats" resultType="com.ruoyi.home.dto.IncomeExpenseAnalysisDto">
+ SELECT DATE_FORMAT(expense_date, #{dateFormat}) as dateStr, IFNULL(SUM(expense_money), 0) as amount
+ FROM account_expense
+ WHERE expense_date BETWEEN #{startDate} AND #{endDate}
+ GROUP BY dateStr
+ </select>
+
+ <select id="selectExpenseComposition" resultType="com.ruoyi.dto.MapDto">
+ SELECT sdd.dict_label as name, CAST(IFNULL(SUM(ae.expense_money), 0) AS CHAR) as value
+ FROM account_expense ae
+ LEFT JOIN sys_dict_data sdd ON ae.expense_type = sdd.dict_value AND sdd.dict_type = 'expense_types'
+ <where>
+ <if test="startDate != null and startDate != ''">
+ AND ae.expense_date >= #{startDate}
+ </if>
+ <if test="endDate != null and endDate != ''">
+ AND ae.expense_date <= #{endDate}
+ </if>
+ </where>
+ GROUP BY ae.expense_type, sdd.dict_label
</select>
</mapper>
--
Gitblit v1.9.3