| | |
| | | </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> |