Helius
2021-11-24 be6f79a634727b59c6a40e3fffa989b5de1b0ec7
src/main/resources/mapper/fish/MemberAccountGoldDao.xml
New file
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xcong.excoin.modules.fish.dao.MemberAccountGoldDao">
    <select id="selectAccountGoldByMemberId" resultType="com.xcong.excoin.modules.fish.entity.MemberAccountGold">
        select a.* from member_account_gold a where a.member_id = #{memberId}
    </select>
    <update id="updateTotalBalanceAndAvailableBalance" parameterType="map">
        update member_account_gold
        <set>
            <if test="availableBalance != null">
                available_balance = (
                case when  IFNULL(available_balance, 0) + #{available_balance}>0 then  IFNULL(available_balance, 0) + #{availableBalance} else 0 end
                ),
            </if>
            <if test="totalBalance != null">
                total_balance = (
                case when  IFNULL(total_balance, 0) + #{totalBalance}>0 then  IFNULL(total_balance, 0) + #{totalBalance} else 0 end
                ),
            </if>
            <if test="frozenBalance != null">
                frozen_balance = (
                case when  IFNULL(frozen_balance, 0) + #{frozenBalance}>0 then  IFNULL(frozen_balance, 0) + #{frozenBalance} else 0 end
                ),
            </if>
        </set>
        where id=#{id}
    </update>
    <select id="selectAccountGoldVoByMemberId" resultType="com.xcong.excoin.modules.fish.vo.GoldAccountVo">
        select a.* from member_account_gold a where a.member_id = #{memberId}
    </select>
</mapper>