| | |
| | | <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> |
| | |
| | | <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> |
| | |
| | | <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 ae.expense_type, sdd.dict_label |
| | | </select> |
| | | |
| | | <select id="report1" resultType="java.math.BigDecimal"> |
| | |
| | | </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 >= DATE_FORMAT(#{dateQueryDto.entryDateStart},'%Y-%m-%d') |
| | | </if> |
| | | <if test="dateQueryDto.entryDateEnd != null and dateQueryDto.entryDateEnd != ''"> |
| | | AND ae.expense_date <= 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 >= DATE_FORMAT(#{dateQueryDto.entryDateStart},'%Y-%m-%d') |
| | | </if> |
| | | <if test="dateQueryDto.entryDateEnd != null and dateQueryDto.entryDateEnd != ''"> |
| | | AND ae.expense_date <= 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> |