|
@@ -13,11 +13,11 @@
|
|
application.bytedance_advertiser_report_hourly_dw
|
|
application.bytedance_advertiser_report_hourly_dw
|
|
WHERE stat_datetime = DATE_FORMAT(#{statDate},'%Y%m%d')
|
|
WHERE stat_datetime = DATE_FORMAT(#{statDate},'%Y%m%d')
|
|
<if test="accountIds !=null">
|
|
<if test="accountIds !=null">
|
|
- AND account_id in
|
|
|
|
- <foreach item="item" index="index" collection="accountIds"
|
|
|
|
- open="(" separator="," close=")">
|
|
|
|
- #{item}
|
|
|
|
- </foreach>
|
|
|
|
|
|
+ AND account_id in
|
|
|
|
+ <foreach item="item" index="index" collection="accountIds"
|
|
|
|
+ open="(" separator="," close=")">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
</if>
|
|
</if>
|
|
</select>
|
|
</select>
|
|
|
|
|
|
@@ -40,11 +40,11 @@
|
|
WHERE t1.stat_datetime = DATE_FORMAT(#{statDate}, '%Y%m%d' )
|
|
WHERE t1.stat_datetime = DATE_FORMAT(#{statDate}, '%Y%m%d' )
|
|
and t1.`hour` <= #{hour}
|
|
and t1.`hour` <= #{hour}
|
|
<if test="accountIds !=null">
|
|
<if test="accountIds !=null">
|
|
- AND t1.account_id IN
|
|
|
|
- <foreach item="item" index="index" collection="accountIds"
|
|
|
|
- open="(" separator="," close=")">
|
|
|
|
- #{item}
|
|
|
|
- </foreach>
|
|
|
|
|
|
+ AND t1.account_id IN
|
|
|
|
+ <foreach item="item" index="index" collection="accountIds"
|
|
|
|
+ open="(" separator="," close=")">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
</if>
|
|
</if>
|
|
group by t1.account_id
|
|
group by t1.account_id
|
|
order by ${target} ${order}
|
|
order by ${target} ${order}
|
|
@@ -62,11 +62,11 @@
|
|
stat_datetime = DATE_FORMAT(#{statDate},'%Y%m%d')
|
|
stat_datetime = DATE_FORMAT(#{statDate},'%Y%m%d')
|
|
and `hour` <= #{hour}
|
|
and `hour` <= #{hour}
|
|
<if test="accountIds !=null">
|
|
<if test="accountIds !=null">
|
|
- AND account_id in
|
|
|
|
- <foreach item="item" index="index" collection="accountIds"
|
|
|
|
- open="(" separator="," close=")">
|
|
|
|
- #{item}
|
|
|
|
- </foreach>
|
|
|
|
|
|
+ AND account_id in
|
|
|
|
+ <foreach item="item" index="index" collection="accountIds"
|
|
|
|
+ open="(" separator="," close=")">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
</if>
|
|
</if>
|
|
</select>
|
|
</select>
|
|
|
|
|
|
@@ -79,11 +79,11 @@
|
|
t1.stat_datetime = DATE_FORMAT(#{statDate},'%Y%m%d')
|
|
t1.stat_datetime = DATE_FORMAT(#{statDate},'%Y%m%d')
|
|
and t1.`hour` <= #{hour}
|
|
and t1.`hour` <= #{hour}
|
|
<if test="accountIds !=null">
|
|
<if test="accountIds !=null">
|
|
- AND t1.account_id in
|
|
|
|
- <foreach item="item" index="index" collection="accountIds"
|
|
|
|
- open="(" separator="," close=")">
|
|
|
|
- #{item}
|
|
|
|
- </foreach>
|
|
|
|
|
|
+ AND t1.account_id in
|
|
|
|
+ <foreach item="item" index="index" collection="accountIds"
|
|
|
|
+ open="(" separator="," close=")">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
</if>
|
|
</if>
|
|
</select>
|
|
</select>
|
|
|
|
|
|
@@ -99,11 +99,11 @@
|
|
WHERE
|
|
WHERE
|
|
stat_datetime = DATE_FORMAT(#{statDate},'%Y%m%d')
|
|
stat_datetime = DATE_FORMAT(#{statDate},'%Y%m%d')
|
|
<if test="accountIds !=null">
|
|
<if test="accountIds !=null">
|
|
- AND account_id in
|
|
|
|
- <foreach item="item" index="index" collection="accountIds"
|
|
|
|
- open="(" separator="," close=")">
|
|
|
|
- #{item}
|
|
|
|
- </foreach>
|
|
|
|
|
|
+ AND account_id in
|
|
|
|
+ <foreach item="item" index="index" collection="accountIds"
|
|
|
|
+ open="(" separator="," close=")">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
</if>
|
|
</if>
|
|
GROUP BY
|
|
GROUP BY
|
|
`hour`
|
|
`hour`
|
|
@@ -114,15 +114,15 @@
|
|
<select id="queryAllSumByStartEndDate" resultType="com.alibaba.fastjson.JSONObject">
|
|
<select id="queryAllSumByStartEndDate" resultType="com.alibaba.fastjson.JSONObject">
|
|
SELECT
|
|
SELECT
|
|
${filed}
|
|
${filed}
|
|
- FROM application.bytedance_advertiser_report_hourly_dw t1
|
|
|
|
|
|
+ FROM application.bytedance_advertiser_report_hourly_dw t1
|
|
WHERE t1.stat_datetime <=DATE_FORMAT(#{endDate},'%Y%m%d')
|
|
WHERE t1.stat_datetime <=DATE_FORMAT(#{endDate},'%Y%m%d')
|
|
AND t1.stat_datetime >= DATE_FORMAT(#{startDate},'%Y%m%d')
|
|
AND t1.stat_datetime >= DATE_FORMAT(#{startDate},'%Y%m%d')
|
|
<if test="accountIds !=null">
|
|
<if test="accountIds !=null">
|
|
- AND t1.account_id in
|
|
|
|
- <foreach item="item" index="index" collection="accountIds"
|
|
|
|
- open="(" separator="," close=")">
|
|
|
|
- #{item}
|
|
|
|
- </foreach>
|
|
|
|
|
|
+ AND t1.account_id in
|
|
|
|
+ <foreach item="item" index="index" collection="accountIds"
|
|
|
|
+ open="(" separator="," close=")">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
</if>
|
|
</if>
|
|
</select>
|
|
</select>
|
|
|
|
|
|
@@ -136,11 +136,11 @@
|
|
WHERE stat_datetime <= DATE_FORMAT(#{endDate},'%Y%m%d')
|
|
WHERE stat_datetime <= DATE_FORMAT(#{endDate},'%Y%m%d')
|
|
AND stat_datetime >= DATE_FORMAT(#{startDate},'%Y%m%d')
|
|
AND stat_datetime >= DATE_FORMAT(#{startDate},'%Y%m%d')
|
|
<if test="accountIds !=null">
|
|
<if test="accountIds !=null">
|
|
- AND account_id in
|
|
|
|
- <foreach item="item" index="index" collection="accountIds"
|
|
|
|
- open="(" separator="," close=")">
|
|
|
|
- #{item}
|
|
|
|
- </foreach>
|
|
|
|
|
|
+ AND account_id in
|
|
|
|
+ <foreach item="item" index="index" collection="accountIds"
|
|
|
|
+ open="(" separator="," close=")">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
</if>
|
|
</if>
|
|
</select>
|
|
</select>
|
|
|
|
|
|
@@ -150,16 +150,16 @@
|
|
t1.account_id as accountId,
|
|
t1.account_id as accountId,
|
|
t1.account_name as authName,
|
|
t1.account_name as authName,
|
|
${filed}
|
|
${filed}
|
|
- FROM application.bytedance_advertiser_report_hourly_dw t1
|
|
|
|
|
|
+ FROM application.bytedance_advertiser_report_hourly_dw t1
|
|
WHERE
|
|
WHERE
|
|
t1.stat_datetime <= DATE_FORMAT(#{endDate},'%Y%m%d')
|
|
t1.stat_datetime <= DATE_FORMAT(#{endDate},'%Y%m%d')
|
|
AND t1.stat_datetime >= DATE_FORMAT(#{startDate},'%Y%m%d')
|
|
AND t1.stat_datetime >= DATE_FORMAT(#{startDate},'%Y%m%d')
|
|
<if test="accountIds !=null">
|
|
<if test="accountIds !=null">
|
|
- AND t1.account_id in
|
|
|
|
- <foreach item="item" index="index" collection="accountIds"
|
|
|
|
- open="(" separator="," close=")">
|
|
|
|
- #{item}
|
|
|
|
- </foreach>
|
|
|
|
|
|
+ AND t1.account_id in
|
|
|
|
+ <foreach item="item" index="index" collection="accountIds"
|
|
|
|
+ open="(" separator="," close=")">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
</if>
|
|
</if>
|
|
group by t1.account_id
|
|
group by t1.account_id
|
|
order by ${target} ${order}
|
|
order by ${target} ${order}
|
|
@@ -172,16 +172,16 @@
|
|
t1.account_name as authName,
|
|
t1.account_name as authName,
|
|
${filed}
|
|
${filed}
|
|
FROM
|
|
FROM
|
|
- FROM application.bytedance_advertiser_report_hourly_dw t1
|
|
|
|
|
|
+ FROM application.bytedance_advertiser_report_hourly_dw t1
|
|
WHERE
|
|
WHERE
|
|
t1.stat_datetime <= DATE_FORMAT(#{endDate},'%Y%m%d')
|
|
t1.stat_datetime <= DATE_FORMAT(#{endDate},'%Y%m%d')
|
|
AND t1.stat_datetime >= DATE_FORMAT(#{startDate},'%Y%m%d')
|
|
AND t1.stat_datetime >= DATE_FORMAT(#{startDate},'%Y%m%d')
|
|
<if test="accountIds !=null">
|
|
<if test="accountIds !=null">
|
|
- AND t1.account_id in
|
|
|
|
- <foreach item="item" index="index" collection="accountIds"
|
|
|
|
- open="(" separator="," close=")">
|
|
|
|
- #{item}
|
|
|
|
- </foreach>
|
|
|
|
|
|
+ AND t1.account_id in
|
|
|
|
+ <foreach item="item" index="index" collection="accountIds"
|
|
|
|
+ open="(" separator="," close=")">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
</if>
|
|
</if>
|
|
group by t1.stat_datetime
|
|
group by t1.stat_datetime
|
|
order by ${target} ${order}
|
|
order by ${target} ${order}
|
|
@@ -199,11 +199,11 @@
|
|
WHERE stat_datetime <= DATE_FORMAT(#{endDate},'%Y%m%d')
|
|
WHERE stat_datetime <= DATE_FORMAT(#{endDate},'%Y%m%d')
|
|
AND stat_datetime >= DATE_FORMAT(#{startDate},'%Y%m%d')
|
|
AND stat_datetime >= DATE_FORMAT(#{startDate},'%Y%m%d')
|
|
<if test="accountIds !=null">
|
|
<if test="accountIds !=null">
|
|
- AND account_id in
|
|
|
|
- <foreach item="item" index="index" collection="accountIds"
|
|
|
|
- open="(" separator="," close=")">
|
|
|
|
- #{item}
|
|
|
|
- </foreach>
|
|
|
|
|
|
+ AND account_id in
|
|
|
|
+ <foreach item="item" index="index" collection="accountIds"
|
|
|
|
+ open="(" separator="," close=")">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
</if>
|
|
</if>
|
|
group by stat_datetime
|
|
group by stat_datetime
|
|
order by stat_datetime
|
|
order by stat_datetime
|
|
@@ -220,11 +220,11 @@
|
|
WHERE t1.stat_datetime <= DATE_FORMAT(#{endDate},'%Y%m%d')
|
|
WHERE t1.stat_datetime <= DATE_FORMAT(#{endDate},'%Y%m%d')
|
|
AND t1.stat_datetime >= DATE_FORMAT(#{startDate},'%Y%m%d')
|
|
AND t1.stat_datetime >= DATE_FORMAT(#{startDate},'%Y%m%d')
|
|
<if test="accountIds !=null">
|
|
<if test="accountIds !=null">
|
|
- AND t1.account_id in
|
|
|
|
- <foreach item="item" index="index" collection="accountIds"
|
|
|
|
- open="(" separator="," close=")">
|
|
|
|
- #{item}
|
|
|
|
- </foreach>
|
|
|
|
|
|
+ AND t1.account_id in
|
|
|
|
+ <foreach item="item" index="index" collection="accountIds"
|
|
|
|
+ open="(" separator="," close=")">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
</if>
|
|
</if>
|
|
group by DATE_FORMAT(t1.stat_datetime, '%Y-%m')
|
|
group by DATE_FORMAT(t1.stat_datetime, '%Y-%m')
|
|
order by t1.stat_datetime
|
|
order by t1.stat_datetime
|
|
@@ -266,64 +266,174 @@
|
|
when sum(a.total_play) != 0 and sum(a.total_play) is not null and sum(a.play25_feed_break) is not null
|
|
when sum(a.total_play) != 0 and sum(a.total_play) is not null and sum(a.play25_feed_break) is not null
|
|
then round(sum(a.play25_feed_break) / sum(a.total_play),2)
|
|
then round(sum(a.play25_feed_break) / sum(a.total_play),2)
|
|
else 0
|
|
else 0
|
|
- end as play25FeedBreakRate,
|
|
|
|
|
|
+ end
|
|
|
|
+ as play25FeedBreakRate,
|
|
case
|
|
case
|
|
when sum(a.click) != 0 and sum(a.click) is not null and sum(a.convert_num) is not null
|
|
when sum(a.click) != 0 and sum(a.click) is not null and sum(a.convert_num) is not null
|
|
then round(sum(a.convert_num) / sum(a.click),2)
|
|
then round(sum(a.convert_num) / sum(a.click),2)
|
|
else 0
|
|
else 0
|
|
- end as convertRate,
|
|
|
|
|
|
+ end
|
|
|
|
+ as convertRate,
|
|
case
|
|
case
|
|
when sum(a.convert_num) != 0 and sum(a.convert_num) is not null and sum(a.cost) is not null
|
|
when sum(a.convert_num) != 0 and sum(a.convert_num) is not null and sum(a.cost) is not null
|
|
then round(sum(a.cost)/sum(a.convert_num),2)
|
|
then round(sum(a.cost)/sum(a.convert_num),2)
|
|
else 0
|
|
else 0
|
|
- end as convertCost,
|
|
|
|
|
|
+ end
|
|
|
|
+ as convertCost,
|
|
ifnull(sum(a.follow),0) as follow,
|
|
ifnull(sum(a.follow),0) as follow,
|
|
ifnull(sum(a.next_day_open),0) as nextDayOpen,
|
|
ifnull(sum(a.next_day_open),0) as nextDayOpen,
|
|
case
|
|
case
|
|
when sum(a.active) != 0 and sum(a.next_day_open) is not null and sum(a.active) is not null
|
|
when sum(a.active) != 0 and sum(a.next_day_open) is not null and sum(a.active) is not null
|
|
then round(sum(a.next_day_open) / sum(a.active),2)
|
|
then round(sum(a.next_day_open) / sum(a.active),2)
|
|
else 0
|
|
else 0
|
|
- end as nextDayOpenRate,
|
|
|
|
|
|
+ end
|
|
|
|
+ as nextDayOpenRate,
|
|
case
|
|
case
|
|
when sum(a.next_day_open) != 0 and sum(a.next_day_open) is not null and sum(a.cost) is not null
|
|
when sum(a.next_day_open) != 0 and sum(a.next_day_open) is not null and sum(a.cost) is not null
|
|
then round(sum(a.cost) / sum(a.next_day_open),2)
|
|
then round(sum(a.cost) / sum(a.next_day_open),2)
|
|
else 0
|
|
else 0
|
|
- end as nextDayOpenCost,
|
|
|
|
|
|
+ end
|
|
|
|
+ as nextDayOpenCost,
|
|
case
|
|
case
|
|
when sum(a.click) != 0 and sum(a.click) is not null and sum(a.cost) is not null
|
|
when sum(a.click) != 0 and sum(a.click) is not null and sum(a.cost) is not null
|
|
then round(sum(a.cost) / sum(a.click),2)
|
|
then round(sum(a.cost) / sum(a.click),2)
|
|
else 0
|
|
else 0
|
|
- end as cpc,
|
|
|
|
|
|
+ end
|
|
|
|
+ as cpc,
|
|
case
|
|
case
|
|
when sum(a.show_num) != 0 and sum(a.show_num) is not null and sum(a.click) is not null
|
|
when sum(a.show_num) != 0 and sum(a.show_num) is not null and sum(a.click) is not null
|
|
then round(sum(a.click) / sum(a.show_num),2)
|
|
then round(sum(a.click) / sum(a.show_num),2)
|
|
else 0
|
|
else 0
|
|
- end as ctr,
|
|
|
|
|
|
+ end
|
|
|
|
+ as ctr,
|
|
case
|
|
case
|
|
when sum(a.show_num) != 0 and sum(a.cost) is not null and sum(a.show_num) is not null
|
|
when sum(a.show_num) != 0 and sum(a.cost) is not null and sum(a.show_num) is not null
|
|
then round(sum(a.cost) / sum(a.show_num) * 1000,2)
|
|
then round(sum(a.cost) / sum(a.show_num) * 1000,2)
|
|
else 0
|
|
else 0
|
|
- end as cpm,
|
|
|
|
|
|
+ end
|
|
|
|
+ as cpm,
|
|
|
|
+ case
|
|
|
|
+ when sum(a.active) != 0 and sum(a.cost) is not null and sum(a.active) is not null
|
|
|
|
+ then round(sum(a.cost) / sum(a.active),2)
|
|
|
|
+ else 0
|
|
|
|
+ end
|
|
|
|
+ as activeCost,
|
|
|
|
+ case
|
|
|
|
+ when sum(a.click) != 0 and sum(a.active) is not null and sum(a.click) is not null
|
|
|
|
+ then round(sum(a.active) / sum(a.click),2)
|
|
|
|
+ else 0
|
|
|
|
+ end
|
|
|
|
+ as activeRate,
|
|
|
|
+ case
|
|
|
|
+ when sum(a.active) != 0 and sum(a.register) is not null and sum(a.active) is not null
|
|
|
|
+ then round(sum(a.register) / sum(a.active),2)
|
|
|
|
+ else 0
|
|
|
|
+ end
|
|
|
|
+ as activeRegisterRate,
|
|
|
|
+ case
|
|
|
|
+ when sum(a.register) != 0 and sum(a.cost) is not null and sum(a.register) is not null
|
|
|
|
+ then round(sum(a.cost) / sum(a.register),2)
|
|
|
|
+ else 0
|
|
|
|
+ end
|
|
|
|
+ as activeRegisterCost
|
|
|
|
+ </sql>
|
|
|
|
+ <sql id="selectSql1">
|
|
|
|
+ ifnull
|
|
|
|
+ (sum(a.show),0) as showMaterial,
|
|
|
|
+ ifnull(sum(a.click),0) as clickMaterial,
|
|
|
|
+ ifnull(sum(a.convert),0) as convertMaterial,
|
|
|
|
+ ifnull(sum(a.cost),0) as cost,
|
|
|
|
+ ifnull(sum(a.active),0) as active,
|
|
|
|
+ ifnull(sum(a.download_finish),0) as downloadFinish,
|
|
|
|
+ ifnull(sum(a.download_start),0) as downloadStart,
|
|
|
|
+ ifnull(sum(a.click_install),0) as clickInstall,
|
|
|
|
+ ifnull(sum(a.install_finish),0) as installFinish,
|
|
|
|
+ ifnull(sum(a.register),0) as register,
|
|
|
|
+ ifnull(sum(a.pay_count),0) as payCount,
|
|
|
|
+ ifnull(sum(a.form),0) as form,
|
|
|
|
+ ifnull(sum(a.total_play),0) as totalPlay,
|
|
|
|
+ ifnull(sum(a.valid_play),0) as validPlay,
|
|
|
|
+ ifnull(sum(a.wifi_play),0) as wifiPlay,
|
|
|
|
+ ifnull(sum(a.play_25_feed_break),0) as play25FeedBreak,
|
|
|
|
+ ifnull(sum(a.play_50_feed_break),0) as play50FeedBreak,
|
|
|
|
+ ifnull(sum(a.play_75_feed_break),0) as play75FeedBreak,
|
|
|
|
+ ifnull(sum(a.play_100_feed_break),0) as play100FeedBreak,
|
|
|
|
+ ifnull(sum(a.share),0) as shareMaterial,
|
|
|
|
+ ifnull(sum(a.like),0) as likeMaterial,
|
|
|
|
+ case
|
|
|
|
+ when sum(a.total_play) != 0 and sum(a.total_play) is not null and sum(a.play_25_feed_break) is not null
|
|
|
|
+ then round(sum(a.play_25_feed_break) / sum(a.total_play),2)
|
|
|
|
+ else 0
|
|
|
|
+ end
|
|
|
|
+ as play25FeedBreakRate,
|
|
|
|
+ case
|
|
|
|
+ when sum(a.click) != 0 and sum(a.click) is not null and sum(a.convert) is not null
|
|
|
|
+ then round(sum(a.convert) / sum(a.click),2)
|
|
|
|
+ else 0
|
|
|
|
+ end
|
|
|
|
+ as convertRate,
|
|
|
|
+ case
|
|
|
|
+ when sum(a.convert) != 0 and sum(a.convert) is not null and sum(a.cost) is not null
|
|
|
|
+ then round(sum(a.cost)/sum(a.convert),2)
|
|
|
|
+ else 0
|
|
|
|
+ end
|
|
|
|
+ as convertCost,
|
|
|
|
+ ifnull(sum(a.follow),0) as follow,
|
|
|
|
+ ifnull(sum(a.next_day_open),0) as nextDayOpen,
|
|
|
|
+ case
|
|
|
|
+ when sum(a.active) != 0 and sum(a.next_day_open) is not null and sum(a.active) is not null
|
|
|
|
+ then round(sum(a.next_day_open) / sum(a.active),2)
|
|
|
|
+ else 0
|
|
|
|
+ end
|
|
|
|
+ as nextDayOpenRate,
|
|
|
|
+ case
|
|
|
|
+ when sum(a.next_day_open) != 0 and sum(a.next_day_open) is not null and sum(a.cost) is not null
|
|
|
|
+ then round(sum(a.cost) / sum(a.next_day_open),2)
|
|
|
|
+ else 0
|
|
|
|
+ end
|
|
|
|
+ as nextDayOpenCost,
|
|
|
|
+ case
|
|
|
|
+ when sum(a.click) != 0 and sum(a.click) is not null and sum(a.cost) is not null
|
|
|
|
+ then round(sum(a.cost) / sum(a.click),2)
|
|
|
|
+ else 0
|
|
|
|
+ end
|
|
|
|
+ as cpc,
|
|
|
|
+ case
|
|
|
|
+ when sum(a.show) != 0 and sum(a.show) is not null and sum(a.click) is not null
|
|
|
|
+ then round(sum(a.click) / sum(a.show),2)
|
|
|
|
+ else 0
|
|
|
|
+ end
|
|
|
|
+ as ctr,
|
|
|
|
+ case
|
|
|
|
+ when sum(a.show) != 0 and sum(a.cost) is not null and sum(a.show) is not null
|
|
|
|
+ then round(sum(a.cost) / sum(a.show) * 1000,2)
|
|
|
|
+ else 0
|
|
|
|
+ end
|
|
|
|
+ as cpm,
|
|
case
|
|
case
|
|
when sum(a.active) != 0 and sum(a.cost) is not null and sum(a.active) is not null
|
|
when sum(a.active) != 0 and sum(a.cost) is not null and sum(a.active) is not null
|
|
then round(sum(a.cost) / sum(a.active),2)
|
|
then round(sum(a.cost) / sum(a.active),2)
|
|
else 0
|
|
else 0
|
|
- end as activeCost,
|
|
|
|
|
|
+ end
|
|
|
|
+ as activeCost,
|
|
case
|
|
case
|
|
when sum(a.click) != 0 and sum(a.active) is not null and sum(a.click) is not null
|
|
when sum(a.click) != 0 and sum(a.active) is not null and sum(a.click) is not null
|
|
then round(sum(a.active) / sum(a.click),2)
|
|
then round(sum(a.active) / sum(a.click),2)
|
|
else 0
|
|
else 0
|
|
- end as activeRate,
|
|
|
|
|
|
+ end
|
|
|
|
+ as activeRate,
|
|
case
|
|
case
|
|
when sum(a.active) != 0 and sum(a.register) is not null and sum(a.active) is not null
|
|
when sum(a.active) != 0 and sum(a.register) is not null and sum(a.active) is not null
|
|
then round(sum(a.register) / sum(a.active),2)
|
|
then round(sum(a.register) / sum(a.active),2)
|
|
else 0
|
|
else 0
|
|
- end as activeRegisterRate,
|
|
|
|
|
|
+ end
|
|
|
|
+ as activeRegisterRate,
|
|
case
|
|
case
|
|
when sum(a.register) != 0 and sum(a.cost) is not null and sum(a.register) is not null
|
|
when sum(a.register) != 0 and sum(a.cost) is not null and sum(a.register) is not null
|
|
then round(sum(a.cost) / sum(a.register),2)
|
|
then round(sum(a.cost) / sum(a.register),2)
|
|
else 0
|
|
else 0
|
|
- end as activeRegisterCost
|
|
|
|
|
|
+ end
|
|
|
|
+ as activeRegisterCost
|
|
</sql>
|
|
</sql>
|
|
|
|
|
|
<select id="getBytedanceAccountInfoByProjectId"
|
|
<select id="getBytedanceAccountInfoByProjectId"
|
|
@@ -385,10 +495,9 @@
|
|
|
|
|
|
select
|
|
select
|
|
concat(#{startDate},'~',#{endDate}) as statDate,
|
|
concat(#{startDate},'~',#{endDate}) as statDate,
|
|
- a.advertiser_id as 'accountId',
|
|
|
|
- c.advertiser_id as 'advertiserId',
|
|
|
|
- (select name from ctop_advertiser where id = c.advertiser_id) as 'advertiserName',
|
|
|
|
-
|
|
|
|
|
|
+ a.account_id as 'accountId',
|
|
|
|
+ a.advertiser_id as 'advertiserId',
|
|
|
|
+ a.advertiser_name as 'advertiserName',
|
|
(
|
|
(
|
|
select realname from sys_user where id = (
|
|
select realname from sys_user where id = (
|
|
select responsible_id from ctop_project where id = b.project_id
|
|
select responsible_id from ctop_project where id = b.project_id
|
|
@@ -399,24 +508,20 @@
|
|
select design_responsible_id from ctop_project where id = b.project_id
|
|
select design_responsible_id from ctop_project where id = b.project_id
|
|
)
|
|
)
|
|
) as 'designResponsibleName',
|
|
) as 'designResponsibleName',
|
|
- b.auth_name as 'authName',
|
|
|
|
- b.project_id as 'projectId',
|
|
|
|
|
|
+ a.account_name as 'authName',
|
|
|
|
+ a.project_id as 'projectId',
|
|
(
|
|
(
|
|
- select realname from sys_user where id = (
|
|
|
|
- select sale_id from ctop_project where id = b.project_id
|
|
|
|
- )
|
|
|
|
|
|
+ select realname from sys_user where id = a.sale_id
|
|
) as 'saleName',
|
|
) as 'saleName',
|
|
- (select project_name from ctop_project where id = b.project_id) as 'projectName',
|
|
|
|
|
|
+ a.project_name as 'projectName',
|
|
c.media_id as 'mediaId',
|
|
c.media_id as 'mediaId',
|
|
- <include refid="selectSql"></include>
|
|
|
|
|
|
+ <include refid="selectSql1"></include>
|
|
from
|
|
from
|
|
- ctop_bytedance_report_advertiser_daily a
|
|
|
|
- left join ctop_user_allocation b on a.advertiser_id = b.account_id
|
|
|
|
|
|
+ application.bytedance_advertiser_report_daily_dw a
|
|
|
|
+ left join ctop_user_allocation b on a.account_id = b.account_id
|
|
left join ctop_project c on b.project_id = c.id
|
|
left join ctop_project c on b.project_id = c.id
|
|
- where
|
|
|
|
- date_format(a.stat_datetime, '%Y-%m-%d') >= #{startDate}
|
|
|
|
- and
|
|
|
|
- date_format(a.stat_datetime, '%Y-%m-%d') <= #{endDate}
|
|
|
|
|
|
+ where a.stat_datetime >= date_format(#{startDate}, '%Y%m%d')
|
|
|
|
+ and a.stat_datetime <= date_format(#{endDate}, '%Y%m%d')
|
|
and
|
|
and
|
|
b.project_id in
|
|
b.project_id in
|
|
<foreach collection="projectList" item="item" separator=","
|
|
<foreach collection="projectList" item="item" separator=","
|