|
@@ -171,231 +171,195 @@
|
|
</update>
|
|
</update>
|
|
|
|
|
|
<select id="getKuaiShouGroupMessage" resultType="com.alibaba.fastjson.JSONObject">
|
|
<select id="getKuaiShouGroupMessage" resultType="com.alibaba.fastjson.JSONObject">
|
|
- select account_id as 'accountId',account_name as 'authName',MAX(create_time) as
|
|
|
|
- 'maxCreateTime',COUNT(IF(effective ='1', TRUE, NULL)) as 'valid',count(effective) as 'new',operating_name as
|
|
|
|
- 'userName','' as 'projectName'
|
|
|
|
- from ctop_new_monitor_group where ( create_time between #{startDate} and #{endDate})
|
|
|
|
- and account_id in
|
|
|
|
- <foreach item="item" collection="array" separator="," open="(" close=")" index="">
|
|
|
|
- #{item}
|
|
|
|
- </foreach>
|
|
|
|
|
|
+ SELECT
|
|
|
|
+ account_id AS 'accountId',
|
|
|
|
+ account_name AS 'authName',
|
|
|
|
+ MAX(stat_date) AS 'maxCreateTime',
|
|
|
|
+ '0' AS 'valid',
|
|
|
|
+ IFNULL(SUM(new_unit_num),0) AS 'new',
|
|
|
|
+ user_name AS 'userName'
|
|
|
|
+ FROM
|
|
|
|
+ application.app_kuaishou_account_base_info_d
|
|
|
|
+ WHERE stat_date >= #{startDate}
|
|
|
|
+ AND stat_date <= #{endDate}
|
|
|
|
+ <if test="array != null and array.size() > 0">
|
|
|
|
+ and account_id in
|
|
|
|
+ <foreach item="item" collection="array" separator="," open="(" close=")" index="">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
GROUP BY account_id
|
|
GROUP BY account_id
|
|
- order by account_id desc
|
|
|
|
|
|
+ order by `new` desc
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getPlanMessage" resultType="com.alibaba.fastjson.JSONObject">
|
|
<select id="getPlanMessage" resultType="com.alibaba.fastjson.JSONObject">
|
|
- select account_id as 'accountId',account_name as 'authName',MAX(create_time) as
|
|
|
|
- 'maxCreateTime',COUNT(IF(effective ='1', TRUE, NULL)) as 'valid',count(effective) as 'new',operating_name as
|
|
|
|
- 'userName','' as 'projectName'
|
|
|
|
- from ctop_new_monitor_campaign where ( create_time between #{startDate} and #{endDate}) and
|
|
|
|
- project_type=#{project}
|
|
|
|
- and account_id in
|
|
|
|
- <foreach item="item" collection="array" separator="," open="(" close=")" index="">
|
|
|
|
- #{item}
|
|
|
|
- </foreach>
|
|
|
|
|
|
+ SELECT
|
|
|
|
+ account_id AS 'accountId',
|
|
|
|
+ account_name AS 'authName',
|
|
|
|
+ MAX(stat_date) AS 'maxCreateTime',
|
|
|
|
+ '0' AS 'valid',
|
|
|
|
+ IFNULL(SUM(new_campaign_num),0) AS 'new',
|
|
|
|
+ user_name AS 'userName'
|
|
|
|
+ FROM
|
|
|
|
+ application.app_kuaishou_account_base_info_d
|
|
|
|
+ WHERE stat_date >= #{startDate}
|
|
|
|
+ AND stat_date <= #{endDate}
|
|
|
|
+ <if test="array != null and array.size() > 0">
|
|
|
|
+ and account_id in
|
|
|
|
+ <foreach item="item" collection="array" separator="," open="(" close=")" index="">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
GROUP BY account_id
|
|
GROUP BY account_id
|
|
- order by account_id desc
|
|
|
|
|
|
+ order by `new` desc
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="getKuaiShouGroupSum" resultType="com.alibaba.fastjson.JSONObject">
|
|
<select id="getKuaiShouGroupSum" resultType="com.alibaba.fastjson.JSONObject">
|
|
- SELECT COUNT(IF(t.effective ='1', TRUE, NULL)) as 'valid',COUNT(t.effective) as 'new' from
|
|
|
|
- ctop_new_monitor_group t
|
|
|
|
- where create_time between #{startDate} and #{endDate}
|
|
|
|
- and t.account_id in
|
|
|
|
- <foreach item="item" collection="array" separator="," open="(" close=")" index="">
|
|
|
|
- #{item}
|
|
|
|
- </foreach>
|
|
|
|
|
|
+ SELECT
|
|
|
|
+ IFNULL(SUM(new_unit_num),0) AS 'new',
|
|
|
|
+ '-' AS 'valid'
|
|
|
|
+ FROM
|
|
|
|
+ application.app_kuaishou_account_base_info_d
|
|
|
|
+ where stat_date >= #{startDate}
|
|
|
|
+ AND stat_date <= #{endDate}
|
|
|
|
+ <if test="array != null and array.size() > 0">
|
|
|
|
+ and account_id in
|
|
|
|
+ <foreach item="item" collection="array" separator="," open="(" close=")" index="">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="getPlanSum" resultType="com.alibaba.fastjson.JSONObject">
|
|
<select id="getPlanSum" resultType="com.alibaba.fastjson.JSONObject">
|
|
- SELECT COUNT(IF(t.effective ='1', TRUE, NULL)) as 'valid',COUNT(t.effective) as 'new' from
|
|
|
|
- ctop_new_monitor_campaign t
|
|
|
|
- where (create_time between #{startDate} and #{endDate}) and project_type=#{project}
|
|
|
|
- and t.account_id in
|
|
|
|
- <foreach item="item" collection="array" separator="," open="(" close=")" index="">
|
|
|
|
- #{item}
|
|
|
|
- </foreach>
|
|
|
|
|
|
+ SELECT IFNULL(SUM(new_campaign_num),0) AS 'new',
|
|
|
|
+ '-' AS 'valid'
|
|
|
|
+ FROM
|
|
|
|
+ application.app_kuaishou_account_base_info_d
|
|
|
|
+ where stat_date >= #{startDate}
|
|
|
|
+ AND stat_date <= #{endDate}
|
|
|
|
+ <if test="array != null and array.size() > 0">
|
|
|
|
+ and account_id in
|
|
|
|
+ <foreach item="item" collection="array" separator="," open="(" close=")" index="">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="getKuaiShouGroupMessageGroup" resultType="com.alibaba.fastjson.JSONObject">
|
|
<select id="getKuaiShouGroupMessageGroup" resultType="com.alibaba.fastjson.JSONObject">
|
|
SELECT
|
|
SELECT
|
|
<choose>
|
|
<choose>
|
|
<when test='group=="1"'>
|
|
<when test='group=="1"'>
|
|
- DATE_FORMAT(t.create_time,'%Y-%m') as 'statDate',
|
|
|
|
- </when>
|
|
|
|
- <otherwise>
|
|
|
|
- DATE_FORMAT(t.create_time,'%Y-%m-%d') as 'statDate',
|
|
|
|
- </otherwise>
|
|
|
|
- </choose>
|
|
|
|
- COUNT(t.effective) as 'new',COUNT(IF(t.effective ='1', TRUE, NULL)) as 'valid' from ctop_new_monitor_group t
|
|
|
|
- where (create_time between #{startDate} and #{endDate}) and t.account_id in
|
|
|
|
- <foreach item="item" collection="array" separator="," open="(" close=")" index="">
|
|
|
|
- #{item}
|
|
|
|
- </foreach>
|
|
|
|
- <choose>
|
|
|
|
- <when test='group=="1"'>
|
|
|
|
- GROUP BY DATE_FORMAT(t.create_time,'%Y-%m')
|
|
|
|
|
|
+ DATE_FORMAT(stat_date, '%Y-%m' ) AS 'statDate',
|
|
</when>
|
|
</when>
|
|
<otherwise>
|
|
<otherwise>
|
|
- GROUP BY DATE_FORMAT(t.create_time,'%Y-%m-%d')
|
|
|
|
|
|
+ DATE_FORMAT(stat_date, '%Y-%m-%d' ) AS 'statDate',
|
|
</otherwise>
|
|
</otherwise>
|
|
</choose>
|
|
</choose>
|
|
- order by t.create_time asc
|
|
|
|
|
|
+ IFNULL(SUM(new_unit_num),0) AS 'new',
|
|
|
|
+ '0' AS 'valid'
|
|
|
|
+ FROM application.app_kuaishou_account_base_info_d
|
|
|
|
+ where stat_date >= #{startDate}
|
|
|
|
+ AND stat_date <= #{endDate}
|
|
|
|
+ <if test="array != null and array.size() > 0">
|
|
|
|
+ and account_id in
|
|
|
|
+ <foreach item="item" collection="array" separator="," open="(" close=")" index="">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ GROUP BY
|
|
|
|
+ statDate
|
|
|
|
+ order by statDate asc
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="getPlanMessageGroup" resultType="com.alibaba.fastjson.JSONObject">
|
|
<select id="getPlanMessageGroup" resultType="com.alibaba.fastjson.JSONObject">
|
|
SELECT
|
|
SELECT
|
|
<choose>
|
|
<choose>
|
|
<when test='group=="1"'>
|
|
<when test='group=="1"'>
|
|
- DATE_FORMAT(t.create_time,'%Y-%m') as 'statDate',
|
|
|
|
- </when>
|
|
|
|
- <otherwise>
|
|
|
|
- DATE_FORMAT(t.create_time,'%Y-%m-%d') as 'statDate',
|
|
|
|
- </otherwise>
|
|
|
|
- </choose>
|
|
|
|
- COUNT(t.effective) as 'new',COUNT(IF(t.effective ='1', TRUE, NULL)) as 'valid' from ctop_new_monitor_campaign t
|
|
|
|
- where project_type=#{project} and (create_time between #{startDate} and #{endDate}) and t.account_id in
|
|
|
|
- <foreach item="item" collection="array" separator="," open="(" close=")" index="">
|
|
|
|
- #{item}
|
|
|
|
- </foreach>
|
|
|
|
- <choose>
|
|
|
|
- <when test='group=="1"'>
|
|
|
|
- GROUP BY DATE_FORMAT(t.create_time,'%Y-%m')
|
|
|
|
|
|
+ DATE_FORMAT(stat_date, '%Y-%m') AS 'statDate',
|
|
</when>
|
|
</when>
|
|
<otherwise>
|
|
<otherwise>
|
|
- GROUP BY DATE_FORMAT(t.create_time,'%Y-%m-%d')
|
|
|
|
|
|
+ DATE_FORMAT(stat_date, '%Y-%m-%d') AS 'statDate',
|
|
</otherwise>
|
|
</otherwise>
|
|
</choose>
|
|
</choose>
|
|
- order by t.create_time asc
|
|
|
|
|
|
+ IFNULL(SUM(new_campaign_num),0) AS 'new',
|
|
|
|
+ '0' AS 'valid'
|
|
|
|
+ FROM application.app_kuaishou_account_base_info_d
|
|
|
|
+ where stat_date >= #{startDate}
|
|
|
|
+ AND stat_date <= #{endDate}
|
|
|
|
+ <if test="array != null and array.size() > 0">
|
|
|
|
+ and account_id in
|
|
|
|
+ <foreach item="item" collection="array" separator="," open="(" close=")" index="">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ GROUP BY
|
|
|
|
+ statDate
|
|
|
|
+ order by statDate asc
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="getPlanSumBytedance" resultType="com.alibaba.fastjson.JSONObject">
|
|
<select id="getPlanSumBytedance" resultType="com.alibaba.fastjson.JSONObject">
|
|
- SELECT COUNT(IF(t.effective ='1', TRUE, NULL)) as 'valid',COUNT(t.effective)+
|
|
|
|
- (
|
|
|
|
- SELECT
|
|
|
|
- IFNULL(SUM(promotion_num),0)
|
|
|
|
- FROM application.app_bytedance_account_base_info_d
|
|
|
|
- WHERE stat_date >= DATE_FORMAT(#{startDate},'%Y%m%d')
|
|
|
|
- AND stat_date <=DATE_FORMAT(#{endDate},'%Y%m%d')
|
|
|
|
- AND user_id = #{userId}
|
|
|
|
- ) as 'new'
|
|
|
|
- from ctop_new_monitor_campaign t
|
|
|
|
- where (create_time between #{startDate} and #{endDate}) and project_type=#{project}
|
|
|
|
- and t.account_id in
|
|
|
|
- <foreach item="item" collection="array" separator="," open="(" close=")" index="">
|
|
|
|
- #{item}
|
|
|
|
- </foreach>
|
|
|
|
|
|
+ SELECT IFNULL(SUM(promotion_num),0) AS 'new',
|
|
|
|
+ '-' AS 'valid'
|
|
|
|
+ FROM
|
|
|
|
+ application.app_bytedance_account_base_info_d
|
|
|
|
+ where stat_date >= #{startDate}
|
|
|
|
+ AND stat_date <= #{endDate}
|
|
|
|
+ <if test="array != null and array.size() > 0">
|
|
|
|
+ and account_id in
|
|
|
|
+ <foreach item="item" collection="array" separator="," open="(" close=")" index="">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getPlanMessageGroupBytedance" resultType="com.alibaba.fastjson.JSONObject">
|
|
<select id="getPlanMessageGroupBytedance" resultType="com.alibaba.fastjson.JSONObject">
|
|
- SELECT t1.statDate,
|
|
|
|
- t1.promotionNum +IFNULL(t2.new,0) as 'new',
|
|
|
|
- IFNULL(t2.valid,0) as 'valid'
|
|
|
|
- FROM
|
|
|
|
- (
|
|
|
|
SELECT
|
|
SELECT
|
|
<choose>
|
|
<choose>
|
|
<when test='group=="1"'>
|
|
<when test='group=="1"'>
|
|
- DATE_FORMAT(stat_date,'%Y-%m') as 'statDate',
|
|
|
|
|
|
+ DATE_FORMAT(stat_date, '%Y-%m') AS 'statDate',
|
|
</when>
|
|
</when>
|
|
<otherwise>
|
|
<otherwise>
|
|
- DATE_FORMAT(stat_date,'%Y-%m-%d') as 'statDate',
|
|
|
|
|
|
+ DATE_FORMAT(stat_date, '%Y-%m-%d') AS 'statDate',
|
|
</otherwise>
|
|
</otherwise>
|
|
</choose>
|
|
</choose>
|
|
- IFNULL(SUM(promotion_num),0) as 'promotionNum'
|
|
|
|
|
|
+ IFNULL(SUM(promotion_num),0) AS 'new',
|
|
|
|
+ '0' AS 'valid'
|
|
FROM application.app_bytedance_account_base_info_d
|
|
FROM application.app_bytedance_account_base_info_d
|
|
- WHERE stat_date >= DATE_FORMAT(#{startDate},'%Y%m%d')
|
|
|
|
- AND stat_date <=DATE_FORMAT(#{endDate},'%Y%m%d')
|
|
|
|
- AND user_id = #{userId}
|
|
|
|
- <choose>
|
|
|
|
- <when test='group=="1"'>
|
|
|
|
- GROUP BY DATE_FORMAT(stat_date,'%Y-%m')
|
|
|
|
- </when>
|
|
|
|
- <otherwise>
|
|
|
|
- GROUP BY stat_date
|
|
|
|
- </otherwise>
|
|
|
|
- </choose>
|
|
|
|
- ) t1
|
|
|
|
- LEFT JOIN (
|
|
|
|
- SELECT
|
|
|
|
- <choose>
|
|
|
|
- <when test='group=="1"'>
|
|
|
|
- DATE_FORMAT(t.create_time,'%Y-%m') as 'statDate',
|
|
|
|
- </when>
|
|
|
|
- <otherwise>
|
|
|
|
- DATE_FORMAT(t.create_time,'%Y-%m-%d') as 'statDate',
|
|
|
|
- </otherwise>
|
|
|
|
- </choose>
|
|
|
|
- COUNT(t.effective) as 'new',COUNT(IF(t.effective ='1', TRUE, NULL)) as 'valid' from ctop_new_monitor_campaign t
|
|
|
|
- where project_type=#{project} and (create_time between #{startDate} and #{endDate}) and t.account_id in
|
|
|
|
- <foreach item="item" collection="array" separator="," open="(" close=")" index="">
|
|
|
|
- #{item}
|
|
|
|
- </foreach>
|
|
|
|
- <choose>
|
|
|
|
- <when test='group=="1"'>
|
|
|
|
- GROUP BY DATE_FORMAT(t.create_time,'%Y-%m')
|
|
|
|
- </when>
|
|
|
|
- <otherwise>
|
|
|
|
- GROUP BY DATE_FORMAT(t.create_time,'%Y-%m-%d')
|
|
|
|
- </otherwise>
|
|
|
|
- </choose>
|
|
|
|
- ) t2 ON t1.statDate = t2.statDate
|
|
|
|
- WHERE t1.promotionNum +IFNULL(t2.new,0) >0
|
|
|
|
- ORDER BY `statDate`
|
|
|
|
|
|
+ where stat_date >= #{startDate}
|
|
|
|
+ AND stat_date <= #{endDate}
|
|
|
|
+ <if test="array != null and array.size() > 0">
|
|
|
|
+ and account_id in
|
|
|
|
+ <foreach item="item" collection="array" separator="," open="(" close=")" index="">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ GROUP BY
|
|
|
|
+ statDate
|
|
|
|
+ order by statDate asc
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getPlanMessageBytedance" resultType="com.alibaba.fastjson.JSONObject">
|
|
<select id="getPlanMessageBytedance" resultType="com.alibaba.fastjson.JSONObject">
|
|
- SELECT * FROM (
|
|
|
|
- SELECT
|
|
|
|
- IFNULL(t2.account_id,t1.account_id) as 'accountId',
|
|
|
|
- IFNULL(t2.authName,t1.account_name) as 'authName',
|
|
|
|
- IFNULL(t2.maxCreateTime,statDate) as 'maxCreateTime',
|
|
|
|
- t1.promotionNum+IFNULL(t2.new,0) as 'new',
|
|
|
|
- IFNULL(t2.userName,t1.user_name) as 'userName',
|
|
|
|
- IFNULL(t2.valid ,0) as 'valid'
|
|
|
|
- FROM
|
|
|
|
- (
|
|
|
|
- SELECT
|
|
|
|
- account_id,
|
|
|
|
- account_name,
|
|
|
|
- user_name,
|
|
|
|
- DATE_FORMAT(stat_date,'%Y-%m-%d') as 'statDate',
|
|
|
|
- IFNULL(SUM(promotion_num),0) as 'promotionNum'
|
|
|
|
- FROM application.app_bytedance_account_base_info_d
|
|
|
|
- WHERE stat_date >= DATE_FORMAT(#{startDate},'%Y%m%d')
|
|
|
|
- AND stat_date <=DATE_FORMAT(#{endDate},'%Y%m%d')
|
|
|
|
- AND user_id = #{userId}
|
|
|
|
- GROUP BY account_id
|
|
|
|
- ) t1
|
|
|
|
- LEFT JOIN (
|
|
|
|
SELECT
|
|
SELECT
|
|
- account_id,
|
|
|
|
|
|
+ account_id AS 'accountId',
|
|
account_name AS 'authName',
|
|
account_name AS 'authName',
|
|
- MAX( create_time ) AS 'maxCreateTime',
|
|
|
|
- COUNT(
|
|
|
|
- IF
|
|
|
|
- ( effective = '1', TRUE, NULL )) AS 'valid',
|
|
|
|
- count( effective ) AS 'new',
|
|
|
|
- operating_name AS 'userName',
|
|
|
|
- '' AS 'projectName'
|
|
|
|
|
|
+ MAX(stat_date) AS 'maxCreateTime',
|
|
|
|
+ '0' AS 'valid',
|
|
|
|
+ IFNULL(SUM(promotion_num),0) AS 'new',
|
|
|
|
+ user_name AS 'userName'
|
|
FROM
|
|
FROM
|
|
- ctop_new_monitor_campaign
|
|
|
|
- WHERE
|
|
|
|
- (create_time between #{startDate} and #{endDate})
|
|
|
|
- and project_type=#{project}
|
|
|
|
- AND account_id IN
|
|
|
|
- <foreach item="item" collection="array" separator="," open="(" close=")" index="">
|
|
|
|
- #{item}
|
|
|
|
- </foreach>
|
|
|
|
- GROUP BY
|
|
|
|
- account_id
|
|
|
|
- ) t2 ON t1.account_id = t2.account_id
|
|
|
|
- ) t
|
|
|
|
- WHERE new >0
|
|
|
|
- ORDER BY maxCreateTime desc
|
|
|
|
|
|
+ application.app_bytedance_account_base_info_d
|
|
|
|
+ WHERE stat_date >= #{startDate}
|
|
|
|
+ AND stat_date <= #{endDate}
|
|
|
|
+ <if test="array != null and array.size() > 0">
|
|
|
|
+ and account_id in
|
|
|
|
+ <foreach item="item" collection="array" separator="," open="(" close=")" index="">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ GROUP BY account_id
|
|
|
|
+ order by `new` desc
|
|
</select>
|
|
</select>
|
|
-
|
|
|
|
</mapper>
|
|
</mapper>
|