|
@@ -1,5 +1,96 @@
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="cn.com.ctop.bytedance.mapper.BytedanceCreativeDailyReportMapper">
|
|
|
+ <select id="bytedanceCreativeDailyReport" parameterType="Map" resultType="cn.com.ctop.bytedance.entity.BytedanceCreativeDailyReport">
|
|
|
+ select
|
|
|
+ sum(t2.show_num) as showNum, <!-- 展示量 -->
|
|
|
+ sum(t2.click) as click, <!-- 点击量 -->
|
|
|
+ sum(t2.convert_num) as convertNum, <!-- 转化量 -->
|
|
|
+ sum(t2.cost) as cost, <!-- 总花费 -->
|
|
|
+ sum(t2.active) as active, <!-- 应用下载-激活 -->
|
|
|
+ sum(t2.download_finish) as downloadFinish, <!-- 应用下载-安卓下载完成 -->
|
|
|
+ sum(t2.click_install) as clickInstall, <!-- 应用下载-点击安装数 -->
|
|
|
+ sum(t2.in_app_pay) as inAppPay, <!-- 应用下载-付费 -->
|
|
|
+ sum(t2.total_play) as totalPlay, <!-- 视频-总播放 -->
|
|
|
+ sum(t2.valid_play) as validPlay, <!-- 视频-有效播放 -->
|
|
|
+ sum(t2.wifi_play) as wifiPlay, <!-- 视频-wifi播放 -->
|
|
|
+ sum(t2.play100_feed_break) as play100FeedBreak, <!-- 视频-播放100%进度总数 -->
|
|
|
+ sum(t2.play75_feed_break) as play75FeedBreak, <!-- 视频-播放75%进度总数 -->
|
|
|
+ sum(t2.comment) as comment, <!-- 互动数据-评论数 -->
|
|
|
+ AVG(t2.next_day_open) as nextDayOpen, <!-- 次留数 -->
|
|
|
+ AVG(t2.next_day_open_rate) as nextDayOpenRate, <!-- 次留率 -->
|
|
|
+ AVG(t2.next_day_open_cost) as nextDayOpenCost <!-- 次留成本 -->
|
|
|
+ from
|
|
|
+ ctop_user_allocation t1
|
|
|
+ left join ctop_bytedance_report_creative_daily t2 on t1.account_id = t2.advertiser_id
|
|
|
+ left join ctop_bytedance_creative t3 on t2.creative_id = t3.id
|
|
|
+ left join ctop_bytedance_video_info t4 on t3.video_id = t4.id
|
|
|
+ <where>
|
|
|
+ <if test="userId != null">
|
|
|
+ and t1.user_id = #{userId,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ and t1.media_id = '1'
|
|
|
+ and t1.account_id != ''
|
|
|
+ <if test="startDate != null">
|
|
|
+ and t2.stat_datetime <= #{startDate}
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null">
|
|
|
+ and t2.stat_datetime >= #{endDate}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ group by t4.signature
|
|
|
+ order by sum(t2.cost) desc
|
|
|
+ limit 100
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="bytedanceCreativeAccountReport" parameterType="Map" resultType="cn.com.ctop.bytedance.entity.BytedanceCreativeDailyReport">
|
|
|
+ select
|
|
|
+ t2.creative_id as creativeId, <!-- 素材id -->
|
|
|
+ t4.video_url as videoUrl, <!-- 视频url -->
|
|
|
+ sum(t2.show_num) as showNum, <!-- 展示量 -->
|
|
|
+ sum(t2.click) as click, <!-- 点击量 -->
|
|
|
+ sum(t2.convert_num) as convertNum, <!-- 转化量 -->
|
|
|
+ sum(t2.cost) as cost, <!-- 总花费 -->
|
|
|
+ sum(t2.active) as active, <!-- 应用下载-激活 -->
|
|
|
+ sum(t2.download_finish) as downloadFinish, <!-- 应用下载-安卓下载完成 -->
|
|
|
+ sum(t2.click_install) as clickInstall, <!-- 应用下载-点击安装数 -->
|
|
|
+ sum(t2.in_app_pay) as inAppPay, <!-- 应用下载-付费 -->
|
|
|
+ sum(t2.total_play) as totalPlay, <!-- 视频-总播放 -->
|
|
|
+ sum(t2.valid_play) as validPlay, <!-- 视频-有效播放 -->
|
|
|
+ sum(t2.wifi_play) as wifiPlay, <!-- 视频-wifi播放 -->
|
|
|
+ sum(t2.play100_feed_break) as play100FeedBreak, <!-- 视频-播放100%进度总数 -->
|
|
|
+ sum(t2.play75_feed_break) as play75FeedBreak, <!-- 视频-播放75%进度总数 -->
|
|
|
+ sum(t2.comment) as comment, <!-- 互动数据-评论数 -->
|
|
|
+ AVG(t2.next_day_open) as nextDayOpen, <!-- 次留数 -->
|
|
|
+ AVG(t2.next_day_open_rate) as nextDayOpenRate, <!-- 次留率 -->
|
|
|
+ AVG(t2.next_day_open_cost) as nextDayOpenCost <!-- 次留成本 -->
|
|
|
+ from
|
|
|
+ ctop_user_allocation t1
|
|
|
+ left join ctop_bytedance_report_creative_daily t2 on t1.account_id = t2.advertiser_id
|
|
|
+ left join ctop_bytedance_creative t3 on t2.creative_id = t3.id
|
|
|
+ left join ctop_bytedance_video_info t4 on t3.video_id = t4.id
|
|
|
+ where t1.id in
|
|
|
+ <foreach item="item" index="index" collection="accountIds"
|
|
|
+ open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ and
|
|
|
+ <if test="userId != null">
|
|
|
+ and t1.user_id = #{userId,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ and t1.media_id = '1'
|
|
|
+ and t1.account_id != ''
|
|
|
+ <if test="startDate != null">
|
|
|
+ and t2.stat_datetime <= #{startDate}
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null">
|
|
|
+ and t2.stat_datetime >= #{endDate} and
|
|
|
+ </if>
|
|
|
+ 1=1
|
|
|
+ group by t4.signature
|
|
|
+ order by sum(t2.cost) desc
|
|
|
+ limit 100
|
|
|
+ </select>
|
|
|
+
|
|
|
|
|
|
</mapper>
|