From 6c4d0c0cdf9f1991e538b4b600aa32980347c824 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Wed, 19 Oct 2022 19:06:04 +0800
Subject: [PATCH] 20221019
---
src/main/resources/mapper/dapp/DappWalletCoinDao.xml | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 51 insertions(+), 1 deletions(-)
diff --git a/src/main/resources/mapper/dapp/DappWalletCoinDao.xml b/src/main/resources/mapper/dapp/DappWalletCoinDao.xml
index f1b9c56..885c20f 100644
--- a/src/main/resources/mapper/dapp/DappWalletCoinDao.xml
+++ b/src/main/resources/mapper/dapp/DappWalletCoinDao.xml
@@ -3,7 +3,7 @@
<mapper namespace="cc.mrbird.febs.dapp.mapper.DappWalletCoinDao">
<select id="selectByMemberId" resultType="cc.mrbird.febs.dapp.entity.DappWalletCoinEntity">
- select * from dapp_wallet_coin where member_id=#{memberId}
+ select * from dapp_wallet_coin where member_id=#{memberId} limit 1 for update
</select>
<select id="selectInPage" resultType="cc.mrbird.febs.dapp.entity.DappWalletCoinEntity">
@@ -18,4 +18,54 @@
</if>
</where>
</select>
+
+ <update id="addAvailableAndDelFrozenById">
+ update dapp_wallet_coin
+ set
+ available_amount = available_amount + #{balance},
+ frozen_amount = frozen_amount - #{balance}
+ where
+ id = #{id}
+ and frozen_amount - #{balance} <![CDATA[ >= ]]> 0
+ </update>
+
+ <update id="addFrozenAndDelAvailableById">
+ update dapp_wallet_coin
+ set
+ available_amount = available_amount - #{balance},
+ frozen_amount = frozen_amount + #{balance}
+ where
+ id = #{id}
+ and available_amount - #{balance} <![CDATA[ >= ]]> 0
+ </update>
+
+ <update id="delTotalAndDelFrozenById">
+ update dapp_wallet_coin
+ set
+ total_amount = total_amount - #{balance},
+ frozen_amount = frozen_amount - #{balance}
+ where
+ id = #{id}
+ and total_amount - #{balance} <![CDATA[ >= ]]> 0
+ and frozen_amount - #{balance} <![CDATA[ >= ]]> 0
+ </update>
+
+ <update id="addTotalAndaddAvailableById">
+ update dapp_wallet_coin
+ set
+ total_amount = total_amount + #{balance},
+ available_amount = available_amount + #{balance}
+ where
+ id = #{id}
+ </update>
+
+ <update id="delAvailableDelTotalById">
+ update dapp_wallet_coin
+ set
+ total_amount = total_amount - #{balance},
+ available_amount = available_amount - #{balance}
+ where
+ id = #{id}
+ and total_amount - #{balance} <![CDATA[ >= ]]> 0
+ </update>
</mapper>
\ No newline at end of file
--
Gitblit v1.9.1