|
@@ -98,97 +98,39 @@
|
|
|
<select id="selectAllPromoterList" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
SELECT *
|
|
|
FROM (
|
|
|
- <if test="status == null or status == '' ">
|
|
|
- SELECT
|
|
|
- t1.promoter_id as 'promoterId',
|
|
|
- t1.promoter_nick_name as 'promoterNickName',
|
|
|
- user_name as 'userName',
|
|
|
- t1.commission_requirement as 'commissionRequirement',
|
|
|
- t1.promoter_url as 'promoterUrl',
|
|
|
- t1.fans_number as 'fansNumber',
|
|
|
- t2.30day_gmv as 'monthDayGmv',
|
|
|
- t2.30day_order_num as 'monthDayOrderNum',
|
|
|
- t2.valid_amount as 'validAmount'
|
|
|
- FROM
|
|
|
- kuaishou_promoter t1
|
|
|
- LEFT JOIN promoter_oerder_amount t2 ON t1.promoter_id = t2.promoter_id
|
|
|
- <where>
|
|
|
- <if test="promoterId != null ">
|
|
|
- and t1.promoter_id = #{promoterId}
|
|
|
- </if>
|
|
|
- <if test="promoterNickName != null and promoterNickName != ''">
|
|
|
- and t1.promoter_nick_name like concat('%', #{promoterNickName}, '%')
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- UNION ALL
|
|
|
- SELECT
|
|
|
- t1.promoter_id as 'promoterId',
|
|
|
- t1.promoter_name as 'promoterNickName',
|
|
|
- '-' as 'userName',
|
|
|
- '-' as 'commissionRequirement',
|
|
|
- t1.handurl as 'promoterUrl',
|
|
|
- t1.fans as 'fansNumber',
|
|
|
- t2.30day_gmv as 'monthDayGmv',
|
|
|
- t2.30day_order_num as 'monthDayOrderNum',
|
|
|
- t2.valid_amount as 'validAmount'
|
|
|
- FROM
|
|
|
- promoter_info t1
|
|
|
- LEFT JOIN promoter_oerder_amount t2 ON t1.promoter_id = t2.promoter_id
|
|
|
- WHERE
|
|
|
- NOT EXISTS ( SELECT 1 FROM kuaishou_promoter t3 WHERE t3.promoter_id = t1.promoter_id )
|
|
|
- <if test="promoterId != null ">
|
|
|
- and t1.promoter_id = #{promoterId}
|
|
|
- </if>
|
|
|
- <if test="promoterNickName != null and promoterNickName != ''">
|
|
|
- and t1.promoter_name like concat('%', #{promoterNickName}, '%')
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="status == 2 ">
|
|
|
- SELECT
|
|
|
- t1.promoter_id as 'promoterId',
|
|
|
- t1.promoter_name as 'promoterNickName',
|
|
|
- '-' as 'userName',
|
|
|
- '-' as 'commissionRequirement',
|
|
|
- t1.handurl as 'promoterUrl',
|
|
|
- t1.fans as 'fansNumber',
|
|
|
- t2.30day_gmv as 'monthDayGmv',
|
|
|
- t2.30day_order_num as 'monthDayOrderNum',
|
|
|
- t2.valid_amount as 'validAmount'
|
|
|
- FROM
|
|
|
- promoter_info t1
|
|
|
- LEFT JOIN promoter_oerder_amount t2 ON t1.promoter_id = t2.promoter_id
|
|
|
- WHERE NOT EXISTS
|
|
|
- (SELECT 1 FROM kuaishou_promoter t3 WHERE t3.promoter_id = t1.promoter_id)
|
|
|
+ SELECT t2.promoter_id as 'promoterId',
|
|
|
+ (case
|
|
|
+ when t2.promoter_id is null
|
|
|
+ then 2
|
|
|
+ else 1
|
|
|
+ end ) as 'status',
|
|
|
+ t2.promoter_nick_name as 'promoterNickName',
|
|
|
+ t2.userName as 'userName',
|
|
|
+ t2.commission_requirement as 'commissionRequirement',
|
|
|
+ t2.promoter_url as 'promoterUrl',
|
|
|
+ t2.fans_number as 'fansNumber',
|
|
|
+ t1.30day_gmv as 'monthDayGmv',
|
|
|
+ t1.30day_order_num as 'monthDayOrderNum',
|
|
|
+ t1.valid_amount as 'validAmount'
|
|
|
+ FROM promoter_oerder_amount t1
|
|
|
+ LEFT JOIN
|
|
|
+ (select promoter_id,
|
|
|
+ group_concat(user_name) as 'userName',
|
|
|
+ fans_number,
|
|
|
+ promoter_url,
|
|
|
+ commission_requirement,
|
|
|
+ promoter_nick_name
|
|
|
+ from kuaishou_promoter
|
|
|
+ group by promoter_id) t2
|
|
|
+ ON t1.promoter_id = t2.promoter_id
|
|
|
+ <where>
|
|
|
<if test="promoterId != null ">
|
|
|
and t1.promoter_id = #{promoterId}
|
|
|
</if>
|
|
|
<if test="promoterNickName != null and promoterNickName != ''">
|
|
|
- and t1.promoter_name like concat('%', #{promoterNickName}, '%')
|
|
|
+ and t2.promoter_nick_name like concat('%', #{promoterNickName}, '%')
|
|
|
</if>
|
|
|
- </if>
|
|
|
- <if test="status == 1">
|
|
|
- SELECT
|
|
|
- t1.promoter_id as 'promoterId',
|
|
|
- t1.promoter_nick_name as 'promoterNickName',
|
|
|
- user_name as 'userName',
|
|
|
- t1.commission_requirement as 'commissionRequirement',
|
|
|
- t1.promoter_url as 'promoterUrl',
|
|
|
- t1.fans_number as 'fansNumber',
|
|
|
- t2.30day_gmv as 'monthDayGmv',
|
|
|
- t2.30day_order_num as 'monthDayOrderNum',
|
|
|
- t2.valid_amount as 'validAmount'
|
|
|
- FROM
|
|
|
- kuaishou_promoter t1
|
|
|
- LEFT JOIN promoter_oerder_amount t2 on t1.promoter_id = t2.promoter_id
|
|
|
- <where>
|
|
|
- <if test="promoterId != null ">
|
|
|
- and t1.promoter_id = #{promoterId}
|
|
|
- </if>
|
|
|
- <if test="promoterNickName != null and promoterNickName != ''">
|
|
|
- and t1.promoter_nick_name like concat('%', #{promoterNickName}, '%')
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- </if>
|
|
|
+ </where>
|
|
|
) t order by ${parameter} ${orderBy}
|
|
|
</select>
|
|
|
|