yuan
10 天以前 ccc9d4533bc7b696f6d539720a6052abc44ff7a5
src/main/resources/mapper/account/AccountIncomeMapper.xml
@@ -20,6 +20,8 @@
        <if test="accountIncome.incomeMethod != null and accountIncome.incomeMethod != '' ">
            AND income_method = #{accountIncome.incomeMethod}
        </if>
        <!-- 2026-10-12 需求:收入管理按收入日期倒序 -->
        ORDER BY income_date DESC, id DESC
    </select>
    <select id="accountIncomeExport" resultType="com.ruoyi.account.pojo.AccountIncome">
        SELECT
@@ -43,7 +45,7 @@
    <select id="report" resultType="com.ruoyi.account.dto.AccountDto2">
        SELECT
        sdd.dict_label typeName,
        sum(income_money) account
        ifnull(sum(income_money),0) account
        FROM account_income ai
        left join sys_dict_data sdd on ai.income_type = sdd.dict_value and  sdd.dict_type='income_types'
        where
@@ -54,6 +56,32 @@
        <if test="dateQueryDto.entryDateEnd != null and dateQueryDto.entryDateEnd != '' ">
            AND income_date &lt;= DATE_FORMAT(#{dateQueryDto.entryDateEnd},'%Y-%m-%d')
        </if>
        group by income_type
        group by income_type, sdd.dict_label
    </select>
    <select id="report1" resultType="java.math.BigDecimal">
        SELECT
        ifnull(sum(income_money),0) account
        FROM account_income ai
        where
        income_type=#{dictValue}
        <if test="dateQueryDto.entryDateStart != null and dateQueryDto.entryDateStart != '' ">
            AND income_date &gt;= DATE_FORMAT(#{dateQueryDto.entryDateStart},'%Y-%m-%d')
        </if>
        <if test="dateQueryDto.entryDateEnd != null and dateQueryDto.entryDateEnd != '' ">
            AND income_date &lt;= DATE_FORMAT(#{dateQueryDto.entryDateEnd},'%Y-%m-%d')
        </if>
    </select>
    <select id="selectIncomeStats"
            resultType="com.ruoyi.home.dto.IncomeExpenseAnalysisDto">
        SELECT DATE_FORMAT(income_date, #{dateFormat}) AS dateStr,
               IFNULL(SUM(income_money), 0)            AS amount
        FROM account_income
        WHERE income_date BETWEEN #{startDate} AND #{endDate}
#           AND business_type = 1
        GROUP BY dateStr
        ORDER BY dateStr
    </select>
</mapper>