|
@@ -206,6 +206,9 @@
|
|
|
|
|
|
|
|
|
|
<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, -- 封面曝光数
|
|
@@ -265,13 +268,13 @@
|
|
ELSE 0
|
|
ELSE 0
|
|
END
|
|
END
|
|
) conversionPrice, -- 转化单价
|
|
) conversionPrice, -- 转化单价
|
|
-
|
|
|
|
- t2.url url, -- 视频url
|
|
|
|
|
|
+ ( SELECT url from ctop_kuaishou_video_get WHERE signature = t2.signature limit 1) url,
|
|
|
|
+ -- t2.url url, -- 视频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_daily_creative_statistic t2
|
|
|
|
|
|
+ ctop_kuaishou_report_daily_creative_new 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">
|
|
@@ -279,7 +282,7 @@
|
|
</if>
|
|
</if>
|
|
and t1.media_id = '2'
|
|
and t1.media_id = '2'
|
|
and t1.account_id != ''
|
|
and t1.account_id != ''
|
|
- and t2.signature != ''
|
|
|
|
|
|
+ and t2.signature is not null
|
|
<if test="startDate != null">
|
|
<if test="startDate != null">
|
|
and t2.stat_date <= #{startDate}
|
|
and t2.stat_date <= #{startDate}
|
|
</if>
|
|
</if>
|
|
@@ -290,6 +293,7 @@
|
|
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>
|
|
|
|
|
|
|
|
|
|
@@ -354,7 +358,7 @@
|
|
END
|
|
END
|
|
) conversionPrice -- 转化单价
|
|
) conversionPrice -- 转化单价
|
|
from
|
|
from
|
|
- ctop_kuaishou_report_daily_creative_statistic
|
|
|
|
|
|
+ ctop_kuaishou_report_daily_creative_new
|
|
<where>
|
|
<where>
|
|
<if test="signature != null">
|
|
<if test="signature != null">
|
|
and signature = #{signature}
|
|
and signature = #{signature}
|
|
@@ -467,90 +471,87 @@
|
|
|
|
|
|
<select id="selectDayMaterialList" parameterType="Map" resultType="com.alibaba.fastjson.JSONObject">
|
|
<select id="selectDayMaterialList" parameterType="Map" resultType="com.alibaba.fastjson.JSONObject">
|
|
SELECT
|
|
SELECT
|
|
- sum(t2.charge) cost, -- 花费
|
|
|
|
- sum(t2.photo_show) photoShow, -- 封面曝光数
|
|
|
|
- sum(t2.photo_click) photoClick, -- 封面点击数
|
|
|
|
- sum(t2.aclick) aclick, -- 素材曝光数
|
|
|
|
- sum(t2.bclick) bclick, -- 行为数
|
|
|
|
|
|
+ sum(charge) cost, -- 花费
|
|
|
|
+ sum(photo_show) photoShow, -- 封面曝光数
|
|
|
|
+ sum(photo_click) photoClick, -- 封面点击数
|
|
|
|
+ sum(aclick) aclick, -- 素材曝光数
|
|
|
|
+ sum(bclick) bclick, -- 行为数
|
|
(case
|
|
(case
|
|
when sum(photo_show) != 0
|
|
when sum(photo_show) != 0
|
|
- then (sum(t2.photo_click) / sum(photo_show))
|
|
|
|
|
|
+ then (sum(photo_click) / sum(photo_show))
|
|
else 0
|
|
else 0
|
|
end
|
|
end
|
|
) photoClickRatio, -- 封面点击率
|
|
) photoClickRatio, -- 封面点击率
|
|
|
|
|
|
(case
|
|
(case
|
|
when sum(aclick) != 0
|
|
when sum(aclick) != 0
|
|
- then (sum(t2.bclick) / sum(aclick))
|
|
|
|
|
|
+ then (sum(bclick) / sum(aclick))
|
|
else 0
|
|
else 0
|
|
end
|
|
end
|
|
) actionRatio, -- 行为率
|
|
) actionRatio, -- 行为率
|
|
|
|
|
|
(case
|
|
(case
|
|
- when sum(t2.photo_show) != 0
|
|
|
|
- then ((sum(t2.charge) / sum(t2.photo_show)) * 1000)
|
|
|
|
|
|
+ when sum(photo_show) != 0
|
|
|
|
+ then ((sum(charge) / sum(photo_show)) * 1000)
|
|
else 0
|
|
else 0
|
|
end
|
|
end
|
|
) impression1kCost, -- 均千次封面曝光花费
|
|
) impression1kCost, -- 均千次封面曝光花费
|
|
|
|
|
|
(case
|
|
(case
|
|
- when sum(t2.photo_click) != 0
|
|
|
|
- then (sum(t2.charge) / sum(t2.photo_click))
|
|
|
|
|
|
+ when sum(photo_click) != 0
|
|
|
|
+ then (sum(charge) / sum(photo_click))
|
|
else 0
|
|
else 0
|
|
end
|
|
end
|
|
) photoClickCost, -- 平均封面点击单价
|
|
) photoClickCost, -- 平均封面点击单价
|
|
|
|
|
|
(CASE
|
|
(CASE
|
|
- WHEN sum(t2.photo_click) != 0
|
|
|
|
- THEN (sum(t2.charge) / sum(t2.photo_click))
|
|
|
|
|
|
+ WHEN sum(photo_click) != 0
|
|
|
|
+ THEN (sum(charge) / sum(photo_click))
|
|
ELSE 0
|
|
ELSE 0
|
|
end
|
|
end
|
|
) actionCost, -- 平均行为单价
|
|
) actionCost, -- 平均行为单价
|
|
|
|
|
|
(case
|
|
(case
|
|
- WHEN sum(t2.form_count) != 0
|
|
|
|
- THEN sum(t2.form_count)
|
|
|
|
- WHEN sum(t2.activation) != 0
|
|
|
|
- THEN sum(t2.activation)
|
|
|
|
|
|
+ WHEN sum(form_count) != 0
|
|
|
|
+ THEN sum(form_count)
|
|
|
|
+ WHEN sum(activation) != 0
|
|
|
|
+ THEN sum(activation)
|
|
ELSE 0
|
|
ELSE 0
|
|
END
|
|
END
|
|
) conversions, -- 转化数
|
|
) conversions, -- 转化数
|
|
|
|
|
|
(
|
|
(
|
|
CASE
|
|
CASE
|
|
- WHEN sum(t2.form_count) != 0
|
|
|
|
- THEN (sum(t2.charge) / sum(t2.form_count))
|
|
|
|
- WHEN sum(t2.activation) != 0
|
|
|
|
- THEN (sum(t2.charge) / sum(t2.activation))
|
|
|
|
|
|
+ WHEN sum(form_count) != 0
|
|
|
|
+ THEN (sum(charge) / sum(form_count))
|
|
|
|
+ WHEN sum(activation) != 0
|
|
|
|
+ THEN (sum(charge) / sum(activation))
|
|
ELSE 0
|
|
ELSE 0
|
|
END
|
|
END
|
|
) conversionPrice, -- 转化单价
|
|
) conversionPrice, -- 转化单价
|
|
|
|
|
|
- t2.url url, -- 视频url
|
|
|
|
- t2.signature signature, -- 视频md5
|
|
|
|
- t2.account_id accountId
|
|
|
|
|
|
+ ( SELECT url from ctop_kuaishou_video_get WHERE signature = signature limit 1) url,
|
|
|
|
+ signature signature, -- 视频md5
|
|
|
|
+ account_id accountId
|
|
from
|
|
from
|
|
- ctop_oauth_token t1
|
|
|
|
- left join
|
|
|
|
- ctop_kuaishou_report_daily_creative_statistic t2
|
|
|
|
- on t1.id = t2.account_id
|
|
|
|
- where t1.id in
|
|
|
|
|
|
+ ctop_kuaishou_report_daily_creative_new
|
|
|
|
+ where 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>
|
|
- and t1.media_id = '2'
|
|
|
|
|
|
+
|
|
|
|
|
|
<if test="startDate != null">
|
|
<if test="startDate != null">
|
|
- and t2.stat_date >= #{startDate}
|
|
|
|
|
|
+ and stat_date >= #{startDate}
|
|
</if>
|
|
</if>
|
|
|
|
|
|
<if test="endDate != null">
|
|
<if test="endDate != null">
|
|
- and t2.stat_date <= #{endDate}
|
|
|
|
|
|
+ and stat_date <= #{endDate}
|
|
</if>
|
|
</if>
|
|
- and t2.signature != ''
|
|
|
|
- GROUP BY t2.signature
|
|
|
|
- order by sum(t2.charge) desc
|
|
|
|
|
|
+ and signature is not null
|
|
|
|
+ GROUP BY signature
|
|
|
|
+ order by sum(charge) desc
|
|
limit 100
|
|
limit 100
|
|
</select>
|
|
</select>
|
|
|
|
|