| | |
| | | </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') |
| | | 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 |
| | |
| | | |
| | | <select id="selectAchieveByMemberId" resultType="java.math.BigDecimal"> |
| | | select IFNULL(sum(IFNULL(a.amount, 0)), 0) |
| | | from mall_order_info a |
| | | 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="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> |
| | | |
| | |
| | | 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> |
| | | </mapper> |