From e7b0de5c535ee7750c80f15ce662b72a46b42400 Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Mon, 10 Apr 2023 09:58:56 +0800 Subject: [PATCH] 设置内转开关 --- src/main/resources/mapper/modules/MallMemberWalletMapper.xml | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 49 insertions(+), 1 deletions(-) diff --git a/src/main/resources/mapper/modules/MallMemberWalletMapper.xml b/src/main/resources/mapper/modules/MallMemberWalletMapper.xml index fb94670..1556a5c 100644 --- a/src/main/resources/mapper/modules/MallMemberWalletMapper.xml +++ b/src/main/resources/mapper/modules/MallMemberWalletMapper.xml @@ -3,7 +3,7 @@ <mapper namespace="cc.mrbird.febs.mall.mapper.MallMemberWalletMapper"> <select id="selectWalletByMemberId" resultType="cc.mrbird.febs.mall.entity.MallMemberWallet"> - select * from mall_member_wallet where member_id=#{memberId} + select * from mall_member_wallet where member_id=#{memberId} for update </select> <update id="updateBalanceWithVersion"> @@ -12,4 +12,52 @@ balance = #{record.balance} where id=#{record.id} and revision=#{record.revision} </update> + + <update id="updateCommissionWithVersion"> + update mall_member_wallet + set revision = revision + 1, + commission = #{record.commission} + where id=#{record.id} and revision=#{record.revision} + </update> + + <update id="updateBalanceWithId"> + update mall_member_wallet + set revision = revision + 1, + balance = #{record.balance} + where id=#{record.id} + </update> + + <update id="updateAmountWithVersion"> + update mall_member_wallet + set revision = revision + 1 + <if test="record.balance != null"> + , balance = #{record.balance} + </if> + <if test="record.score != null"> + , score = #{record.score} + </if> + <if test="record.prizeScore != null"> + , prize_score = #{record.prizeScore} + </if> + <if test="record.commission != null"> + , commission = #{record.commission} + </if> + where id=#{record.id} and revision=#{record.revision} + </update> + + <select id="selectSumBalance" resultType="java.math.BigDecimal"> + select ifnull(sum(balance),0) total from mall_member_wallet + </select> + + <select id="selectSumScore" resultType="java.math.BigDecimal"> + select ifnull(sum(score),0) total from mall_member_wallet + </select> + + <select id="selectSumPrizeScore" resultType="java.math.BigDecimal"> + select ifnull(sum(prize_score),0) total from mall_member_wallet + </select> + + <select id="selectSumCommission" resultType="java.math.BigDecimal"> + select ifnull(sum(commission),0) total from mall_member_wallet + </select> </mapper> \ No newline at end of file -- Gitblit v1.9.1