KKSU
2024-07-01 c3ed9a07b0765834136afb6400d350d895584b51
src/main/resources/mapper/modules/MallMemberMapper.xml
@@ -5,7 +5,7 @@
    <select id="selectMallMemberListInPage" resultType="cc.mrbird.febs.mall.entity.MallMember">
        SELECT
               m.*,
               a.name referrerName,
               a.account_login referrerName,
               IFNULL(c.balance,0) balance,
               IFNULL(c.score,0) score,
               IFNULL(c.prize_score,0) prizeScore,
@@ -15,7 +15,13 @@
               IFNULL(c.voucher_cnt,0) voucherCnt,
               IFNULL(c.voucher_amount,0) voucherAmount,
               IFNULL(c.voucher_fire_cnt,0) voucherFireCnt,
               d.description levelName
                (SELECT
        sum(IFNULL(surplus_cnt, 0))
        FROM
        mall_score_record
        WHERE
        member_id = m.id) voucherCntSurplus,
        d.description levelName
        FROM mall_member m
        left join mall_member a on m.referrer_id = a.invite_id
        LEFT JOIN mall_member_wallet c on c.member_id = m.id
@@ -77,6 +83,10 @@
        select * from mall_member where phone=#{account} or email=#{account} or invite_id=#{account}
    </select>
    <select id="selectInfoByAccountNew" resultType="cc.mrbird.febs.mall.entity.MallMember">
        select * from mall_member where phone = #{phone} and account_login = #{account}
    </select>
    <select id="selectInfoByInviteId" resultType="cc.mrbird.febs.mall.entity.MallMember">
        select * from mall_member where invite_id=#{inviteId}
    </select>
@@ -89,12 +99,9 @@
        select
            a.id,
            a.account_login name,
            a.phone,
            a.invite_id,
            2 isCurrent,
            a.created_time,
            p.prize_score,
            u.description levelName,
            (select sum(e.amount)
             from mall_order_info e
                      inner join mall_member b on e.member_id=b.ID
@@ -106,7 +113,6 @@
            (select count(1) from mall_member x where x.invite_id=a.invite_id or find_in_set(a.invite_id, x.referrer_ids)) cnt
        from mall_member a
        inner join mall_member_wallet p on a.id=p.member_id
        left join data_dictionary_custom u on a.level=u.code and u.type='AGENT_LEVEL'
        where a.referrer_id=#{inviteId}
    </select>
@@ -383,6 +389,50 @@
        </if>
    </select>
    <select id="selectAchieveBuyByMemberId" resultType="java.math.BigDecimal">
        select IFNULL(sum(IFNULL(a.nft_total, 0)), 0)
        from mall_product_buy a
             inner join mall_member b on a.member_id=b.ID
        where a.state = 3
        <if test="type == 1">
            and b.invite_id=#{inviteId}
        </if>
        <if test="type == 2">
            and find_in_set(#{inviteId}, b.referrer_ids)
        </if>
    </select>
    <select id="selectAchieveSellByMemberId" resultType="java.math.BigDecimal">
        select IFNULL(sum(IFNULL(a.nft_total, 0)), 0)
        from mall_product_sell a
             inner join mall_member b on a.member_id=b.ID
        where a.state = 3
        <if test="type == 1">
            and b.invite_id=#{inviteId}
        </if>
        <if test="type == 2">
            and find_in_set(#{inviteId}, b.referrer_ids)
        </if>
    </select>
    <select id="selectAchieveBuyOrderCntByMemberId" resultType="java.lang.Integer">
        select count(a.id)
        from mall_product_buy a
             inner join mall_member b on a.member_id=b.ID
        where a.state = 3
            and b.invite_id=#{inviteId}
            and find_in_set(#{inviteId}, b.referrer_ids)
    </select>
    <select id="selectAchieveSellOrderCntByMemberId" resultType="java.lang.Integer">
        select count(a.id)
        from mall_product_sell a
             inner join mall_member b on a.member_id=b.ID
        where a.state = 3
          and b.invite_id=#{inviteId}
          and find_in_set(#{inviteId}, b.referrer_ids)
    </select>
    <select id="selectMemberByName" resultType="cc.mrbird.febs.mall.entity.MallMember">
        select * from mall_member
        where name=#{name}
@@ -414,6 +464,12 @@
    <select id="selectMemberWithLevel" resultType="cc.mrbird.febs.mall.entity.MallMember">
        select * from mall_member
        where level=#{level}
    </select>
    <select id="selectMemberWithLevelAndMemberId" resultType="cc.mrbird.febs.mall.entity.MallMember">
        select * from mall_member
        where level=#{level}
        and find_in_set(#{inviteId}, referrer_ids)
    </select>
    <select id="selectMemberIdWithLevel" resultType="java.lang.Long">
@@ -467,4 +523,99 @@
        select * from mall_member
        where account_login = #{accountLogin} and password = #{password}
    </select>
    <select id="selectByUserKey" resultType="cc.mrbird.febs.mall.entity.MallMember">
        select * from mall_member
        where user_key = #{userKey}
    </select>
    <select id="selectAccountLoginAndUserKey" resultType="cc.mrbird.febs.mall.entity.MallMember">
        select * from mall_member
        where account_login = #{accountLogin} and user_key = #{userKey}
    </select>
    <select id="getFcmMallMemberList" resultType="cc.mrbird.febs.mall.vo.AdminMallMemberVo">
        SELECT
        m.*,
               b.balance balance,
        a.account_login referrerName
        FROM mall_member m
        left join mall_member a on m.referrer_id = a.invite_id
        left join mall_member_wallet b on b.member_id = m.id
        <where>
            <if test="record != null" >
                <if test="record.name!=null and record.name!=''">
                    and m.name like concat('%',  #{record.name},'%')
                </if>
                <if test="record.accountLogin!=null and record.accountLogin!=''">
                    and m.account_login like concat('%',  #{record.accountLogin},'%')
                </if>
                <if test="record.account!=null and record.account!=''">
                    and (
                    m.phone like concat('%',  #{record.account},'%')
                    or m.email like concat('%',  #{record.account},'%')
                    or m.bind_phone like concat('%',  #{record.account},'%')
                    or m.invite_id like concat('%',  #{record.account},'%')
                    )
                </if>
                <if test="record.accountStatus!=null">
                    and m.account_status = #{record.accountStatus}
                </if>
                <if test="record.accountType != null" >
                    and m.account_type = #{record.accountType}
                </if>
                <if test="record.level!=null and record.level!=''">
                    and m.level=#{record.level}
                </if>
            </if>
        </where>
        order by m.CREATED_TIME desc
    </select>
    <select id="getMallmemberAmountByMemberId" resultType="cc.mrbird.febs.mall.vo.MallMemberVo">
        SELECT a.*
        FROM mall_member_wallet a
        where a.member_id = #{memberId}
    </select>
    <select id="getMemberChargeListInPage" resultType="cc.mrbird.febs.mall.entity.MallMemberCharge">
        select
               a.*,
               b.account_login accountLogin
        from mall_member_charge a
        left join mall_member b on a.member_id = b.id
        <where>
            <if test="record.accountLogin!=null and record.accountLogin!=''">
                and b.account_login like concat('%',  #{record.accountLogin},'%')
            </if>
            <if test="record.address!=null and record.address!=''">
                and a.address like concat('%',  #{record.address},'%')
            </if>
            <if test="record.status!=null">
                and a.state = #{record.status}
            </if>
        </where>
        order by a.CREATED_TIME desc
    </select>
    <select id="getMemberWithDrawListInPage" resultType="cc.mrbird.febs.mall.entity.MallMemberWithdraw">
        select
               a.*,
               (a.amount + a.amount_fee) as amountReal,
               b.account_login accountLogin
        from mall_member_withdraw a
        left join mall_member b on a.member_id = b.id
        <where>
            <if test="record.accountLogin!=null and record.accountLogin!=''">
                and b.account_login like concat('%',  #{record.accountLogin},'%')
            </if>
            <if test="record.address!=null and record.address!=''">
                and a.remark like concat('%',  #{record.address},'%')
            </if>
            <if test="record.status!=null">
                and a.status = #{record.status}
            </if>
        </where>
        order by a.CREATED_TIME desc
    </select>
</mapper>