|
@@ -27,6 +27,7 @@
|
|
|
<result property="monthDayGmv" column="30day_gmv"/>
|
|
|
<result property="monthDayOrderNum" column="30day_order_num"/>
|
|
|
<result property="validAmount" column="valid_amount"/>
|
|
|
+ <result property="followUpRecord" column="txt"/>
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectKuaishouPromoterVo">
|
|
@@ -94,39 +95,101 @@
|
|
|
order by ${parameter} ${orderBy}
|
|
|
</select>
|
|
|
|
|
|
- <select id="selectAllPromoterList" resultMap="KuaishouPromoterResult">
|
|
|
- SELECT
|
|
|
- t1.id,
|
|
|
- t1.user_id,
|
|
|
- t1.user_name,
|
|
|
- t1.promoter_id,
|
|
|
- t1.promoter_nick_name,
|
|
|
- t1.`state`,
|
|
|
- t1.province,
|
|
|
- t1.commission_requirement,
|
|
|
- t1.category_requirement,
|
|
|
- t1.promoter_url,
|
|
|
- t1.phone,
|
|
|
- t1.consignee,
|
|
|
- t1.promoter_address,
|
|
|
- t1.total_sale,
|
|
|
- t1.fans_number,
|
|
|
- t1.avg_video_sales,
|
|
|
- t1.video_sales,
|
|
|
- t1.create_time,
|
|
|
- t2.30day_gmv,
|
|
|
- t2.30day_order_num
|
|
|
- FROM
|
|
|
- kuaishou_promoter t1
|
|
|
- LEFT JOIN promoter_oerder_amount t2 on t1.promoter_id = t2.promoter_id
|
|
|
- where t2.30day_order_num > 0
|
|
|
- <if test="promoterId != null ">
|
|
|
- and t1.promoter_id = #{promoterId}
|
|
|
+ <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)
|
|
|
+ <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="promoterNickName != null and promoterNickName != ''">
|
|
|
- and t1.promoter_nick_name like concat('%', #{promoterNickName}, '%')
|
|
|
+ <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>
|
|
|
- order by ${parameter} ${orderBy}
|
|
|
+ ) t order by ${parameter} ${orderBy}
|
|
|
</select>
|
|
|
|
|
|
<select id="selectKuaishouPromoterById" parameterType="Long" resultMap="KuaishouPromoterResult">
|
|
@@ -140,9 +203,9 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="getBoundPromoterRoleKey" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
- SELECT t1.user_id,
|
|
|
- t3.role_key,
|
|
|
- t1.user_name
|
|
|
+ SELECT t1.user_id,
|
|
|
+ t3.role_key,
|
|
|
+ t1.user_name
|
|
|
FROM kuaishou_promoter t1
|
|
|
LEFT JOIN sys_user_role t2 ON t1.user_id = t2.user_id
|
|
|
LEFT JOIN sys_role t3 ON t2.role_id = t3.role_id
|
|
@@ -225,7 +288,6 @@
|
|
|
<if test="phone != null">phone,</if>
|
|
|
<if test="consignee != null">consignee,</if>
|
|
|
<if test="promoterAddress != null">promoter_address,</if>
|
|
|
-
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
<if test="userId != null">#{userId},</if>
|
|
@@ -247,6 +309,22 @@
|
|
|
</trim>
|
|
|
</insert>
|
|
|
|
|
|
+ <insert id="addFollowUpRecords">
|
|
|
+ insert into kuaishou_promoter_follow_up_record
|
|
|
+ (promoter_id,
|
|
|
+ user_id,
|
|
|
+ txt)
|
|
|
+ values (#{result.promoterId},
|
|
|
+ #{result.userId},
|
|
|
+ #{result.txt})
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateFollowUpRecords">
|
|
|
+ update kuaishou_promoter_follow_up_record
|
|
|
+ Set txt =#{result.txt}
|
|
|
+ where id = #{result.id}
|
|
|
+ </update>
|
|
|
+
|
|
|
<update id="updateKuaishouPromoter" parameterType="com.ruixuan.isc.entity.KuaishouPromoter">
|
|
|
update kuaishou_promoter
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
@@ -310,6 +388,21 @@
|
|
|
</foreach>
|
|
|
</delete>
|
|
|
|
|
|
+ <delete id="deletePromoterLabel" parameterType="Long">
|
|
|
+ delete
|
|
|
+ from kuaishou_promoter_label_rel
|
|
|
+ where promoter_id = #{promoterId}
|
|
|
+ AND user_id = #{userId}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <insert id="insertPromoterLabels">
|
|
|
+ insert into kuaishou_promoter_label_rel
|
|
|
+ (promoter_id,user_id, label_id)
|
|
|
+ values
|
|
|
+ <foreach collection="list" item="ent" separator=",">
|
|
|
+ (#{ent.promoterId},#{ent.userId}, #{ent.labelId})
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
<select id="getNearlyMonthGmv" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
SELECT SUM(order_amount) as 'orderAmount', CONCAT(IFNULL(ROUND((SELECT COUNT(1)
|
|
|
FROM kuaishou_item_collect_samples
|
|
@@ -341,4 +434,35 @@
|
|
|
</trim>
|
|
|
</insert>
|
|
|
|
|
|
+ <select id="getFollowUpRecordsByUserId" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
+ SELECT id,
|
|
|
+ txt
|
|
|
+ FROM kuaishou_promoter_follow_up_record
|
|
|
+ Where promoter_id = #{promoterId}
|
|
|
+ AND user_id = #{userId}
|
|
|
+ ORDER BY update_time DESC LIMIT 1
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getFollowUpRecordListByPromoterId" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
+ SELECT t1.id,
|
|
|
+ txt,
|
|
|
+ t2.nick_name as 'userName',
|
|
|
+ t1.update_time as 'updateTime'
|
|
|
+ FROM kuaishou_promoter_follow_up_record t1
|
|
|
+ LEFT JOIN sys_user t2 ON t1.user_id = t2.user_id
|
|
|
+ Where t1.promoter_id = #{promoterId}
|
|
|
+ <if test="id != null">
|
|
|
+ AND t1.id != #{id}
|
|
|
+ </if>
|
|
|
+ ORDER BY t1.update_time DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getPromoterLabel" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
+ SELECT t2.id as 'labelId', t2.label_colour as 'labelColour', t2.label_name as 'labelName'
|
|
|
+ FROM kuaishou_promoter_label_rel t1
|
|
|
+ LEFT JOIN kuaishou_label t2 ON t1.label_id = t2.id
|
|
|
+ WHERE t1.promoter_id = #{promoterId}
|
|
|
+ AND user_id = #{userId}
|
|
|
+ order by t2.id
|
|
|
+ </select>
|
|
|
</mapper>
|