|
@@ -11,25 +11,28 @@
|
|
|
stat_datetime >= #{startDate} and
|
|
|
stat_datetime <= #{endDate} and
|
|
|
<if test="accountIds != null">
|
|
|
- account_id in
|
|
|
+ account_id in
|
|
|
<foreach item="item" index="index" collection="accountIds" open="(" separator="," close=")">
|
|
|
#{item}
|
|
|
- </foreach> and
|
|
|
+ </foreach>
|
|
|
+ and
|
|
|
</if>
|
|
|
signature = #{signature}
|
|
|
</select>
|
|
|
|
|
|
<update id="updateHuanbiByDateAndSignature">
|
|
|
update
|
|
|
- ctop_bytedance_video_report_daily
|
|
|
+ ctop_bytedance_video_report_daily
|
|
|
set huanbi = #{huanbi}
|
|
|
- where
|
|
|
- stat_datetime = #{date}
|
|
|
- and signature = #{signature}
|
|
|
+ where stat_datetime = #{date}
|
|
|
+ and signature = #{signature}
|
|
|
</update>
|
|
|
|
|
|
<sql id="selectSql">
|
|
|
- a.project_id as projectId,
|
|
|
+ a
|
|
|
+ .
|
|
|
+ project_id
|
|
|
+ as projectId,
|
|
|
a.project_name as projectName,
|
|
|
a.advertiser_id as advertiserId,
|
|
|
a.advertiser_name as advertiserName,
|
|
@@ -51,17 +54,20 @@
|
|
|
case
|
|
|
when sum(a.total_play) != 0
|
|
|
then sum(a.play25_feed_break) / sum(a.total_play)
|
|
|
- else 0 end as play25FeedBreakRate,
|
|
|
+ else 0
|
|
|
+ end as play25FeedBreakRate,
|
|
|
|
|
|
case
|
|
|
when sum(a.total_play) != 0
|
|
|
then sum(a.play_over) / sum(a.total_play)
|
|
|
- else 0 end as playOverRate,
|
|
|
+ else 0
|
|
|
+ end as playOverRate,
|
|
|
|
|
|
case
|
|
|
when sum(a.click) != 0
|
|
|
then sum(a.convert_material) / sum(a.click)
|
|
|
- else 0 end as convertRate,
|
|
|
+ else 0
|
|
|
+ end as convertRate,
|
|
|
sum(a.active) as active,
|
|
|
sum(a.download_finish) as downloadFinish,
|
|
|
sum(a.download_start) as downloadStart,
|
|
@@ -82,38 +88,45 @@
|
|
|
case
|
|
|
when sum(a.active) != 0
|
|
|
then sum(a.next_day_open) / sum(a.active)
|
|
|
- else 0 end as nextDayOpenRate,
|
|
|
+ else 0
|
|
|
+ end as nextDayOpenRate,
|
|
|
|
|
|
case
|
|
|
when sum(a.next_day_open) != 0
|
|
|
then sum(a.cost) / sum(a.next_day_open)
|
|
|
- else 0 end as nextDayOpenCost,
|
|
|
+ else 0
|
|
|
+ end as nextDayOpenCost,
|
|
|
|
|
|
sum(a.active_pay_amount) as activePayAmount,
|
|
|
|
|
|
case
|
|
|
when sum(a.valid_play) != 0
|
|
|
then sum(a.cost) / sum(a.valid_play)
|
|
|
- else 0 end validPlayCost,
|
|
|
+ else 0
|
|
|
+ end validPlayCost,
|
|
|
sum(a.convert_material) as convertMaterial,
|
|
|
|
|
|
case
|
|
|
when sum(a.active_pay_amount) != 0
|
|
|
then sum(a.cost) / sum(a.active_pay_amount)
|
|
|
- else 0 end as activePayCost,
|
|
|
+ else 0
|
|
|
+ end as activePayCost,
|
|
|
case
|
|
|
when sum(a.click) != 0
|
|
|
then sum(a.cost) / sum(a.click)
|
|
|
- else 0 end as cpc,
|
|
|
+ else 0
|
|
|
+ end as cpc,
|
|
|
case
|
|
|
when sum(a.show_material) != 0
|
|
|
then sum(a.click) / sum(a.show_material)
|
|
|
- else 0 end as ctr,
|
|
|
+ else 0
|
|
|
+ end as ctr,
|
|
|
|
|
|
case
|
|
|
when sum(a.show_material) != 0
|
|
|
then sum(a.cost) / sum(a.show_material) * 1000
|
|
|
- else 0 end cpm,
|
|
|
+ else 0
|
|
|
+ end cpm,
|
|
|
sum(a.wifi_play_rate) as wifiPlayRate,
|
|
|
sum(a.like_material) as likeMaterial,
|
|
|
|
|
@@ -121,144 +134,180 @@
|
|
|
case
|
|
|
when sum(a.active) != 0
|
|
|
then sum(a.cost) / sum(a.active)
|
|
|
- else 0 end activeCost,
|
|
|
+ else 0
|
|
|
+ end activeCost,
|
|
|
|
|
|
case
|
|
|
when sum(a.game_addiction) != 0
|
|
|
then sum(a.cost) / sum(a.game_addiction)
|
|
|
- else 0 end as gameAddictionCost,
|
|
|
+ else 0
|
|
|
+ end as gameAddictionCost,
|
|
|
sum(a.game_addiction) as gameAddiction,
|
|
|
|
|
|
case
|
|
|
when sum(a.click) != 0
|
|
|
then sum(a.active) / sum(a.click)
|
|
|
- else 0 end as activeRate,
|
|
|
+ else 0
|
|
|
+ end as activeRate,
|
|
|
|
|
|
|
|
|
case
|
|
|
when sum(a.active) != 0
|
|
|
then sum(a.game_addiction) / sum(a.active)
|
|
|
- else 0 end gameAddictionRate,
|
|
|
+ else 0
|
|
|
+ end gameAddictionRate,
|
|
|
|
|
|
case
|
|
|
when sum(a.active) != 0
|
|
|
then sum(a.register) / sum(a.active)
|
|
|
- else 0 end as activeRegisterRate,
|
|
|
+ else 0
|
|
|
+ end as activeRegisterRate,
|
|
|
case
|
|
|
when sum(a.download_finish) != 0
|
|
|
then sum(a.cost) / sum(a.download_finish)
|
|
|
- else 0 end as downloadFinishCost,
|
|
|
+ else 0
|
|
|
+ end as downloadFinishCost,
|
|
|
case
|
|
|
when sum(a.register) != 0
|
|
|
then sum(a.cost) / sum(a.register)
|
|
|
- else 0 end as activeRegisterCost,
|
|
|
+ else 0
|
|
|
+ end as activeRegisterCost,
|
|
|
sum(a.show_material) as showMaterial,
|
|
|
case
|
|
|
when sum(a.download_start) != 0
|
|
|
then sum(a.download_finish) / sum(a.download_start)
|
|
|
- else 0 end as downloadFinishRate,
|
|
|
+ else 0
|
|
|
+ end as downloadFinishRate,
|
|
|
case
|
|
|
when sum(a.download_finish) != 0
|
|
|
then sum(a.install_finish) / sum(a.download_finish)
|
|
|
- else 0 end as installFinishRate,
|
|
|
+ else 0
|
|
|
+ end as installFinishRate,
|
|
|
sum(a.play_over) as playOver,
|
|
|
case
|
|
|
when sum(a.download_start) != 0
|
|
|
then sum(a.cost) / sum(a.download_start)
|
|
|
- else 0 end as downloadStartCost,
|
|
|
+ else 0
|
|
|
+ end as downloadStartCost,
|
|
|
case
|
|
|
when sum(a.show_material) != 0
|
|
|
then sum(a.valid_play) / sum(a.show_material)
|
|
|
- else 0 end as validPlayRate,
|
|
|
+ else 0
|
|
|
+ end as validPlayRate,
|
|
|
case
|
|
|
when sum(a.valid_play) != 0
|
|
|
then sum(a.average_play_time_per_play*a.valid_play)/sum(a.valid_play)
|
|
|
- else 0 end as averagePlayTimePerPlay,
|
|
|
+ else 0
|
|
|
+ end as averagePlayTimePerPlay,
|
|
|
case
|
|
|
when sum(a.convert_material) != 0
|
|
|
then sum(a.cost) / sum(a.convert_material)
|
|
|
- else 0 end as convertCost,
|
|
|
+ else 0
|
|
|
+ end as convertCost,
|
|
|
case
|
|
|
when sum(a.install_finish) != 0
|
|
|
then sum(a.cost) / sum(a.install_finish)
|
|
|
- else 0 end as installFinishCost,
|
|
|
+ else 0
|
|
|
+ end as installFinishCost,
|
|
|
case
|
|
|
when sum(a.click) != 0
|
|
|
then sum(a.download_start) / sum(a.click)
|
|
|
- else 0 end as downloadStartRate
|
|
|
+ else 0
|
|
|
+ end as downloadStartRate
|
|
|
</sql>
|
|
|
|
|
|
<select id="getRoleCodeByUserId" resultType="string">
|
|
|
- select
|
|
|
- role_code
|
|
|
- from
|
|
|
- sys_user_role a
|
|
|
- left join sys_role b on a.role_id = b.id
|
|
|
+ select role_code
|
|
|
+ from sys_user_role a
|
|
|
+ left join sys_role b on a.role_id = b.id
|
|
|
where a.user_id = #{userId}
|
|
|
</select>
|
|
|
|
|
|
<select id="getCompanyIdByUserId" resultType="string">
|
|
|
- select
|
|
|
- company_id
|
|
|
- from
|
|
|
- user_company
|
|
|
+ select company_id
|
|
|
+ from user_company
|
|
|
where user_id = #{userId}
|
|
|
</select>
|
|
|
|
|
|
<select id="getJsonByUserIdAndColumnType" resultType="string">
|
|
|
- select
|
|
|
- json as json
|
|
|
- from
|
|
|
- ctop_column_load
|
|
|
- where
|
|
|
- column_type = #{columnType}
|
|
|
- and user_id = #{userId}
|
|
|
+ select json as json
|
|
|
+ from ctop_column_load
|
|
|
+ where column_type = #{columnType}
|
|
|
+ and user_id = #{userId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getJsonByAccountIdAndColumnType" resultType="string">
|
|
|
+ select json as json
|
|
|
+ from ctop_column_load
|
|
|
+ where column_type = #{columnType}
|
|
|
+ and account_id = #{accountId}
|
|
|
</select>
|
|
|
|
|
|
<insert id="insertColumnLoad">
|
|
|
- insert into
|
|
|
- ctop_column_load
|
|
|
- (
|
|
|
- user_id,
|
|
|
- json,
|
|
|
- column_type,
|
|
|
- status
|
|
|
- )
|
|
|
- values
|
|
|
- (
|
|
|
- #{userId},
|
|
|
- #{json},
|
|
|
- #{columnType},
|
|
|
- 1
|
|
|
- )
|
|
|
+ insert into ctop_column_load
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="userId != null">
|
|
|
+ user_id,
|
|
|
+ </if>
|
|
|
+ <if test="json != null">
|
|
|
+ json,
|
|
|
+ </if>
|
|
|
+ <if test="columnType != null">
|
|
|
+ column_type,
|
|
|
+ </if>
|
|
|
+ <if test="accountId != null">
|
|
|
+ account_id,
|
|
|
+ </if>
|
|
|
+ status
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="userId != null">
|
|
|
+ #{userId},
|
|
|
+ </if>
|
|
|
+ <if test="json != null">
|
|
|
+ #{json},
|
|
|
+ </if>
|
|
|
+ <if test="columnType != null">
|
|
|
+ #{columnType},
|
|
|
+ </if>
|
|
|
+ <if test="accountId != null">
|
|
|
+ #{accountId},
|
|
|
+ </if>
|
|
|
+ 1
|
|
|
+ </trim>
|
|
|
</insert>
|
|
|
|
|
|
+
|
|
|
<update id="updateJsonByUserIdAndType">
|
|
|
update
|
|
|
ctop_column_load
|
|
|
set
|
|
|
json = #{json}
|
|
|
- where
|
|
|
- user_id = #{userId}
|
|
|
- and
|
|
|
- column_type = #{columnType}
|
|
|
+ where column_type = #{columnType}
|
|
|
+ <if test="userId != null">
|
|
|
+ and user_id = #{userId}
|
|
|
+ </if>
|
|
|
+ <if test="accountId != null">
|
|
|
+ and account_id = #{accountId}
|
|
|
+ </if>
|
|
|
</update>
|
|
|
|
|
|
<select id="videoInfoListDetail" resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
|
- select
|
|
|
- a.project_id as projectId,
|
|
|
- a.project_name as projectName,
|
|
|
- a.account_id as accountId,
|
|
|
- a.advertiser_id as advertiserId,
|
|
|
- a.advertiser_name as advertiserName,
|
|
|
- a.stat_datetime as statDatetime,
|
|
|
- sum(a.cost) as cost,
|
|
|
- a.video_url as videoUrl,
|
|
|
- (select info.url from ctop_material_info info where info.code = a.signature limit 1) as url,
|
|
|
- signature as signature
|
|
|
+ select
|
|
|
+ a.project_id as projectId,
|
|
|
+ a.project_name as projectName,
|
|
|
+ a.account_id as accountId,
|
|
|
+ a.advertiser_id as advertiserId,
|
|
|
+ a.advertiser_name as advertiserName,
|
|
|
+ a.stat_datetime as statDatetime,
|
|
|
+ sum(a.cost) as cost,
|
|
|
+ a.video_url as videoUrl,
|
|
|
+ (select info.url from ctop_material_info info where info.code = a.signature limit 1) as url,
|
|
|
+ signature as signature
|
|
|
|
|
|
from ctop_bytedance_video_report_daily a
|
|
|
- left join (select material_id,clip_id,shot_id,plan_id,plane_id from ctop_material_ascription group by material_id) f on a.signature = f.material_id
|
|
|
+ left join (select material_id,clip_id,shot_id,plan_id,plane_id from ctop_material_ascription group by
|
|
|
+ material_id) f on a.signature = f.material_id
|
|
|
where
|
|
|
stat_datetime >= #{startDate}
|
|
|
and stat_datetime <= #{endDate}
|
|
@@ -273,7 +322,8 @@
|
|
|
order by stat_datetime desc
|
|
|
</select>
|
|
|
|
|
|
- <select id="videoInfoListDetailOperator" resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
|
+ <select id="videoInfoListDetailOperator"
|
|
|
+ resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
|
select
|
|
|
a.project_id as projectId,
|
|
|
a.project_name as projectName,
|
|
@@ -287,12 +337,13 @@
|
|
|
signature as signature
|
|
|
|
|
|
from ctop_bytedance_video_report_daily a
|
|
|
- left join (select material_id,clip_id,shot_id,plan_id,plane_id from ctop_material_ascription group by material_id) f on a.signature = f.material_id
|
|
|
+ left join (select material_id,clip_id,shot_id,plan_id,plane_id from ctop_material_ascription group by
|
|
|
+ material_id) f on a.signature = f.material_id
|
|
|
where
|
|
|
stat_datetime >= #{startDate}
|
|
|
and stat_datetime <= #{endDate}
|
|
|
<if test="accountIds != null">
|
|
|
- and a.account_id in
|
|
|
+ and a.account_id in
|
|
|
<foreach item="item" index="index" collection="accountIds" open="(" separator="," close=")">
|
|
|
#{item}
|
|
|
</foreach>
|
|
@@ -302,7 +353,8 @@
|
|
|
order by stat_datetime desc
|
|
|
</select>
|
|
|
|
|
|
- <select id="videoInfoListDetailOtherRoles" resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
|
+ <select id="videoInfoListDetailOtherRoles"
|
|
|
+ resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
|
select
|
|
|
a.project_id as projectId,
|
|
|
a.project_name as projectName,
|
|
@@ -316,7 +368,8 @@
|
|
|
signature as signature
|
|
|
|
|
|
from ctop_bytedance_video_report_daily a
|
|
|
- left join (select material_id,clip_id,shot_id,plan_id,plane_id from ctop_material_ascription group by material_id) f on a.signature = f.material_id
|
|
|
+ left join (select material_id,clip_id,shot_id,plan_id,plane_id from ctop_material_ascription group by
|
|
|
+ material_id) f on a.signature = f.material_id
|
|
|
where
|
|
|
stat_datetime >= #{startDate}
|
|
|
and stat_datetime <= #{endDate}
|
|
@@ -331,7 +384,8 @@
|
|
|
order by stat_datetime desc
|
|
|
</select>
|
|
|
|
|
|
- <select id="videoInfoListDetailDesign" resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
|
+ <select id="videoInfoListDetailDesign"
|
|
|
+ resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
|
select
|
|
|
a.project_id as projectId,
|
|
|
a.project_name as projectName,
|
|
@@ -345,7 +399,8 @@
|
|
|
signature as signature
|
|
|
|
|
|
from ctop_bytedance_video_report_daily a
|
|
|
- left join (select material_id,clip_id,shot_id,plan_id,plane_id from ctop_material_ascription group by material_id) f on a.signature = f.material_id
|
|
|
+ left join (select material_id,clip_id,shot_id,plan_id,plane_id from ctop_material_ascription group by
|
|
|
+ material_id) f on a.signature = f.material_id
|
|
|
where
|
|
|
stat_datetime >= #{startDate}
|
|
|
and stat_datetime <= #{endDate}
|
|
@@ -364,29 +419,28 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="accountVideoMap" resultType="cn.com.ctop.toutiao.modules.report.DTO.AccountVideoDTO">
|
|
|
- select
|
|
|
- a.account_id,b.signature
|
|
|
- FROM
|
|
|
- ctop_bytedance_report_material_daily a
|
|
|
- left join ctop_bytedance_video_info b on a.material_id = b.material_id
|
|
|
- where a.image_mode in ('CREATIVE_IMAGE_MODE_VIDEO','CREATIVE_IMAGE_MODE_VIDEO_VERTICAL')
|
|
|
- and b.signature is not null
|
|
|
- group by a.account_id,b.signature
|
|
|
+ select a.account_id,
|
|
|
+ b.signature
|
|
|
+ FROM ctop_bytedance_report_material_daily a
|
|
|
+ left join ctop_bytedance_video_info b on a.material_id = b.material_id
|
|
|
+ where a.image_mode in ('CREATIVE_IMAGE_MODE_VIDEO', 'CREATIVE_IMAGE_MODE_VIDEO_VERTICAL')
|
|
|
+ and b.signature is not null
|
|
|
+ group by a.account_id, b.signature
|
|
|
</select>
|
|
|
|
|
|
<insert id="replaceIntoAccountVideoMapBatch">
|
|
|
replace into
|
|
|
ctop_bytedance_account_video_map
|
|
|
(
|
|
|
- account_id,
|
|
|
- signature
|
|
|
+ account_id,
|
|
|
+ signature
|
|
|
)
|
|
|
values
|
|
|
<foreach collection="accountVideoDTOList" item="accountVideo" separator=",">
|
|
|
- (
|
|
|
+ (
|
|
|
#{accountVideo.accountId},
|
|
|
#{accountVideo.signature}
|
|
|
- )
|
|
|
+ )
|
|
|
</foreach>
|
|
|
</insert>
|
|
|
<insert id="insertBatch">
|
|
@@ -605,17 +659,17 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="getAccountIdsByOperatorIdAndMediaId" resultType="long">
|
|
|
- select
|
|
|
- account_id
|
|
|
- from
|
|
|
- ctop_user_allocation
|
|
|
- where
|
|
|
- user_id = #{userId}
|
|
|
- and media_id in (1,3)
|
|
|
+ select account_id
|
|
|
+ from ctop_user_allocation
|
|
|
+ where user_id = #{userId}
|
|
|
+ and media_id in (1, 3)
|
|
|
</select>
|
|
|
|
|
|
<sql id="videoInfoSql">
|
|
|
- a.account_id as accountId,
|
|
|
+ a
|
|
|
+ .
|
|
|
+ account_id
|
|
|
+ as accountId,
|
|
|
b.project_id as projectId,
|
|
|
b.project_name as projectName,
|
|
|
b.advertiser_id as advertiserId,
|
|
@@ -631,16 +685,19 @@
|
|
|
case
|
|
|
when sum(a.total_play) != 0
|
|
|
then sum(a.play25_feed_break)/sum(a.total_play)
|
|
|
- else 0 end as play25FeedBreakRate,
|
|
|
+ else 0
|
|
|
+ end as play25FeedBreakRate,
|
|
|
|
|
|
case
|
|
|
when sum(a.total_play) != 0
|
|
|
then sum(a.play_over)/sum(a.total_play)
|
|
|
- else 0 end as playOverRate,
|
|
|
+ else 0
|
|
|
+ end as playOverRate,
|
|
|
case
|
|
|
when sum(a.click) != 0
|
|
|
then sum(a.convert_material)/sum(a.click)
|
|
|
- else 0 end as convertRate,
|
|
|
+ else 0
|
|
|
+ end as convertRate,
|
|
|
sum(a.active) as active,
|
|
|
sum(a.download_finish) as downloadFinish,
|
|
|
sum(a.download_start) as downloadStart,
|
|
@@ -687,16 +744,19 @@
|
|
|
case
|
|
|
when sum(a.active) != 0
|
|
|
then sum(a.next_day_open)/sum(a.active)
|
|
|
- else 0 end as nextDayOpenRate,
|
|
|
+ else 0
|
|
|
+ end as nextDayOpenRate,
|
|
|
|
|
|
case
|
|
|
when sum(a.next_day_open) != 0
|
|
|
then sum(a.cost)/sum(a.next_day_open)
|
|
|
- else 0 end as nextDayOpenCost,
|
|
|
+ else 0
|
|
|
+ end as nextDayOpenCost,
|
|
|
|
|
|
case when sum(a.pay_count) != 0
|
|
|
then sum(a.cost)/sum(a.pay_count)
|
|
|
- else 0 end
|
|
|
+ else 0
|
|
|
+ end
|
|
|
as activePayCost,
|
|
|
|
|
|
sum(a.active_pay_amount) as activePayAmount,
|
|
@@ -704,79 +764,93 @@
|
|
|
case
|
|
|
when sum(a.valid_play) != 0
|
|
|
then sum(a.cost)/sum(a.valid_play)
|
|
|
- else 0 end validPlayCost,
|
|
|
+ else 0
|
|
|
+ end validPlayCost,
|
|
|
sum(a.advanced_creative_coupon_addition) as advancedCreativeCouponAddition,
|
|
|
sum(a.convert_material) as convertMaterial,
|
|
|
|
|
|
case
|
|
|
when sum(a.active_pay_amount) != 0
|
|
|
then sum(a.cost)/sum(a.active_pay_amount)
|
|
|
- else 0 end as activePayCost,
|
|
|
+ else 0
|
|
|
+ end as activePayCost,
|
|
|
sum(a.download) as download,
|
|
|
case
|
|
|
when sum(a.click) != 0
|
|
|
then sum(a.cost) / sum(a.click)
|
|
|
- else 0 end as cpc,
|
|
|
+ else 0
|
|
|
+ end as cpc,
|
|
|
sum(a.location_click) as locationClick,
|
|
|
|
|
|
case
|
|
|
when sum(a.show_material) != 0
|
|
|
then sum(a.click)/sum(a.show_material)
|
|
|
- else 0 end as ctr,
|
|
|
+ else 0
|
|
|
+ end as ctr,
|
|
|
|
|
|
case
|
|
|
when sum(a.show_material) != 0
|
|
|
then sum(a.cost)/sum(a.show_material)*1000
|
|
|
- else 0 end cpm,
|
|
|
+ else 0
|
|
|
+ end cpm,
|
|
|
sum(a.wifi_play_rate) as wifiPlayRate,
|
|
|
sum(a.like_material) as likeMaterial,
|
|
|
|
|
|
case
|
|
|
when sum(a.active) != 0
|
|
|
then sum(a.cost)/sum(a.active)
|
|
|
- else 0 end activeCost,
|
|
|
+ else 0
|
|
|
+ end activeCost,
|
|
|
|
|
|
case
|
|
|
when sum(a.game_addiction) != 0
|
|
|
then sum(a.cost)/sum(a.game_addiction)
|
|
|
- else 0 end as gameAddictionCost,
|
|
|
+ else 0
|
|
|
+ end as gameAddictionCost,
|
|
|
sum(a.game_addiction) as gameAddiction,
|
|
|
|
|
|
case
|
|
|
when sum(a.click) != 0
|
|
|
then sum(a.active)/sum(a.click)
|
|
|
- else 0 end as activeRate,
|
|
|
+ else 0
|
|
|
+ end as activeRate,
|
|
|
|
|
|
case
|
|
|
when sum(a.active) != 0
|
|
|
then sum(a.game_addiction)/sum(a.active)
|
|
|
- else 0 end gameAddictionRate,
|
|
|
+ else 0
|
|
|
+ end gameAddictionRate,
|
|
|
case
|
|
|
when sum(a.active) != 0
|
|
|
then sum(a.register)/sum(a.active)
|
|
|
- else 0 end as activeRegisterRate,
|
|
|
+ else 0
|
|
|
+ end as activeRegisterRate,
|
|
|
|
|
|
case
|
|
|
when sum(a.download_finish) != 0
|
|
|
then sum(a.cost)/sum(a.download_finish)
|
|
|
- else 0 end as downloadFinishCost,
|
|
|
+ else 0
|
|
|
+ end as downloadFinishCost,
|
|
|
|
|
|
|
|
|
case
|
|
|
when sum(a.register) != 0
|
|
|
then sum(a.cost)/sum(a.register)
|
|
|
- else 0 end as activeRegisterCost,
|
|
|
+ else 0
|
|
|
+ end as activeRegisterCost,
|
|
|
sum(a.show_material) as showMaterial,
|
|
|
|
|
|
case
|
|
|
when sum(a.download_start) != 0
|
|
|
then sum(a.download_finish)/sum(a.download_start)
|
|
|
- else 0 end as downloadFinishRate,
|
|
|
+ else 0
|
|
|
+ end as downloadFinishRate,
|
|
|
|
|
|
case
|
|
|
when sum(a.download_finish) != 0
|
|
|
then sum(a.install_finish)/sum(a.download_finish)
|
|
|
- else 0 end as installFinishRate,
|
|
|
+ else 0
|
|
|
+ end as installFinishRate,
|
|
|
sum(a.coupon) as coupon,
|
|
|
sum(a.coupon_single_page) as couponSinglePage,
|
|
|
sum(a.play_over) as playOver,
|
|
@@ -784,31 +858,37 @@
|
|
|
case
|
|
|
when sum(a.download_start) != 0
|
|
|
then sum(a.cost)/sum(a.download_start)
|
|
|
- else 0 end as downloadStartCost,
|
|
|
+ else 0
|
|
|
+ end as downloadStartCost,
|
|
|
sum(a.message) as message,
|
|
|
case
|
|
|
when sum(a.show_material) != 0
|
|
|
then sum(a.valid_play)/sum(a.show_material)
|
|
|
- else 0 end as validPlayRate,
|
|
|
+ else 0
|
|
|
+ end as validPlayRate,
|
|
|
|
|
|
case
|
|
|
when sum(a.valid_play) != 0
|
|
|
then sum(a.average_play_time_per_play*a.valid_play)/sum(a.valid_play)
|
|
|
- else 0 end as averagePlayTimePerPlay,
|
|
|
+ else 0
|
|
|
+ end as averagePlayTimePerPlay,
|
|
|
case
|
|
|
when sum(a.convert_material) != 0
|
|
|
then sum(a.cost)/sum(a.convert_material)
|
|
|
- else 0 end as convertCost,
|
|
|
+ else 0
|
|
|
+ end as convertCost,
|
|
|
|
|
|
case
|
|
|
when sum(a.install_finish) != 0
|
|
|
then sum(a.cost)/sum(a.install_finish)
|
|
|
- else 0 end as installFinishCost,
|
|
|
+ else 0
|
|
|
+ end as installFinishCost,
|
|
|
|
|
|
case
|
|
|
when sum(a.click) != 0
|
|
|
then sum(a.download_start)/sum(a.click)
|
|
|
- else 0 end as downloadStartRate,
|
|
|
+ else 0
|
|
|
+ end as downloadStartRate,
|
|
|
</sql>
|
|
|
|
|
|
<select id="videoInfoList" resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
@@ -916,7 +996,7 @@
|
|
|
case
|
|
|
when sum(a.click) != 0
|
|
|
then sum(a.cost) / sum(a.click)
|
|
|
- else 0 end as cpc,
|
|
|
+ else 0 end as cpc,
|
|
|
sum(a.location_click) as locationClick,
|
|
|
|
|
|
case
|
|
@@ -1015,7 +1095,8 @@
|
|
|
from ctop_bytedance_report_material_daily a
|
|
|
left join ctop_user_allocation b on a.account_id = b.account_id
|
|
|
left join user_company c on b.user_id = c.user_id
|
|
|
- left join (select signature,video_url,material_id from ctop_bytedance_video_info group by material_id) d on a.material_id = d.material_id
|
|
|
+ left join (select signature,video_url,material_id from ctop_bytedance_video_info group by material_id) d on
|
|
|
+ a.material_id = d.material_id
|
|
|
where c.company_id = #{companyId}
|
|
|
and stat_datetime >= #{startDate}
|
|
|
and stat_datetime <= #{endDate}
|
|
@@ -1026,27 +1107,26 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="getCompanyIdByAccountId" resultType="string">
|
|
|
- select
|
|
|
- c.company_id
|
|
|
- from
|
|
|
- ctop_user_allocation b
|
|
|
- left join user_company c on b.user_id = c.user_id
|
|
|
- where b.account_id = #{accountId}
|
|
|
- limit 1
|
|
|
+ select c.company_id
|
|
|
+ from ctop_user_allocation b
|
|
|
+ left join user_company c on b.user_id = c.user_id
|
|
|
+ where b.account_id = #{accountId} limit 1
|
|
|
</select>
|
|
|
|
|
|
- <select id="videoInfoListGroupOperator" resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
|
+ <select id="videoInfoListGroupOperator"
|
|
|
+ resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
|
select
|
|
|
<include refid="selectSql"></include>
|
|
|
from ctop_bytedance_video_report_daily a
|
|
|
- left join (select material_id from ctop_material_ascription group by material_id) f on a.signature = f.material_id
|
|
|
+ left join (select material_id from ctop_material_ascription group by material_id) f on a.signature =
|
|
|
+ f.material_id
|
|
|
where stat_datetime >= #{startDate}
|
|
|
and stat_datetime <= #{endDate}
|
|
|
and f.material_id is not null
|
|
|
and a.account_id in
|
|
|
- <foreach item="item" index="index" collection="accountIds" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
+ <foreach item="item" index="index" collection="accountIds" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
<if test="signature != null and signature != '' ">
|
|
|
and a.signature = #{signature}
|
|
|
</if>
|
|
@@ -1057,11 +1137,13 @@
|
|
|
|
|
|
</select>
|
|
|
|
|
|
- <select id="videoInfoListGroupOtherRoles" resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
|
+ <select id="videoInfoListGroupOtherRoles"
|
|
|
+ resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
|
select
|
|
|
<include refid="selectSql"></include>
|
|
|
from ctop_bytedance_video_report_daily a
|
|
|
- left join (select material_id from ctop_material_ascription group by material_id) f on a.signature = f.material_id
|
|
|
+ left join (select material_id from ctop_material_ascription group by material_id) f on a.signature =
|
|
|
+ f.material_id
|
|
|
where stat_datetime >= #{startDate}
|
|
|
and stat_datetime <= #{endDate}
|
|
|
and f.material_id is not null
|
|
@@ -1079,11 +1161,13 @@
|
|
|
|
|
|
</select>
|
|
|
|
|
|
- <select id="videoInfoListGroupShot" resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
|
+ <select id="videoInfoListGroupShot"
|
|
|
+ resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
|
select
|
|
|
<include refid="selectSql"></include>
|
|
|
from ctop_bytedance_video_report_daily a
|
|
|
- left join (select material_id,clip_id,shot_id,plan_id,plane_id from ctop_material_ascription group by material_id) f on a.signature = f.material_id
|
|
|
+ left join (select material_id,clip_id,shot_id,plan_id,plane_id from ctop_material_ascription group by
|
|
|
+ material_id) f on a.signature = f.material_id
|
|
|
where stat_datetime >= #{startDate}
|
|
|
and stat_datetime <= #{endDate}
|
|
|
and f.material_id is not null
|
|
@@ -1104,11 +1188,13 @@
|
|
|
|
|
|
</select>
|
|
|
|
|
|
- <select id="videoInfoListGroupAdmin" resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
|
+ <select id="videoInfoListGroupAdmin"
|
|
|
+ resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
|
select
|
|
|
<include refid="selectSql"></include>
|
|
|
from ctop_bytedance_video_report_daily a
|
|
|
- left join (select material_id,clip_id,shot_id,plan_id,plane_id from ctop_material_ascription group by material_id) f on a.signature = f.material_id
|
|
|
+ left join (select material_id,clip_id,shot_id,plan_id,plane_id from ctop_material_ascription group by
|
|
|
+ material_id) f on a.signature = f.material_id
|
|
|
where stat_datetime >= #{startDate}
|
|
|
and stat_datetime <= #{endDate}
|
|
|
and f.material_id is not null
|
|
@@ -1128,11 +1214,13 @@
|
|
|
</if>
|
|
|
</select>
|
|
|
|
|
|
- <select id="videoInfoListGroupdesignTeamLeader" resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
|
+ <select id="videoInfoListGroupdesignTeamLeader"
|
|
|
+ resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
|
select
|
|
|
<include refid="selectSql"></include>
|
|
|
from ctop_bytedance_video_report_daily a
|
|
|
- left join (select material_id,clip_id,shot_id,plan_id,plane_id from ctop_material_ascription group by material_id) f on a.signature = f.material_id
|
|
|
+ left join (select material_id,clip_id,shot_id,plan_id,plane_id from ctop_material_ascription group by
|
|
|
+ material_id) f on a.signature = f.material_id
|
|
|
where stat_datetime >= #{startDate}
|
|
|
and stat_datetime <= #{endDate}
|
|
|
and a.company_id = #{companyId}
|
|
@@ -1154,11 +1242,13 @@
|
|
|
|
|
|
</select>
|
|
|
|
|
|
- <select id="videoInfoListGroupPlaneAndPlaneLeader" resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
|
+ <select id="videoInfoListGroupPlaneAndPlaneLeader"
|
|
|
+ resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
|
select
|
|
|
<include refid="selectSql"></include>
|
|
|
from ctop_bytedance_video_report_daily a
|
|
|
- left join (select material_id,clip_id,shot_id,plan_id,plane_id from ctop_material_ascription group by material_id) f on a.signature = f.material_id
|
|
|
+ left join (select material_id,clip_id,shot_id,plan_id,plane_id from ctop_material_ascription group by
|
|
|
+ material_id) f on a.signature = f.material_id
|
|
|
where stat_datetime >= #{startDate}
|
|
|
and stat_datetime <= #{endDate}
|
|
|
|
|
@@ -1180,11 +1270,13 @@
|
|
|
|
|
|
</select>
|
|
|
|
|
|
- <select id="videoInfoListGroupPlan" resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
|
+ <select id="videoInfoListGroupPlan"
|
|
|
+ resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
|
select
|
|
|
<include refid="selectSql"></include>
|
|
|
from ctop_bytedance_video_report_daily a
|
|
|
- left join (select material_id,clip_id,shot_id,plan_id,plane_id from ctop_material_ascription group by material_id) f on a.signature = f.material_id
|
|
|
+ left join (select material_id,clip_id,shot_id,plan_id,plane_id from ctop_material_ascription group by
|
|
|
+ material_id) f on a.signature = f.material_id
|
|
|
where stat_datetime >= #{startDate}
|
|
|
and stat_datetime <= #{endDate}
|
|
|
and f.material_id is not null
|
|
@@ -1205,11 +1297,13 @@
|
|
|
|
|
|
</select>
|
|
|
|
|
|
- <select id="videoInfoListGroupClip" resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
|
+ <select id="videoInfoListGroupClip"
|
|
|
+ resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
|
select
|
|
|
<include refid="selectSql"></include>
|
|
|
from ctop_bytedance_video_report_daily a
|
|
|
- left join (select material_id,clip_id,shot_id,plan_id,plane_id from ctop_material_ascription group by material_id) f on a.signature = f.material_id
|
|
|
+ left join (select material_id,clip_id,shot_id,plan_id,plane_id from ctop_material_ascription group by
|
|
|
+ material_id) f on a.signature = f.material_id
|
|
|
where stat_datetime >= #{startDate}
|
|
|
and stat_datetime <= #{endDate}
|
|
|
and f.material_id is not null
|
|
@@ -1231,13 +1325,10 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="getAccountIds" resultType="long">
|
|
|
- select
|
|
|
- account_id
|
|
|
- from
|
|
|
- ctop_bytedance_video_report_daily
|
|
|
- where
|
|
|
- signature = #{signature}
|
|
|
- and company_id = #{companyId}
|
|
|
+ select account_id
|
|
|
+ from ctop_bytedance_video_report_daily
|
|
|
+ where signature = #{signature}
|
|
|
+ and company_id = #{companyId}
|
|
|
</select>
|
|
|
|
|
|
<select id="getAccountIdsByUserIdAndMediaIds" resultType="long">
|
|
@@ -1247,16 +1338,16 @@
|
|
|
ctop_user_allocation
|
|
|
where
|
|
|
project_id in (
|
|
|
- select
|
|
|
- project_id
|
|
|
- from ctop_project_member member
|
|
|
- left join ctop_project pro on member.project_id = pro.id
|
|
|
- where member.user_id =#{userId}
|
|
|
- and pro.media_id in
|
|
|
- <foreach collection="mediaIds" item="item" separator=","
|
|
|
- open="(" close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
+ select
|
|
|
+ project_id
|
|
|
+ from ctop_project_member member
|
|
|
+ left join ctop_project pro on member.project_id = pro.id
|
|
|
+ where member.user_id =#{userId}
|
|
|
+ and pro.media_id in
|
|
|
+ <foreach collection="mediaIds" item="item" separator=","
|
|
|
+ open="(" close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
)
|
|
|
</select>
|
|
|
</mapper>
|