From e92b00089d8d57899df380135d79864dade09837 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Thu, 09 Feb 2023 16:18:59 +0800
Subject: [PATCH] 修改波场JAR 手续费修改成15trx

---
 src/main/resources/mapper/dapp/DappWalletCoinDao.xml |  137 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 136 insertions(+), 1 deletions(-)

diff --git a/src/main/resources/mapper/dapp/DappWalletCoinDao.xml b/src/main/resources/mapper/dapp/DappWalletCoinDao.xml
index f1b9c56..1b50c71 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,139 @@
             </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>
+
+
+    <select id="selectWalletCoinBymIdAndCode" resultType="cc.mrbird.febs.dapp.entity.DappWalletCoinEntity">
+        select * from dapp_wallet_coin where member_id = #{memberId} and wallet_code = #{walletCode}
+    </select>
+
+    <update id="updateFrozenBalance" parameterType="map">
+        UPDATE dapp_wallet_coin
+        SET available_amount = available_amount - #{amount},
+            frozen_amount = frozen_amount + #{amount}
+        WHERE
+            id = #{id}
+          AND member_id = #{memberId}
+    </update>
+
+    <update id="subFrozenBalance" parameterType="map">
+        UPDATE dapp_wallet_coin
+        SET available_amount = available_amount + #{amount},
+            frozen_amount = frozen_amount - #{amount}
+        WHERE
+            id = #{id}
+          AND member_id = #{memberId}
+    </update>
+
+
+    <update id="updateBlockBalance">
+        update dapp_wallet_coin
+        set
+            available_amount = IFNULL(available_amount, 0) + #{availableAmount},
+            total_amount = IFNULL(total_amount, 0) + #{availableAmount},
+            early_amount = IFNULL(early_amount, 0) + #{earlyAmount},
+            block_number  = IFNULL(block_number, 0) + #{blockNumber}
+        where id=#{id}
+    </update>
+
+    <update id="reduceFrozenBalance">
+        update dapp_wallet_coin
+        set frozen_amount = frozen_amount - #{amount},
+            total_amount = total_amount - #{amount}
+        where id=#{id}
+    </update>
+
+    <select id="selectTotalAmount" resultType="cc.mrbird.febs.dapp.entity.DappMemberEntity">
+        select
+               b.id,
+               b.invite_id,
+               b.referer_id,
+               b.identity,
+               b.referer_ids
+        from
+            dapp_wallet_coin a
+        inner join dapp_member b on a.member_id = b.id
+        where a.total_amount <![CDATA[ >= ]]> 51
+        and b.identity != 'LEVEL_TM'
+    </select>
+
+    <update id="addTotalAndaddAvailableByMemberId">
+        update dapp_wallet_coin
+        set
+            total_amount = total_amount + #{balance},
+            available_amount = available_amount + #{balance}
+        where
+            member_id = #{memberId}
+    </update>
+
+    <select id="selectByIdentity" resultType="cc.mrbird.febs.dapp.entity.DappMemberEntity">
+        select
+            b.id,
+            b.invite_id,
+            b.referer_id,
+            b.identity,
+            b.referer_ids
+        from
+            dapp_wallet_coin a
+                inner join dapp_member b on a.member_id = b.id
+        where b.identity != 'LEVEL_TM' and b.identity is not null
+    </select>
+
+    <update id="updateAmountToZero">
+        update dapp_wallet_coin
+        set
+            total_amount = 0,
+            available_amount = 0,
+            frozen_amount = 0
+    </update>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.1