From 78bbc1dae1bb20acb51fd454adf53b3ab5ae97b3 Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Fri, 23 Dec 2022 15:20:11 +0800 Subject: [PATCH] 20221221 --- src/main/resources/mapper/modules/MallMemberMapper.xml | 161 ++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 115 insertions(+), 46 deletions(-) diff --git a/src/main/resources/mapper/modules/MallMemberMapper.xml b/src/main/resources/mapper/modules/MallMemberMapper.xml index 73f4c11..de1dd5f 100644 --- a/src/main/resources/mapper/modules/MallMemberMapper.xml +++ b/src/main/resources/mapper/modules/MallMemberMapper.xml @@ -3,9 +3,12 @@ <mapper namespace="cc.mrbird.febs.mall.mapper.MallMemberMapper"> <select id="selectMallMemberListInPage" resultType="cc.mrbird.febs.mall.entity.MallMember"> - SELECT m.*,a.name referrerName,IFNULL(c.balance,0) balance FROM mall_member m + SELECT m.*,a.name referrerName,IFNULL(c.balance,0) balance,IFNULL(c.score,0) score,IFNULL(c.prize_score,0) prizeScore,IFNULL(c.commission,0) commission + ,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 + LEFT JOIN data_dictionary_custom d on d.code = m.level and type='AGENT_LEVEL' <where> <if test="record != null" > <if test="record.name!=null and record.name!=''"> @@ -25,6 +28,12 @@ <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 test="record.accountLevel!=null and record.accountLevel!=''"> + and m.account_level=#{record.accountLevel} + </if> </if> </where> order by m.CREATED_TIME desc @@ -41,16 +50,13 @@ a.account_status, a.CREATED_TIME, IFNULL(c.balance,0) balance, - IFNULL(c.score,0) score, - IFNULL(c.prize_score,0) prizeScore, d.description levelName, b.name FROM mall_member a LEFT JOIN mall_member b on a.referrer_id = b.invite_id LEFT JOIN mall_member_wallet c on c.member_id = a.id - LEFT JOIN data_dictionary_custom d on d.code = a.level + LEFT JOIN data_dictionary_custom d on d.description = a.level where a.id = #{id} - GROUP BY a.id </select> <select id="selectInfoByAccount" resultType="cc.mrbird.febs.mall.entity.MallMember"> @@ -71,18 +77,18 @@ a.name, a.phone, a.invite_id, + a.account_level, 2 isCurrent, a.created_time, - p.prize_score, (select sum(e.amount) from mall_order_info e inner join mall_member b on e.member_id=b.ID - inner join mall_order_item c on e.id = c.order_id and c.is_normal=2 - where e.status in (2, 3, 4) and e.order_type=1 and (b.invite_id=a.invite_id or b.referrer_id=a.invite_id)) amount, - (select count(1) from mall_member e - inner join mall_order_info b on e.id=b.member_id and b.status in (2, 3, 4) - where e.invite_id=a.invite_id or e.referrer_id=a.invite_id) orderCnt, - (select count(1) from mall_member x where x.referrer_id=a.invite_id) cnt + inner join mall_order_item c on e.id = c.order_id -- and c.is_normal=2 + where e.status = 4 and (b.invite_id=a.invite_id or b.referrer_id=a.invite_id)) amount, + (select count(1) from mall_order_info b + inner join mall_member e on e.id=b.member_id and b.status = 4 + where find_in_set(a.invite_id, e.referrer_ids)) orderCnt, + (select count(1) from mall_member x where 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 where a.referrer_id=#{inviteId} @@ -143,8 +149,9 @@ or find_in_set(m.invite_id, e.referrer_ids) ),0) amount FROM mall_member m - left join data_dictionary_custom a on a.code = m.level + left join data_dictionary_custom a on a.description = m.level <where> + and m.level != '代理' <if test="record != null" > <if test="record.name!=null and record.name!=''"> and m.name like concat('%', #{record.name},'%') @@ -180,19 +187,17 @@ <select id="getAgentLevelListInPage" resultType="cc.mrbird.febs.mall.vo.AdminAgentLevelVo"> SELECT - a.id,b.description name + a.id,a.description name FROM data_dictionary_custom a - left JOIN data_dictionary_custom b on a.code = b.code - where a.type = 'AGENT_LEVEL_REQUIRE' - GROUP BY a.id + where a.type = 'MEMBER_AGENT_LEVEL' ORDER BY a.CREATED_TIME DESC </select> <select id="getAgentChildInPage" resultType="cc.mrbird.febs.mall.vo.AdminAgentMemberVo"> select m.*,a.description levelName from mall_member m - left join data_dictionary_custom a on a.code = m.level + left join data_dictionary_custom a on a.description = m.level where find_in_set(#{record.inviteId}, m.referrer_ids) GROUP BY m.id ORDER BY @@ -255,10 +260,10 @@ <select id="getAgentLevelSetInfoByMemberId" resultType="cc.mrbird.febs.mall.vo.AdminAgentLevelSetInfoVo"> - SELECT a.id,d.code levelCode + SELECT d.description 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' + LEFT JOIN data_dictionary_custom d on d.description = a.level + where a.id = #{id} and d.type = 'MEMBER_AGENT_LEVEL' GROUP BY a.id </select> @@ -313,35 +318,34 @@ </select> <!-- <select id="selectRankListInPage" resultType="cc.mrbird.febs.mall.entity.MallMember">--> -<!-- select * from (--> -<!-- select a.id, a.name, a.invite_id, a.avatar, sum(b.amount) amount,max(order_time) orderTime from mall_member a, mall_order_info b--> -<!-- where a.id=b.member_id and b.status = 4--> -<!-- <!– 日 –>--> -<!-- <if test="record.query == '1'">--> - -<!-- </if>--> -<!-- <!– 月 –>--> -<!-- <if test="record.query == '2'">--> -<!-- and date_format(#{record.createdTime},'%Y-%m') = date_format(b.order_time,'%Y-%m')--> -<!-- </if>--> -<!-- <if test="record.amount != null">--> -<!-- and amount = #{record.amount}--> -<!-- </if>--> -<!-- group by a.id--> -<!-- ) a order by amount desc, a.orderTime desc--> +<!-- select a.*, b.*--> +<!-- from mall_member a--> +<!-- inner join (--> +<!-- select b.referrer_id refererId, sum(a.amount) amount, max(a.order_time) orderTime--> +<!-- from mall_order_info a--> +<!-- inner join mall_member b on a.member_id=b.ID--> +<!-- inner join mall_order_item c on a.id = c.order_id and c.is_normal=2--> +<!-- where a.status in (2, 3, 4) and a.order_type=1--> +<!-- <!– 月 –>--> +<!-- <if test="record.query == '2'">--> +<!-- and date_format(#{record.createdTime},'%Y-%m') = date_format(b.order_time,'%Y-%m')--> +<!-- </if>--> +<!-- group by b.referrer_id--> +<!-- ) b on a.invite_id=b.refererId--> +<!-- order by b.amount desc, b.orderTime desc--> <!-- </select>--> + <select id="selectRankListInPage" resultType="cc.mrbird.febs.mall.entity.MallMember"> select a.*, b.* from mall_member a inner join ( - select b.referrer_id refererId, sum(a.amount) amount, max(a.order_time) orderTime - from mall_order_info a + select b.referrer_id refererId, sum(a.amount) amount, max(a.pay_time) orderTime + from mall_achieve_record a inner join mall_member b on a.member_id=b.ID - inner join mall_order_item c on a.id = c.order_id and c.is_normal=2 - where a.status in (2, 3, 4) and a.order_type=1 + where 1=1 <!-- 月 --> - <if test="record.query == '2'"> - and date_format(#{record.createdTime},'%Y-%m') = date_format(b.order_time,'%Y-%m') + <if test="record.query == 2"> + and date_format(#{record.createdTime},'%Y-%m') = date_format(a.achieve_time,'%Y-%m') </if> group by b.referrer_id ) b on a.invite_id=b.refererId @@ -352,13 +356,13 @@ select IFNULL(sum(IFNULL(a.amount, 0)), 0) from mall_order_info a inner join mall_member b on a.member_id=b.ID - inner join mall_order_item c on a.id = c.order_id and c.is_normal=2 - where a.status in (2, 3, 4) and a.order_type=1 + where 1=1 + and a.status = 4 <if test="type == 1"> and b.invite_id=#{inviteId} </if> <if test="type == 2"> - and b.referrer_id=#{inviteId} + and find_in_set(#{inviteId}, b.referrer_ids) </if> </select> @@ -376,4 +380,69 @@ select * from mall_member where referrer_id=#{inviteId} and level != 'ZERO_LEVEL' </select> + + <select id="selectDirectorsOrStoreMaster" resultType="cc.mrbird.febs.mall.entity.MallMember"> + select * from mall_member + <where> + 1=1 + <if test="type == 1"> + and director = 1 + </if> + <if test="type == 2"> + and store_master = 1 + </if> + </where> + </select> + + <select id="selectMemberWithLevel" resultType="cc.mrbird.febs.mall.entity.MallMember"> + select * from mall_member + where level=#{level} + </select> + + <select id="selectByAccountLevel" resultType="cc.mrbird.febs.mall.entity.MallMember"> + select * from mall_member + where account_level = #{accountLevel} + </select> + + <select id="selectByRefererIdAndAccountLevel" resultType="java.lang.Integer"> + select count(id) from mall_member + where account_level != #{accountLevel} + and referer_id = #{refererId} + </select> + + <select id="selectByReferersIdAndAccountLevel" resultType="java.lang.Integer"> + select count(id) from mall_member + where account_level != #{accountLevel} + and FIND_IN_SET(#{inviteId}, referrer_ids) + </select> + + <update id="updateLevelById"> + update mall_member + set + level = #{level} + where + id = #{id} + </update> + + <select id="selectByReferersIdAndLevel" resultType="java.lang.Integer"> + select count(id) from mall_member + where level = #{level} + and FIND_IN_SET(#{inviteId}, referrer_ids) + </select> + + <update id="updateAccountLevelById"> + update mall_member + set + account_level = #{accountLevel} + where + id = #{id} + </update> + + <update id="updateLevelStatusById"> + update mall_member + set + level_status = #{levelStatus} + where + id = #{id} + </update> </mapper> \ No newline at end of file -- Gitblit v1.9.1