|  |  |  | 
|---|
|  |  |  | <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, | 
|---|
|  |  |  | 
|---|
|  |  |  | IFNULL(c.total_score,0) totalScore, | 
|---|
|  |  |  | IFNULL(c.voucher_cnt,0) voucherCnt, | 
|---|
|  |  |  | IFNULL(c.voucher_amount,0) voucherAmount, | 
|---|
|  |  |  | d.description levelName | 
|---|
|  |  |  | IFNULL(c.voucher_fire_cnt,0) voucherFireCnt, | 
|---|
|  |  |  | (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 | 
|---|
|  |  |  | 
|---|
|  |  |  | <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 ( | 
|---|
|  |  |  | 
|---|
|  |  |  | 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> | 
|---|
|  |  |  | 
|---|
|  |  |  | <select id="selectTeamListByInviteId" resultType="cc.mrbird.febs.mall.vo.TeamListVo"> | 
|---|
|  |  |  | select | 
|---|
|  |  |  | a.id, | 
|---|
|  |  |  | a.name, | 
|---|
|  |  |  | a.phone, | 
|---|
|  |  |  | a.account_login name, | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | 
|---|
|  |  |  | (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> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | left join data_dictionary_custom a on a.code = m.level | 
|---|
|  |  |  | <where> | 
|---|
|  |  |  | <if test="record != null" > | 
|---|
|  |  |  | <if test="record.accountLogin!=null and record.accountLogin!=''"> | 
|---|
|  |  |  | and m.account_login like concat('%',  #{record.accountLogin},'%') | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="record.name!=null and record.name!=''"> | 
|---|
|  |  |  | and m.name like concat('%',  #{record.name},'%') | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | 
|---|
|  |  |  | SELECT a.id,d.code levelCode | 
|---|
|  |  |  | FROM mall_member a | 
|---|
|  |  |  | LEFT JOIN data_dictionary_custom d on d.code = a.level | 
|---|
|  |  |  | where a.id = #{id} and d.type = 'AGENT_LEVEL_REQUIRE' | 
|---|
|  |  |  | where a.id = #{id} and d.type = 'AGENT_LEVEL' | 
|---|
|  |  |  | GROUP BY a.id | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | </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} | 
|---|
|  |  |  | 
|---|
|  |  |  | <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"> | 
|---|
|  |  |  | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </where> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="selectByLevel" resultType="cc.mrbird.febs.mall.entity.MallMember"> | 
|---|
|  |  |  | select * from mall_member | 
|---|
|  |  |  | where level = #{level} | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="selectByAccountLogin" resultType="cc.mrbird.febs.mall.entity.MallMember"> | 
|---|
|  |  |  | select * from mall_member | 
|---|
|  |  |  | where account_login = #{accountLogin} | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="selectInfoByAccountLoginAndPwd" resultType="cc.mrbird.febs.mall.entity.MallMember"> | 
|---|
|  |  |  | 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.static_nft staticNft, | 
|---|
|  |  |  | b.trends_nft trendsNft, | 
|---|
|  |  |  | b.frozen_nft frozenNft, | 
|---|
|  |  |  | b.fcm_cnt_ava fcmCntAva, | 
|---|
|  |  |  | b.fcm_cnt_frozen fcmCntFrozen, | 
|---|
|  |  |  | b.token_ava tokenAva, | 
|---|
|  |  |  | b.total_perk totalPerk, | 
|---|
|  |  |  | b.token_frozen tokenFrozen, | 
|---|
|  |  |  | a.account_login referrerName, | 
|---|
|  |  |  | d.description levelName | 
|---|
|  |  |  | FROM mall_member m | 
|---|
|  |  |  | left join mall_member a on m.referrer_id = a.invite_id | 
|---|
|  |  |  | left join mall_member_amount b on b.member_id = m.id | 
|---|
|  |  |  | LEFT JOIN data_dictionary_custom d on d.code = m.level and d.type = m.level | 
|---|
|  |  |  | <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_amount 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.*, | 
|---|
|  |  |  | 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> | 
|---|