fix: 日常支出统计,代码提交。

This commit is contained in:
tianyongbao
2024-07-16 14:39:50 +08:00
parent c9db02cc26
commit 538765b2c2
6 changed files with 129 additions and 2 deletions

View File

@@ -67,6 +67,7 @@
<result property="accountName" column="account_name" />
<result property="transferRecordId" column="transfer_record_id" />
<result property="currentBalance" column="current_balance" />
<result property="childCategory" column="child_category" />
</resultMap>
<select id="selectAccountsOutInList" parameterType="AccountsDealRecordDto" resultMap="AccountsDealRecordResult">
@@ -151,5 +152,27 @@
${params.dataScope}
order by a.create_time desc
</select>
<select id="selectDailyExpensesList" parameterType="AccountsDealRecordDto" resultMap="AccountsDealRecordResult">
select
sum(a.amount) as amount ,
a.child_category
from
accounts_deal_record a
<where>
a.deal_category = '1'
<if test="endTime!=null and endTime !=''">
and #{endTime}>=to_char(a.create_time, 'yyyy-MM-dd')
</if>
<if test="startTime!=null and startTime !=''">
and to_char(a.create_time, 'yyyy-MM-dd')>=#{startTime}
</if>
<if test="accountId != null and accountId != ''"> and a.account_id = #{accountId}</if>
<if test="childCategory != null and childCategory != ''"> and a.child_category = #{childCategory}</if>
</where>
<!-- 数据范围过滤 -->
${params.dataScope}
group by
a.child_category
order by a.child_category asc
</select>
</mapper>