feat:余额统计

This commit is contained in:
dzc committed 2026-02-05 15:31:05 +08:00
1 parent 0e7cab1ab6
commit 46c9ce8325
1 file changed
+12 -5
@@ -193,14 +193,21 @@
</where>
</select>
<!-- FROM (-->
<!-- SELECT DISTINCT a.user_id,-->
<!-- m.wallet_type_id,-->
<!-- FIRST_VALUE(a.balance) OVER (-->
<!-- PARTITION BY a.user_id, m.wallet_type_id-->
<!-- ORDER BY a.create_time DESC-->
<!-- ) as balance-->
<select id="selectTotalBalance" resultType="java.lang.Long">
SELECT SUM(latest_balance.balance)
FROM (
SELECT DISTINCT a.user_id,
from (select distinct a.user_id,
m.wallet_type_id,
FIRST_VALUE(a.balance) OVER (
PARTITION BY a.user_id, m.wallet_type_id
ORDER BY a.create_time DESC
first_value(a.balance) over (
partition by a.user_id, m.wallet_type_id
order by a.create_time desc, a.id desc
) as balance
FROM wallet_transaction a
INNER JOIN wallet_manage m