yaowanxin
2025-08-11 1b5604f8a88000e2f51d4c989fd179989468ee67
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.ruoyi.account.mapper.AccountExpenseMapper">
    <select id="accountExpenseListPage" resultType="com.ruoyi.account.pojo.AccountExpense">
        SELECT
        *
        FROM account_expense
        where
        1=1
        <if test="accountExpense.entryDateStart != null and accountExpense.entryDateStart != '' ">
            AND expense_date &gt;= DATE_FORMAT(#{accountExpense.entryDateStart},'%Y-%m-%d')
        </if>
        <if test="accountExpense.entryDateEnd != null and accountExpense.entryDateEnd != '' ">
            AND  expense_date &lt;= DATE_FORMAT(#{accountExpense.entryDateEnd},'%Y-%m-%d')
        </if>
        <if test="accountExpense.expenseType != null and accountExpense.expenseType != '' ">
            AND expense_type = #{accountExpense.expenseType}
        </if>
        <if test="accountExpense.expenseMethod != null and accountExpense.expenseMethod != '' ">
            AND expense_method = #{accountExpense.expenseMethod}
        </if>
    </select>
    <select id="accountExpenseExport" resultType="com.ruoyi.account.pojo.AccountExpense">
        SELECT
        *
        FROM account_expense
        where
        1=1
        <if test="accountExpense.entryDateStart != null and accountExpense.entryDateStart != '' ">
            AND expense_date &gt;= DATE_FORMAT(#{accountExpense.entryDateStart},'%Y-%m-%d')
        </if>
        <if test="accountExpense.entryDateEnd != null and accountExpense.entryDateEnd != '' ">
            AND  expense_date &lt;= DATE_FORMAT(#{accountExpense.entryDateEnd},'%Y-%m-%d')
        </if>
        <if test="accountExpense.expenseType != null and accountExpense.expenseType != '' ">
            AND expense_type = #{accountExpense.expenseType}
        </if>
        <if test="accountExpense.expenseMethod != null and accountExpense.expenseMethod != '' ">
            AND expense_method = #{accountExpense.expenseMethod}
        </if>
    </select>
    <select id="report" resultType="com.ruoyi.account.dto.AccountDto2">
        SELECT
        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'
        where
        1=1
        <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>
        group by expense_type
    </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>
 
</mapper>