update 修复订单定时任务问题

This commit is contained in:
yyb
2026-01-27 15:54:17 +08:00
parent 1c52a34519
commit 93ebbe4074
8 changed files with 334 additions and 34 deletions

View File

@@ -106,29 +106,57 @@
)
</select>
<select id="selectBuyerWalletsByPayRecords" resultType="com.m2pool.lease.dto.BuyerWalletQueryDto">
SELECT
id,
auth_id as authId,
from_address as fromAddress,
balance,
blocked_balance as blockedBalance,
to_address as toAddress,
from_symbol as fromSymbol,
from_chain as fromChain,
to_symbol as toSymbol,
to_chain as toChain,
blocked_balance as `lock`
FROM lease_user_wallet_data
WHERE del = 0
AND (from_address, from_symbol, from_chain) IN (
<foreach collection="list" item="item" separator=",">
(#{item.fromAddress}, #{item.fromSymbol}, #{item.fromChain})
</foreach>
)
</select>
<update id="updateBalanceAndBlockBalance">
<update id="updateBalanceAndBlockBalanceById">
UPDATE lease_user_wallet_data
SET balance = CASE
<foreach collection="list" item="item">
WHEN from_address = #{item.fromAddress} AND from_symbol = #{item.fromSymbol} AND from_chain = #{item.fromChain} AND del = false
THEN balance - #{item.realAmount}
WHEN id = #{item.id}
THEN #{item.balance}
</foreach>
ELSE balance
END,
blocked_balance = CASE
<foreach collection="list" item="item">
WHEN from_address = #{item.fromAddress} AND from_symbol = #{item.fromSymbol} AND from_chain = #{item.fromChain} AND del = false
THEN blocked_balance - #{item.blockAmount}
WHEN id = #{item.id}
THEN #{item.blockedBalance}
</foreach>
ELSE blocked_balance
END
WHERE (from_address, from_symbol, from_chain) IN (
WHERE id IN (
<foreach collection="list" item="item" separator=",">
(#{item.fromAddress}, #{item.fromSymbol}, #{item.fromChain})
#{item.id}
</foreach>
)
AND del = false
AND blocked_balance = CASE
<foreach collection="list" item="item">
WHEN id = #{item.id}
THEN #{item.lock}
</foreach>
ELSE blocked_balance
END
</update>
</mapper>