fix: 智聪记账管理,新增睡眠账户统计功能,优化展示余额。

This commit is contained in:
tianyongbao
2025-02-24 13:44:49 +08:00
parent 7459b877f7
commit ba23989d59
8 changed files with 211 additions and 2 deletions

View File

@@ -26,6 +26,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="debitType" column="debit_type" />
<result property="lendType" column="lend_type" />
<result property="status" column="status" />
<result property="recentDealTime" column="recent_deal_time" />
</resultMap>
<sql id="selectAccountsVo">
@@ -50,7 +52,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bcl.pay_date ,
bcl.credit_limit ,
bcl.debit_type,
bcl.lend_type
bcl.lend_type,
(select create_time from accounts_deal_record adr where adr.account_id=a.account_id
order by adr.create_time desc
limit 1
) as recent_deal_time
from
accounts a
left join bank_card_lend bcl on
@@ -68,7 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="state != null and state != ''"> and a.state = #{state}</if>
<if test="status != null and status != ''"> and a.status = #{status}</if>
<if test="accountId != null and accountId != ''"> and a.account_id = #{accountId}</if>
<if test="repayFlag != null and repayFlag != ''"> and bcl.debit_type in('1','2')</if>
<if test="repayFlag != null and repayFlag != ''"> and bcl.debit_type in('1','2') </if>
</where>
<!-- 数据范围过滤 -->
${params.dataScope}

View File

@@ -798,5 +798,101 @@
t.oneMonthCount desc
</select>
<resultMap type="AccountsVo" id="AccountsResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="type" column="type" />
<result property="code" column="code" />
<result property="balance" column="balance" />
<result property="creditLimit" column="credit_limit" />
<result property="availableLimit" column="available_limit" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="delFlag" column="del_flag" />
<result property="remark" column="remark" />
<result property="accountId" column="account_id" />
<result property="state" column="state" />
<result property="billDate" column="bill_date" />
<result property="payDate" column="pay_date" />
<result property="creditLimit" column="credit_limit" />
<result property="debitType" column="debit_type" />
<result property="lendType" column="lend_type" />
<result property="status" column="status" />
<result property="recentDealTime" column="recent_deal_time" />
</resultMap>
<select id="selectAccountsList" parameterType="AccountsDto" resultMap="AccountsResult">
select
t.*
from
(
select
a.id,
a.name,
a.type,
a.code,
a.balance,
a.credit_limit,
a.available_limit,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
a.del_flag,
a.remark,
a.account_id,
a.state,
a.status,
bcl.bill_date ,
bcl.pay_date ,
bcl.credit_limit ,
bcl.debit_type,
bcl.lend_type,
case
when (
select
create_time
from
accounts_deal_record adr
where
adr.account_id = a.account_id
order by
adr.create_time desc
limit 1
) is null then a.create_time
else
(
select
create_time
from
accounts_deal_record adr
where
adr.account_id = a.account_id
order by
adr.create_time desc
limit 1
)
end
as recent_deal_time
from
accounts a
left join bank_card_lend bcl on
bcl.id = a.id
<where>
a.del_flag='0'
and ( a.type ='1')
and( a.status != '2' and a.status != '0')
<if test="name != null and name != ''">and a.name like '%'|| #{name}||'%'</if>
<if test="accountId != null and accountId != ''"> and a.account_id = #{accountId}</if>
<if test="repayFlag != null and repayFlag != ''"> and bcl.debit_type in('1','2') </if>
</where>
<!-- 数据范围过滤 -->
${params.dataScope}
) t
order by t.recent_deal_time asc
</select>
</mapper>