From ae659b7fe99a8862082a4ba4bb24148a2a6727ca Mon Sep 17 00:00:00 2001
From: tuqin <tuqin@tuqin.cn>
Date: 星期四, 08 十月 2026 16:57:40 +0800
Subject: [PATCH] feat(芯导): 仓储物流出库 / 人力资源(离职/在职/合同/薪资) / 环保门禁(门禁+智能巡检) 后端

---
 src/main/resources/mapper/account/AccountExpenseMapper.xml |   58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 57 insertions(+), 1 deletions(-)

diff --git a/src/main/resources/mapper/account/AccountExpenseMapper.xml b/src/main/resources/mapper/account/AccountExpenseMapper.xml
index 909f372..4d1efd8 100644
--- a/src/main/resources/mapper/account/AccountExpenseMapper.xml
+++ b/src/main/resources/mapper/account/AccountExpenseMapper.xml
@@ -16,6 +16,9 @@
         <if test="accountExpense.expenseType != null and accountExpense.expenseType != '' ">
             AND expense_type = #{accountExpense.expenseType}
         </if>
+        <if test="accountExpense.expenseCategory != null and accountExpense.expenseCategory != '' ">
+            AND expense_category = #{accountExpense.expenseCategory}
+        </if>
         <if test="accountExpense.expenseMethod != null and accountExpense.expenseMethod != '' ">
             AND expense_method = #{accountExpense.expenseMethod}
         </if>
@@ -35,6 +38,9 @@
         <if test="accountExpense.expenseType != null and accountExpense.expenseType != '' ">
             AND expense_type = #{accountExpense.expenseType}
         </if>
+        <if test="accountExpense.expenseCategory != null and accountExpense.expenseCategory != '' ">
+            AND expense_category = #{accountExpense.expenseCategory}
+        </if>
         <if test="accountExpense.expenseMethod != null and accountExpense.expenseMethod != '' ">
             AND expense_method = #{accountExpense.expenseMethod}
         </if>
@@ -53,7 +59,57 @@
         <if test="dateQueryDto.entryDateEnd != null and dateQueryDto.entryDateEnd != '' ">
             AND expense_date &lt;= DATE_FORMAT(#{dateQueryDto.entryDateEnd},'%Y-%m-%d')
         </if>
-        group by expense_type
+        group by ae.expense_type, sdd.dict_label
+    </select>
+
+    <select id="report1" resultType="java.math.BigDecimal">
+        SELECT
+        sum(expense_money) account
+        FROM account_expense ai
+        where
+        expense_type=#{dictValue}
+        <if test="dateQueryDto.entryDateStart != null and dateQueryDto.entryDateStart != '' ">
+            AND expense_date &gt;= DATE_FORMAT(#{dateQueryDto.entryDateStart},'%Y-%m-%d')
+        </if>
+        <if test="dateQueryDto.entryDateEnd != null and dateQueryDto.entryDateEnd != '' ">
+            AND expense_date &lt;= DATE_FORMAT(#{dateQueryDto.entryDateEnd},'%Y-%m-%d')
+        </if>
+    </select>
+
+    <select id="reportByCategory" resultType="java.util.Map">
+        SELECT COALESCE(sdd.dict_label, '鏈垎绫�') AS categoryName,
+               ae.expense_category AS categoryValue,
+               SUM(ae.expense_money) AS amount
+        FROM account_expense ae
+        LEFT JOIN sys_dict_data sdd ON ae.expense_category = sdd.dict_value
+          AND sdd.dict_type = 'finance_expense_category'
+        WHERE 1=1
+        <if test="dateQueryDto.entryDateStart != null and dateQueryDto.entryDateStart != ''">
+            AND ae.expense_date &gt;= DATE_FORMAT(#{dateQueryDto.entryDateStart},'%Y-%m-%d')
+        </if>
+        <if test="dateQueryDto.entryDateEnd != null and dateQueryDto.entryDateEnd != ''">
+            AND ae.expense_date &lt;= DATE_FORMAT(#{dateQueryDto.entryDateEnd},'%Y-%m-%d')
+        </if>
+        GROUP BY ae.expense_category, sdd.dict_label
+    </select>
+
+    <select id="trendByCategory" resultType="java.util.Map">
+        SELECT DATE_FORMAT(ae.expense_date, '%Y-%m') AS month,
+               ae.expense_category AS categoryValue,
+               COALESCE(sdd.dict_label, '鏈垎绫�') AS categoryName,
+               SUM(ae.expense_money) AS amount
+        FROM account_expense ae
+        LEFT JOIN sys_dict_data sdd ON ae.expense_category = sdd.dict_value
+          AND sdd.dict_type = 'finance_expense_category'
+        WHERE 1=1
+        <if test="dateQueryDto.entryDateStart != null and dateQueryDto.entryDateStart != ''">
+            AND ae.expense_date &gt;= DATE_FORMAT(#{dateQueryDto.entryDateStart},'%Y-%m-%d')
+        </if>
+        <if test="dateQueryDto.entryDateEnd != null and dateQueryDto.entryDateEnd != ''">
+            AND ae.expense_date &lt;= DATE_FORMAT(#{dateQueryDto.entryDateEnd},'%Y-%m-%d')
+        </if>
+        GROUP BY DATE_FORMAT(ae.expense_date, '%Y-%m'), ae.expense_category, sdd.dict_label
+        ORDER BY month, ae.expense_category
     </select>
 
 </mapper>

--
Gitblit v1.9.3