|
@@ -92,31 +92,34 @@
|
|
END
|
|
END
|
|
) conversionPrice, -- 转化单价
|
|
) conversionPrice, -- 转化单价
|
|
|
|
|
|
- t2.url url, -- 视频url
|
|
|
|
|
|
+ -- t2.url url, -- 视频url
|
|
|
|
+
|
|
|
|
+ (SELECT url
|
|
|
|
+ FROM ctop_kuaishou_video_get
|
|
|
|
+ WHERE signature = t2.signature
|
|
|
|
+ LIMIT 1
|
|
|
|
+ ) url,
|
|
t2.signature signature -- 视频md5
|
|
t2.signature signature -- 视频md5
|
|
from
|
|
from
|
|
ctop_user_allocation t1
|
|
ctop_user_allocation t1
|
|
left join
|
|
left join
|
|
- ctop_kuaishou_report_hourly_creative_statistic t2
|
|
|
|
|
|
+ ctop_kuaishou_report_daily_creative t2
|
|
on t1.account_id = t2.account_id
|
|
on t1.account_id = t2.account_id
|
|
|
|
+
|
|
<where>
|
|
<where>
|
|
<if test="userId != null">
|
|
<if test="userId != null">
|
|
and t1.user_id = #{userId,jdbcType=VARCHAR}
|
|
and t1.user_id = #{userId,jdbcType=VARCHAR}
|
|
</if>
|
|
</if>
|
|
- and t1.media_id = '2'
|
|
|
|
- and t1.account_id != ''
|
|
|
|
- and t2.signature != ''
|
|
|
|
|
|
+
|
|
<if test="startDate != null">
|
|
<if test="startDate != null">
|
|
and t2.stat_date = #{startDate}
|
|
and t2.stat_date = #{startDate}
|
|
</if>
|
|
</if>
|
|
- <if test="statHour != null">
|
|
|
|
- and t2.stat_hour <= #{statHour}
|
|
|
|
- </if>
|
|
|
|
|
|
+ and t2.signature is not null
|
|
</where>
|
|
</where>
|
|
-
|
|
|
|
group by t2.signature
|
|
group by t2.signature
|
|
order by sum(t2.charge) desc
|
|
order by sum(t2.charge) desc
|
|
- limit 100
|
|
|
|
|
|
+ limit 100;
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
</select>
|
|
</select>
|
|
@@ -207,8 +210,6 @@
|
|
|
|
|
|
<select id="selectDailyByMap" parameterType="Map" resultType="com.alibaba.fastjson.JSONObject">
|
|
<select id="selectDailyByMap" parameterType="Map" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
SELECT
|
|
SELECT
|
|
sum(t2.charge) cost, -- 花费
|
|
sum(t2.charge) cost, -- 花费
|
|
sum(t2.photo_show) photoShow, -- 封面曝光数
|
|
sum(t2.photo_show) photoShow, -- 封面曝光数
|
|
@@ -471,87 +472,85 @@
|
|
|
|
|
|
<select id="selectDayMaterialList" parameterType="Map" resultType="com.alibaba.fastjson.JSONObject">
|
|
<select id="selectDayMaterialList" parameterType="Map" resultType="com.alibaba.fastjson.JSONObject">
|
|
SELECT
|
|
SELECT
|
|
- sum(charge) cost, -- 花费
|
|
|
|
- sum(photo_show) photoShow, -- 封面曝光数
|
|
|
|
- sum(photo_click) photoClick, -- 封面点击数
|
|
|
|
- sum(aclick) aclick, -- 素材曝光数
|
|
|
|
- sum(bclick) bclick, -- 行为数
|
|
|
|
|
|
+ sum(t1.charge) cost, -- 花费
|
|
|
|
+ sum(t1.photo_show) photoShow, -- 封面曝光数
|
|
|
|
+ sum(t1.photo_click) photoClick, -- 封面点击数
|
|
|
|
+ sum(t1.aclick) aclick, -- 素材曝光数
|
|
|
|
+ sum(t1.bclick) bclick, -- 行为数
|
|
(case
|
|
(case
|
|
- when sum(photo_show) != 0
|
|
|
|
- then (sum(photo_click) / sum(photo_show))
|
|
|
|
|
|
+ when sum(t1.photo_show) != 0
|
|
|
|
+ then (sum(t1.photo_click) / sum(t1.photo_show))
|
|
else 0
|
|
else 0
|
|
end
|
|
end
|
|
) photoClickRatio, -- 封面点击率
|
|
) photoClickRatio, -- 封面点击率
|
|
|
|
|
|
(case
|
|
(case
|
|
- when sum(aclick) != 0
|
|
|
|
- then (sum(bclick) / sum(aclick))
|
|
|
|
|
|
+ when sum(t1.aclick) != 0
|
|
|
|
+ then (sum(t1.bclick) / sum(t1.aclick))
|
|
else 0
|
|
else 0
|
|
end
|
|
end
|
|
) actionRatio, -- 行为率
|
|
) actionRatio, -- 行为率
|
|
|
|
|
|
(case
|
|
(case
|
|
- when sum(photo_show) != 0
|
|
|
|
- then ((sum(charge) / sum(photo_show)) * 1000)
|
|
|
|
|
|
+ when sum(t1.photo_show) != 0
|
|
|
|
+ then ((sum(t1.charge) / sum(t1.photo_show)) * 1000)
|
|
else 0
|
|
else 0
|
|
end
|
|
end
|
|
) impression1kCost, -- 均千次封面曝光花费
|
|
) impression1kCost, -- 均千次封面曝光花费
|
|
|
|
|
|
(case
|
|
(case
|
|
- when sum(photo_click) != 0
|
|
|
|
- then (sum(charge) / sum(photo_click))
|
|
|
|
|
|
+ when sum(t1.photo_click) != 0
|
|
|
|
+ then (sum(t1.charge) / sum(t1.photo_click))
|
|
else 0
|
|
else 0
|
|
end
|
|
end
|
|
) photoClickCost, -- 平均封面点击单价
|
|
) photoClickCost, -- 平均封面点击单价
|
|
|
|
|
|
(CASE
|
|
(CASE
|
|
- WHEN sum(photo_click) != 0
|
|
|
|
- THEN (sum(charge) / sum(photo_click))
|
|
|
|
|
|
+ WHEN sum(t1.photo_click) != 0
|
|
|
|
+ THEN (sum(t1.charge) / sum(t1.photo_click))
|
|
ELSE 0
|
|
ELSE 0
|
|
end
|
|
end
|
|
) actionCost, -- 平均行为单价
|
|
) actionCost, -- 平均行为单价
|
|
|
|
|
|
(case
|
|
(case
|
|
- WHEN sum(form_count) != 0
|
|
|
|
- THEN sum(form_count)
|
|
|
|
- WHEN sum(activation) != 0
|
|
|
|
- THEN sum(activation)
|
|
|
|
|
|
+ WHEN sum(t1.form_count) != 0
|
|
|
|
+ THEN sum(t1.form_count)
|
|
|
|
+ WHEN sum(t1.activation) != 0
|
|
|
|
+ THEN sum(t1.activation)
|
|
ELSE 0
|
|
ELSE 0
|
|
END
|
|
END
|
|
) conversions, -- 转化数
|
|
) conversions, -- 转化数
|
|
|
|
|
|
(
|
|
(
|
|
CASE
|
|
CASE
|
|
- WHEN sum(form_count) != 0
|
|
|
|
- THEN (sum(charge) / sum(form_count))
|
|
|
|
- WHEN sum(activation) != 0
|
|
|
|
- THEN (sum(charge) / sum(activation))
|
|
|
|
|
|
+ WHEN sum(t1.form_count) != 0
|
|
|
|
+ THEN (sum(t1.charge) / sum(t1.form_count))
|
|
|
|
+ WHEN sum(t1.activation) != 0
|
|
|
|
+ THEN (sum(t1.charge) / sum(t1.activation))
|
|
ELSE 0
|
|
ELSE 0
|
|
END
|
|
END
|
|
) conversionPrice, -- 转化单价
|
|
) conversionPrice, -- 转化单价
|
|
|
|
|
|
- ( SELECT url from ctop_kuaishou_video_get WHERE signature = signature limit 1) url,
|
|
|
|
- signature signature, -- 视频md5
|
|
|
|
- account_id accountId
|
|
|
|
|
|
+ ( SELECT url from ctop_kuaishou_video_get WHERE signature = t1.signature limit 1) url,
|
|
|
|
+ t1.signature signature, -- 视频md5
|
|
|
|
+ t1.account_id accountId
|
|
from
|
|
from
|
|
- ctop_kuaishou_report_daily_creative
|
|
|
|
- where account_id in
|
|
|
|
|
|
+ ctop_kuaishou_report_daily_creative t1
|
|
|
|
+ where t1.account_id in
|
|
<foreach item="item" index="index" collection="accountIds"
|
|
<foreach item="item" index="index" collection="accountIds"
|
|
open="(" separator="," close=")">
|
|
open="(" separator="," close=")">
|
|
#{item}
|
|
#{item}
|
|
</foreach>
|
|
</foreach>
|
|
-
|
|
|
|
-
|
|
|
|
<if test="startDate != null">
|
|
<if test="startDate != null">
|
|
- and stat_date >= #{startDate}
|
|
|
|
|
|
+ and t1.stat_date >= #{startDate}
|
|
</if>
|
|
</if>
|
|
|
|
|
|
<if test="endDate != null">
|
|
<if test="endDate != null">
|
|
- and stat_date <= #{endDate}
|
|
|
|
|
|
+ and t1.stat_date <= #{endDate}
|
|
</if>
|
|
</if>
|
|
- and signature is not null
|
|
|
|
- GROUP BY signature
|
|
|
|
- order by sum(charge) desc
|
|
|
|
|
|
+ and t1.signature is not null
|
|
|
|
+ GROUP BY t1.signature
|
|
|
|
+ order by sum(t1.charge) desc
|
|
limit 100
|
|
limit 100
|
|
</select>
|
|
</select>
|
|
|
|
|