|
@@ -2,240 +2,6 @@
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="cn.com.ctop.toutiao.modules.report.mapper.ByteDanceVideoReportDailyMapper">
|
|
|
|
|
|
- <select id="videoInfoList_old" resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
|
- select
|
|
|
- -- a.material_id as materialId,
|
|
|
- -- a.account_id as accountId,
|
|
|
- -- b.auth_name as authName,
|
|
|
- b.project_id as projectId,
|
|
|
- b.project_name as projectName,
|
|
|
- b.advertiser_id as advertiserId,
|
|
|
- b.advertiser_name as advertiserName,
|
|
|
- a.stat_datetime as statDatetime,
|
|
|
- sum(a.cost) as cost, -- 消耗
|
|
|
- d.signature as signature,
|
|
|
- d.video_url as videoUrl,
|
|
|
- e.url as url,
|
|
|
- <!-- e.material_name as materialName, -->
|
|
|
- '-' as materialDesc,
|
|
|
- 1 as appType,
|
|
|
- sum(a.click) as click, -- 点击数
|
|
|
- case
|
|
|
- when sum(a.total_play) != 0
|
|
|
- then sum(a.play25_feed_break)/sum(a.total_play)
|
|
|
- else 0 end as play25FeedBreakRate, -- 25%进度播放率
|
|
|
-
|
|
|
- case
|
|
|
- when sum(a.total_play) != 0
|
|
|
- then sum(a.play_over)/sum(a.total_play)
|
|
|
- else 0 end as playOverRate, -- 整体完播率
|
|
|
-
|
|
|
- case
|
|
|
- when sum(a.click) != 0
|
|
|
- then sum(a.convert_material)/sum(a.click)
|
|
|
- else 0 end as convertRate, -- 转化率 转化数/点击数*100% !
|
|
|
- sum(a.active) as active, -- 应用下载-激活
|
|
|
- sum(a.download_finish) as downloadFinish, -- 应用下载-安卓下载完成
|
|
|
- sum(a.download_start) as downloadStart, -- 应用下载-安卓下载开始
|
|
|
- sum(a.install_finish) as installFinish, -- 应用下载-安卓安装完成
|
|
|
- sum(a.register) as register, -- 应用下载-注册
|
|
|
- sum(a.pay_count) as payCount, -- 应用下载-付费数
|
|
|
- sum(a.in_app_uv) as inAppUv, -- 应用下载-到达uv
|
|
|
- sum(a.in_app_detail_uv) as inAppDetailUv, -- 应用下载-详情页到站uv
|
|
|
- sum(a.in_app_cart) as inAppCart, -- 应用下载-加入购物车
|
|
|
- sum(a.in_app_order) as inAppOrder, -- 应用下载-提交订单
|
|
|
- sum(a.in_app_pay) as inAppPay, -- 应用下载-付费
|
|
|
- sum(a.phone) as phone, -- 落地页-电话拨打数
|
|
|
- sum(a.form) as form, -- 表单提交数
|
|
|
- sum(a.map_search) as mapSearch, -- 落地页-地图搜索
|
|
|
- sum(a.button) as button, -- 落地页-按钮button
|
|
|
- sum(a.view_material) as viewMaterial, -- 落地页-关键页面浏览
|
|
|
- sum(a.qq) as qq, -- 落地页-QQ咨询数
|
|
|
- sum(a.lottery) as lottery, -- 落地页-抽奖数
|
|
|
- sum(a.vote) as vote, -- 落地页-投票
|
|
|
- sum(a.redirect) as redirect, -- 落地页-页面跳转
|
|
|
- sum(a.shopping) as shopping, -- 落地页-商品购买
|
|
|
- sum(a.consult) as consult, -- 落地页-在线咨询
|
|
|
- sum(a.wechat) as wechat, -- 落地页-微信
|
|
|
- sum(a.phone_confirm) as phoneConfirm, -- 落地页-智能电话确认拨打
|
|
|
- sum(a.phone_connect) as phoneConnect, -- 落地页-智能电话确认接通
|
|
|
- sum(a.consult_effective) as consultEffective, -- 落地页-智能电话有效咨询
|
|
|
- sum(a.total_play) as totalPlay, -- 视频-总播放
|
|
|
- sum(a.valid_play) as validPlay, -- 视频-有效播放
|
|
|
- sum(a.wifi_play) as wifiPlay, -- 视频-wifi播放
|
|
|
- <!-- sum(a.play_duration_sum) as play_duration_sum, --> -- 视频-播放时长,单位ms
|
|
|
- sum(a.play25_feed_break) as play25FeedBreak, -- 视频-播放25%进度总数
|
|
|
- sum(a.play50_feed_break) as play50FeedBreak, -- 视频-播放50%进度总数
|
|
|
- sum(a.play75_feed_break) as play75FeedBreak, -- 视频-播放75%进度总数
|
|
|
- sum(a.play100_feed_break) as play100FeedBreak, -- 视频-播放100%进度总数
|
|
|
- sum(a.advanced_creative_phone_click) as advancedCreativePhoneClick, -- 附加创意-电话按钮
|
|
|
- sum(a.advanced_creative_counsel_click) as advancedCreativeCounselClick, -- 附加创意-在线咨询
|
|
|
- sum(a.advanced_creative_form_click) as advancedCreativeFormClick, -- 附加创意-表单提交
|
|
|
- sum(a.share_material) as shareMaterial, -- 互动数据-分享数
|
|
|
- sum(a.comment_material) as commentMaterial, -- 互动数据-评论数
|
|
|
- sum(a.follow) as follow, -- 互动数据-新增关注数
|
|
|
- sum(a.home_visited) as homeVisited, -- 互动数据-主页访问量
|
|
|
- sum(a.ies_challenge_click) as iesChallengeClick, -- 互动数据-挑战赛查看数
|
|
|
- sum(a.ies_music_click) as iesMusicClick, -- 互动数据-音乐查看数
|
|
|
- sum(a.next_day_open) as nextDayOpen, -- 次留数
|
|
|
- case
|
|
|
- when sum(a.active) != 0
|
|
|
- then sum(a.next_day_open)/sum(a.active)
|
|
|
- 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, -- 次留成本 = 消耗/次留数
|
|
|
-
|
|
|
- case when sum(a.pay_count) != 0
|
|
|
- then sum(a.cost)/sum(a.pay_count)
|
|
|
- else 0 end
|
|
|
- as activePayCost, -- 应用下载广告数据-付费成本 = 消耗/付费次数
|
|
|
-
|
|
|
-
|
|
|
- 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, -- 视频数据-有效播放成本 计算公式:总花费/有效播放数,当天数据可能会有波动,次日早8点后稳定。
|
|
|
- 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, -- 应用下载广告数据-付费成本 = 消耗/付费次数
|
|
|
- sum(a.download) as download, -- 落地页转化数据-下载开始
|
|
|
- <!--sum(a.cpa) as cpa, -->--
|
|
|
- case
|
|
|
- when sum(a.click) != 0
|
|
|
- then sum(a.cost) / sum(a.click)
|
|
|
- else 0 end as cpc, -- 平均点击单价
|
|
|
- sum(a.location_click) as locationClick, -- 互动数据-POI点击数
|
|
|
- -- sum(a.play_over_rate) as playOverRate, -- 视频数据-播完率
|
|
|
-
|
|
|
- case
|
|
|
- when sum(a.show_material) != 0
|
|
|
- then sum(a.click)/sum(a.show_material)
|
|
|
- else 0 end as ctr, -- 展现数据-点击率 广告被点击的次数占展示次数的百分比。计算方法:点击数/展示数*100%
|
|
|
-
|
|
|
- case
|
|
|
- when sum(a.show_material) != 0
|
|
|
- then sum(a.cost)/sum(a.show_material)*1000
|
|
|
- else 0 end cpm, -- 平均千次展现费用 广告平均每一千次展现所付出的费用,计算公式是:总花费/展示数*1000。
|
|
|
- sum(a.wifi_play_rate) as wifiPlayRate, -- 视频数据-WiFi播放占比
|
|
|
- sum(a.like_material) as likeMaterial, -- 互动数据-点赞数
|
|
|
- <!-- sum(a.active_pay_rate) as activePayRate,--> -- 应用下载广告数据-付费率
|
|
|
-
|
|
|
- case
|
|
|
- when sum(a.active) != 0
|
|
|
- then sum(a.cost)/sum(a.active)
|
|
|
- else 0 end activeCost, -- 应用下载广告数据-激活成本 计算方式:总花费/激活数。
|
|
|
-
|
|
|
- case
|
|
|
- when sum(a.game_addiction) != 0
|
|
|
- then sum(a.cost)/sum(a.game_addiction)
|
|
|
- else 0 end as gameAddictionCost, -- 应用下载广告数据-关键行为成本 广告主为每个有APP内关键行为的用户所付出的成本,计算公式是总花费/关键行为数。当天数据可能会有波动,次日早8点后稳定。
|
|
|
- sum(a.game_addiction) as gameAddiction, -- 应用下载广告数据-关键行为数
|
|
|
-
|
|
|
- case
|
|
|
- when sum(a.click) != 0
|
|
|
- then sum(a.active)/sum(a.click)
|
|
|
- else 0 end as activeRate, -- 应用下载广告数据-激活率 计算方式:激活数/点击数*100%
|
|
|
- <!-- sum(a.play_duration_10s) as playDuration10s,--> --
|
|
|
- <!-- sum(a.phone_effective) as phone_effective,--> --
|
|
|
-
|
|
|
- case
|
|
|
- when sum(a.active) != 0
|
|
|
- then sum(a.game_addiction)/sum(a.active)
|
|
|
- else 0 end gameAddictionRate, -- 应用下载广告数据-关键行为率 关键行为用户占激活用户的比例
|
|
|
-
|
|
|
- case
|
|
|
- when sum(a.active) != 0
|
|
|
- then sum(a.register)/sum(a.active)
|
|
|
- else 0 end as activeRegisterRate, -- 应用下载广告数据-注册率 注册用户占激活用户的比例
|
|
|
- <!-- sum(a.average_video_play) as averageVideoPlay,--> --
|
|
|
-
|
|
|
- case
|
|
|
- when sum(a.download_finish) != 0
|
|
|
- then sum(a.cost)/sum(a.download_finish)
|
|
|
- else 0 end as downloadFinishCost, -- 应用下载广告数据-安卓下载完成成本 计算方式:总花费/安卓下载完成数。
|
|
|
- <!--sum(a.play_duration_3s) as playDuration3s,--> --
|
|
|
-
|
|
|
- case
|
|
|
- when sum(a.register) != 0
|
|
|
- then sum(a.cost)/sum(a.register)
|
|
|
- else 0 end as activeRegisterCost, -- 应用下载广告数据-注册成本 总花费/注册数,当天数据可能会有波动,次日早8点后稳定。
|
|
|
- sum(a.show_material) as showMaterial, -- 展现数据-展示数
|
|
|
-
|
|
|
- <!-- case
|
|
|
- when sum(a.click) != 0
|
|
|
- then sum(a.convert_material)/sum(a.click)
|
|
|
- else 0 end as convertRate, 转化数据-转化率 计算方式:转化数/点击数*100% -->
|
|
|
-
|
|
|
- case
|
|
|
- when sum(a.download_start) != 0
|
|
|
- then sum(a.download_finish)/sum(a.download_start)
|
|
|
- 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, -- 应用下载广告数据-安卓安装完成率 计算方式:安卓安装完成数/安卓下载完成数
|
|
|
- sum(a.coupon) as coupon, -- 落地页转化数据-建站卡券领取
|
|
|
- sum(a.coupon_single_page) as couponSinglePage, -- 落地页转化数据-卡券页领取
|
|
|
- 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, -- 应用下载广告数据-安卓下载开始成本 计算方法:总花费/安卓下载开始数。
|
|
|
- sum(a.message) as message, -- 落地页转化数据-短信咨询 用户点击短信咨询的次数
|
|
|
- <!-- sum(a.play_duration) as playDuration, --> --
|
|
|
-
|
|
|
- case
|
|
|
- when sum(a.show_material) != 0
|
|
|
- then sum(a.valid_play)/sum(a.show_material)
|
|
|
- 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, -- 视频数据-平均单次播放时长
|
|
|
-
|
|
|
- case
|
|
|
- when sum(a.convert_material) != 0
|
|
|
- then sum(a.cost)/sum(a.convert_material)
|
|
|
- else 0 end as convertCost, -- 转化数据-转化成本=总花费/转化数
|
|
|
- <!-- sum(a.convert_show_rate) as convert_show_rate, --> --
|
|
|
-
|
|
|
- case
|
|
|
- when sum(a.install_finish) != 0
|
|
|
- then sum(a.cost)/sum(a.install_finish)
|
|
|
- else 0 end as installFinishCost, -- 应用下载广告数据-安卓安装完成成本 计算方式:总花费/安卓安装完成数
|
|
|
-
|
|
|
- case
|
|
|
- when sum(a.click) != 0
|
|
|
- then sum(a.download_start)/sum(a.click)
|
|
|
- else 0 end as downloadStartRate, -- 应用下载广告数据-安卓下载开始率 计算方法:安卓下载开始数/点击数
|
|
|
-
|
|
|
- #{companyId} as companyId
|
|
|
- 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 ctop_bytedance_video_info d on a.material_id = d.material_id
|
|
|
- left join (select code,url,material_name from ctop_material_info group by code) e on d.signature = e.code
|
|
|
- where c.company_id = #{companyId} -- '6608ed13c0dd42de93c790dbdf124234'
|
|
|
- and a.image_mode in ('CREATIVE_IMAGE_MODE_VIDEO',
|
|
|
- 'CREATIVE_IMAGE_MODE_VIDEO_VERTICAL')
|
|
|
- and date_format(stat_datetime,'%Y-%m-%d') >= #{startDate}
|
|
|
- and date_format(stat_datetime,'%Y-%m-%d') <= #{endDate}
|
|
|
- group by `statDatetime`,`signature`
|
|
|
- order by `statDatetime`,`projectId`,`signature`
|
|
|
- </select>
|
|
|
-
|
|
|
<select id="getVideoReportDailyByDateAndSignature" resultType="java.math.BigDecimal">
|
|
|
select
|
|
|
sum(cost)
|
|
@@ -245,7 +11,7 @@
|
|
|
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
|
|
@@ -465,243 +231,8 @@
|
|
|
when sum(a.click) != 0
|
|
|
then sum(a.download_start) / sum(a.click)
|
|
|
else 0 end as downloadStartRate -- 应用下载广告数据-安卓下载开始率 计算方法:安卓下载开始数/点击数
|
|
|
- -- a.huanbi as huanbi
|
|
|
</sql>
|
|
|
|
|
|
- <select id="videoInfoListGroupAdminOld" 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 ctop_bytedance_account_video_map p on a.signature = p.signature
|
|
|
- where stat_datetime >= #{startDate}
|
|
|
- and stat_datetime <= #{endDate}
|
|
|
- and f.material_id is not null
|
|
|
- <!-- <if test="accountIds != null">
|
|
|
- and p.account_id in
|
|
|
- <foreach item="item" index="index" collection="accountIds" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>-->
|
|
|
-
|
|
|
- <if test="accountIds != null">
|
|
|
- and f.material_id in
|
|
|
- (select signature from ctop_bytedance_account_video_map
|
|
|
- where account_id in
|
|
|
- <foreach item="item" index="index" collection="accountIds" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- group by signature
|
|
|
- )
|
|
|
- </if>
|
|
|
-
|
|
|
- <if test="signature != null and signature != '' ">
|
|
|
- and a.signature = #{signature}
|
|
|
- </if>
|
|
|
- group by a.signature
|
|
|
- <if test="cost != null">
|
|
|
- having sum(a.cost) >= #{cost}
|
|
|
- </if>
|
|
|
- order by sum(a.cost)
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="videoInfoListGroupdesignTeamLeaderOld" 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 ctop_bytedance_account_video_map p on a.signature = p.signature
|
|
|
- where stat_datetime >= #{startDate}
|
|
|
- and stat_datetime <= #{endDate}
|
|
|
- and a.company_id = #{companyId}
|
|
|
- and f.material_id is not null
|
|
|
- <!-- and f.material_id is not null-->
|
|
|
- <!-- <if test="accountIds != null">-->
|
|
|
- <!-- and p.account_id in-->
|
|
|
- <!-- <foreach item="item" index="index" collection="accountIds" open="(" separator="," close=")">-->
|
|
|
- <!-- #{item}-->
|
|
|
- <!-- </foreach>-->
|
|
|
- <!-- </if>-->
|
|
|
- <if test="accountIds != null">
|
|
|
- and f.material_id in
|
|
|
- (select signature from ctop_bytedance_account_video_map
|
|
|
- where account_id in
|
|
|
- <foreach item="item" index="index" collection="accountIds" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- group by signature
|
|
|
- )
|
|
|
- </if>
|
|
|
-
|
|
|
- <if test="signature != null and signature != '' ">
|
|
|
- and a.signature = #{signature}
|
|
|
- </if>
|
|
|
- group by a.signature
|
|
|
- <if test="cost != null">
|
|
|
- having sum(a.cost) >= #{cost}
|
|
|
- </if>
|
|
|
- order by sum(a.cost)
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="videoInfoListGroupPlaneAndPlaneLeaderOld" 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 ctop_bytedance_account_video_map p on a.signature = p.signature
|
|
|
- where stat_datetime >= #{startDate}
|
|
|
- and stat_datetime <= #{endDate}
|
|
|
- and a.company_id = #{companyId}
|
|
|
- and f.material_id is not null
|
|
|
- and f.plane_id = #{userId}
|
|
|
- <if test="accountIds != null">
|
|
|
- and f.material_id in
|
|
|
- (select signature from ctop_bytedance_account_video_map
|
|
|
- where account_id in
|
|
|
- <foreach item="item" index="index" collection="accountIds" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- group by signature
|
|
|
- )
|
|
|
- </if>
|
|
|
- <if test="signature != null and signature != '' ">
|
|
|
- and a.signature = #{signature}
|
|
|
- </if>
|
|
|
- group by a.signature
|
|
|
- <if test="cost != null">
|
|
|
- having sum(a.cost) >= #{cost}
|
|
|
- </if>
|
|
|
- order by sum(a.cost)
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="videoInfoListGroupPlanOld" 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 ctop_bytedance_account_video_map p on a.signature = p.signature
|
|
|
- where stat_datetime >= #{startDate}
|
|
|
- and stat_datetime <= #{endDate}
|
|
|
- and a.company_id = #{companyId}
|
|
|
- and f.material_id is not null
|
|
|
- and f.plan_id = #{userId}
|
|
|
- <if test="accountIds != null">
|
|
|
- and f.material_id in
|
|
|
- (select signature from ctop_bytedance_account_video_map
|
|
|
- where account_id in
|
|
|
- <foreach item="item" index="index" collection="accountIds" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- group by signature
|
|
|
- )
|
|
|
- </if>
|
|
|
- <if test="signature != null and signature != '' ">
|
|
|
- and a.signature = #{signature}
|
|
|
- </if>
|
|
|
- group by a.signature
|
|
|
- <if test="cost != null">
|
|
|
- having sum(a.cost) >= #{cost}
|
|
|
- </if>
|
|
|
- order by sum(a.cost)
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="videoInfoListGroupClipOld" 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 ctop_bytedance_account_video_map p on a.signature = p.signature
|
|
|
- where stat_datetime >= #{startDate}
|
|
|
- and stat_datetime <= #{endDate}
|
|
|
- and a.company_id = #{companyId}
|
|
|
- and f.material_id is not null
|
|
|
- and f.clip_id = #{userId}
|
|
|
- <if test="accountIds != null">
|
|
|
- and f.material_id in
|
|
|
- (select signature from ctop_bytedance_account_video_map
|
|
|
- where account_id in
|
|
|
- <foreach item="item" index="index" collection="accountIds" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- group by signature
|
|
|
- )
|
|
|
- </if>
|
|
|
- <if test="signature != null and signature != '' ">
|
|
|
- and a.signature = #{signature}
|
|
|
- </if>
|
|
|
- group by a.signature
|
|
|
- <if test="cost != null">
|
|
|
- having sum(a.cost) >= #{cost}
|
|
|
- </if>
|
|
|
- order by sum(a.cost)
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="videoInfoListGroupShotOld" 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 ctop_bytedance_account_video_map p on a.signature = p.signature
|
|
|
- where stat_datetime >= #{startDate}
|
|
|
- and stat_datetime <= #{endDate}
|
|
|
- and a.company_id = #{companyId}
|
|
|
- and f.material_id is not null
|
|
|
- and f.shot_id = #{userId}
|
|
|
- <if test="accountIds != null">
|
|
|
- and f.material_id in
|
|
|
- (select signature from ctop_bytedance_account_video_map
|
|
|
- where account_id in
|
|
|
- <foreach item="item" index="index" collection="accountIds" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- group by signature
|
|
|
- )
|
|
|
- </if>
|
|
|
- <if test="signature != null and signature != '' ">
|
|
|
- and a.signature = #{signature}
|
|
|
- </if>
|
|
|
- group by a.signature
|
|
|
- <if test="cost != null">
|
|
|
- having sum(a.cost) >= #{cost}
|
|
|
- </if>
|
|
|
- order by sum(a.cost)
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="videoInfoListGroupOperatorOld" 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 ctop_bytedance_account_video_map p on a.signature = p.signature
|
|
|
- where stat_datetime >= #{startDate}
|
|
|
- and stat_datetime <= #{endDate}
|
|
|
- and f.material_id is not null
|
|
|
- <!-- and p.account_id in-->
|
|
|
- <!-- <foreach item="item" index="index" collection="accountIds" open="(" separator="," close=")">-->
|
|
|
- <!-- #{item}-->
|
|
|
- <!-- </foreach>-->
|
|
|
-
|
|
|
- <if test="accountIds != null">
|
|
|
- and f.material_id in
|
|
|
- (select signature from ctop_bytedance_account_video_map
|
|
|
- where account_id in
|
|
|
- <foreach item="item" index="index" collection="accountIds" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- group by signature
|
|
|
- )
|
|
|
- </if>
|
|
|
-
|
|
|
- <if test="signature != null and signature != '' ">
|
|
|
- and a.signature = #{signature}
|
|
|
- </if>
|
|
|
- group by a.signature
|
|
|
- <if test="cost != null">
|
|
|
- having sum(a.cost) >= #{cost}
|
|
|
- </if>
|
|
|
- order by sum(a.cost)
|
|
|
- </select>
|
|
|
-
|
|
|
<select id="getRoleCodeByUserId" resultType="string">
|
|
|
select
|
|
|
role_code
|
|
@@ -759,19 +290,16 @@
|
|
|
</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,
|
|
|
- a.cost as cost, -- 消耗
|
|
|
- -- a.signature as signature,
|
|
|
- a.video_url as videoUrl,
|
|
|
- (select info.url from ctop_material_info info where info.code = a.signature limit 1) as url,
|
|
|
- huanbi as huanbi,
|
|
|
- signature as signature
|
|
|
+ select
|
|
|
+ a.account_id as accountId,
|
|
|
+ a.advertiser_id as advertiserId,
|
|
|
+ a.advertiser_name as advertiserName,
|
|
|
+ a.stat_datetime as statDatetime,
|
|
|
+ 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,
|
|
|
+ huanbi as huanbi,
|
|
|
+ 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
|
|
@@ -800,19 +328,18 @@
|
|
|
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>
|
|
|
|
|
|
-
|
|
|
<select id="getAccountIdByprojectIds" resultType="long">
|
|
|
select
|
|
|
account_id
|
|
@@ -837,12 +364,8 @@
|
|
|
and media_id = #{mediaId}
|
|
|
</select>
|
|
|
|
|
|
-
|
|
|
<select id="videoInfoList" resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
|
select
|
|
|
- -- a.material_id as materialId,
|
|
|
- -- a.account_id as accountId,
|
|
|
- -- b.auth_name as authName,
|
|
|
a.account_id as accountId,
|
|
|
b.project_id as projectId,
|
|
|
b.project_name as projectName,
|
|
@@ -853,7 +376,6 @@
|
|
|
d.signature as signature,
|
|
|
d.video_url as videoUrl,
|
|
|
e.url as url,
|
|
|
- <!-- e.material_name as materialName, -->
|
|
|
'-' as materialDesc,
|
|
|
1 as appType,
|
|
|
sum(a.click) as click, -- 点击数
|
|
@@ -900,7 +422,6 @@
|
|
|
sum(a.total_play) as totalPlay, -- 视频-总播放
|
|
|
sum(a.valid_play) as validPlay, -- 视频-有效播放
|
|
|
sum(a.wifi_play) as wifiPlay, -- 视频-wifi播放
|
|
|
- <!-- sum(a.play_duration_sum) as play_duration_sum, --> -- 视频-播放时长,单位ms
|
|
|
sum(a.play25_feed_break) as play25FeedBreak, -- 视频-播放25%进度总数
|
|
|
sum(a.play50_feed_break) as play50FeedBreak, -- 视频-播放50%进度总数
|
|
|
sum(a.play75_feed_break) as play75FeedBreak, -- 视频-播放75%进度总数
|
|
@@ -930,7 +451,6 @@
|
|
|
else 0 end
|
|
|
as activePayCost, -- 应用下载广告数据-付费成本 = 消耗/付费次数
|
|
|
|
|
|
-
|
|
|
sum(a.active_pay_amount) as activePayAmount, -- 应用下载广告数据-付费次数
|
|
|
|
|
|
case
|
|
@@ -945,13 +465,12 @@
|
|
|
then sum(a.cost)/sum(a.active_pay_amount)
|
|
|
else 0 end as activePayCost, -- 应用下载广告数据-付费成本 = 消耗/付费次数
|
|
|
sum(a.download) as download, -- 落地页转化数据-下载开始
|
|
|
- <!--sum(a.cpa) as cpa, -->--
|
|
|
+
|
|
|
case
|
|
|
when sum(a.click) != 0
|
|
|
then sum(a.cost) / sum(a.click)
|
|
|
else 0 end as cpc, -- 平均点击单价
|
|
|
sum(a.location_click) as locationClick, -- 互动数据-POI点击数
|
|
|
- -- sum(a.play_over_rate) as playOverRate, -- 视频数据-播完率
|
|
|
|
|
|
case
|
|
|
when sum(a.show_material) != 0
|
|
@@ -964,7 +483,6 @@
|
|
|
else 0 end cpm, -- 平均千次展现费用 广告平均每一千次展现所付出的费用,计算公式是:总花费/展示数*1000。
|
|
|
sum(a.wifi_play_rate) as wifiPlayRate, -- 视频数据-WiFi播放占比
|
|
|
sum(a.like_material) as likeMaterial, -- 互动数据-点赞数
|
|
|
- <!-- sum(a.active_pay_rate) as activePayRate,--> -- 应用下载广告数据-付费率
|
|
|
|
|
|
case
|
|
|
when sum(a.active) != 0
|
|
@@ -981,8 +499,6 @@
|
|
|
when sum(a.click) != 0
|
|
|
then sum(a.active)/sum(a.click)
|
|
|
else 0 end as activeRate, -- 应用下载广告数据-激活率 计算方式:激活数/点击数*100%
|
|
|
- <!-- sum(a.play_duration_10s) as playDuration10s,--> --
|
|
|
- <!-- sum(a.phone_effective) as phone_effective,--> --
|
|
|
|
|
|
case
|
|
|
when sum(a.active) != 0
|
|
@@ -993,13 +509,13 @@
|
|
|
when sum(a.active) != 0
|
|
|
then sum(a.register)/sum(a.active)
|
|
|
else 0 end as activeRegisterRate, -- 应用下载广告数据-注册率 注册用户占激活用户的比例
|
|
|
- <!-- sum(a.average_video_play) as averageVideoPlay,--> --
|
|
|
+
|
|
|
|
|
|
case
|
|
|
when sum(a.download_finish) != 0
|
|
|
then sum(a.cost)/sum(a.download_finish)
|
|
|
else 0 end as downloadFinishCost, -- 应用下载广告数据-安卓下载完成成本 计算方式:总花费/安卓下载完成数。
|
|
|
- <!--sum(a.play_duration_3s) as playDuration3s,--> --
|
|
|
+
|
|
|
|
|
|
case
|
|
|
when sum(a.register) != 0
|
|
@@ -1007,11 +523,6 @@
|
|
|
else 0 end as activeRegisterCost, -- 应用下载广告数据-注册成本 总花费/注册数,当天数据可能会有波动,次日早8点后稳定。
|
|
|
sum(a.show_material) as showMaterial, -- 展现数据-展示数
|
|
|
|
|
|
- <!-- case
|
|
|
- when sum(a.click) != 0
|
|
|
- then sum(a.convert_material)/sum(a.click)
|
|
|
- else 0 end as convertRate, 转化数据-转化率 计算方式:转化数/点击数*100% -->
|
|
|
-
|
|
|
case
|
|
|
when sum(a.download_start) != 0
|
|
|
then sum(a.download_finish)/sum(a.download_start)
|
|
@@ -1081,9 +592,9 @@
|
|
|
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>
|
|
@@ -1091,15 +602,7 @@
|
|
|
<if test="cost != null">
|
|
|
having sum(a.cost) >= #{cost}
|
|
|
</if>
|
|
|
- <!--
|
|
|
- <choose>
|
|
|
- <when test="order != null and order != '' and sort != null and sort != '' ">
|
|
|
- order by #{order} #{sort}
|
|
|
- </when>
|
|
|
- <otherwise>
|
|
|
- order by cost desc
|
|
|
- </otherwise>
|
|
|
- </choose>-->
|
|
|
+
|
|
|
</select>
|
|
|
|
|
|
<select id="videoInfoListGroupShot" resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
@@ -1126,14 +629,6 @@
|
|
|
having sum(a.cost) >= #{cost}
|
|
|
</if>
|
|
|
|
|
|
- <!-- <choose>
|
|
|
- <when test="order != null and order != '' and sort != null and sort != '' ">
|
|
|
- order by #{order} #{sort}
|
|
|
- </when>
|
|
|
- <otherwise>
|
|
|
- order by cost desc
|
|
|
- </otherwise>
|
|
|
- </choose>-->
|
|
|
</select>
|
|
|
|
|
|
<select id="videoInfoListGroupAdmin" resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
@@ -1184,14 +679,6 @@
|
|
|
having sum(a.cost) >= #{cost}
|
|
|
</if>
|
|
|
|
|
|
- <!-- <choose>
|
|
|
- <when test="order != null and order != '' and sort != null and sort != '' ">
|
|
|
- order by #{order} #{sort}
|
|
|
- </when>
|
|
|
- <otherwise>
|
|
|
- order by cost desc
|
|
|
- </otherwise>
|
|
|
- </choose>-->
|
|
|
</select>
|
|
|
|
|
|
<select id="videoInfoListGroupPlaneAndPlaneLeader" resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
@@ -1218,14 +705,6 @@
|
|
|
having sum(a.cost) >= #{cost}
|
|
|
</if>
|
|
|
|
|
|
- <!-- <choose>
|
|
|
- <when test="order != null and order != '' and sort != null and sort != '' ">
|
|
|
- order by #{order} #{sort}
|
|
|
- </when>
|
|
|
- <otherwise>
|
|
|
- order by cost desc
|
|
|
- </otherwise>
|
|
|
- </choose>-->
|
|
|
</select>
|
|
|
|
|
|
<select id="videoInfoListGroupPlan" resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
@@ -1252,14 +731,6 @@
|
|
|
having sum(a.cost) >= #{cost}
|
|
|
</if>
|
|
|
|
|
|
- <!-- <choose>
|
|
|
- <when test="order != null and order != '' and sort != null and sort != '' ">
|
|
|
- order by #{order} #{sort}
|
|
|
- </when>
|
|
|
- <otherwise>
|
|
|
- order by cost desc
|
|
|
- </otherwise>
|
|
|
- </choose>-->
|
|
|
</select>
|
|
|
|
|
|
<select id="videoInfoListGroupClip" resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
@@ -1286,14 +757,6 @@
|
|
|
having sum(a.cost) >= #{cost}
|
|
|
</if>
|
|
|
|
|
|
- <!-- <choose>
|
|
|
- <when test="order != null and order != '' and sort != null and sort != '' ">
|
|
|
- order by #{order} #{sort}
|
|
|
- </when>
|
|
|
- <otherwise>
|
|
|
- order by cost desc
|
|
|
- </otherwise>
|
|
|
- </choose>-->
|
|
|
</select>
|
|
|
|
|
|
</mapper>
|