|
@@ -60,10 +60,10 @@
|
|
</if>
|
|
</if>
|
|
<if test="signatureList != null and signatureList != '' ">
|
|
<if test="signatureList != null and signatureList != '' ">
|
|
and signature in
|
|
and signature in
|
|
- <foreach collection="signatureList" item="item" separator=","
|
|
|
|
- open="(" close=")">
|
|
|
|
- #{item}
|
|
|
|
- </foreach>
|
|
|
|
|
|
+ <foreach collection="signatureList" item="item" separator=","
|
|
|
|
+ open="(" close=")">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
</if>
|
|
</if>
|
|
group by signature
|
|
group by signature
|
|
order by stat_date desc
|
|
order by stat_date desc
|
|
@@ -72,31 +72,32 @@
|
|
|
|
|
|
<select id="getHighQualityVideo" parameterType="java.util.Map"
|
|
<select id="getHighQualityVideo" parameterType="java.util.Map"
|
|
resultType="cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet">
|
|
resultType="cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet">
|
|
- select * from ctop_kuaishou_video_get
|
|
|
|
|
|
+ select *
|
|
|
|
+ from ctop_kuaishou_video_get
|
|
where account_id = #{accountId}
|
|
where account_id = #{accountId}
|
|
- and signature in
|
|
|
|
- (
|
|
|
|
- select
|
|
|
|
- daily_material.signature
|
|
|
|
- from
|
|
|
|
- ctop_kuaishou_report_daily_material daily_material
|
|
|
|
- inner join
|
|
|
|
- ctop_user_allocation allocation
|
|
|
|
- on daily_material.account_id = allocation.account_id
|
|
|
|
- where allocation.project_id in (select project_id from ctop_user_allocation where account_id = #{accountId})
|
|
|
|
- and to_days(now()) - to_days(daily_material.stat_date) <= #{days}
|
|
|
|
- and daily_material.signature is not null
|
|
|
|
- GROUP BY daily_material.signature
|
|
|
|
- order by sum(daily_material.charge) desc
|
|
|
|
- limit #{num}
|
|
|
|
- )
|
|
|
|
|
|
+ and signature in
|
|
|
|
+ (
|
|
|
|
+ select daily_material.signature
|
|
|
|
+ from ctop_kuaishou_report_daily_material daily_material
|
|
|
|
+ inner join
|
|
|
|
+ ctop_user_allocation allocation
|
|
|
|
+ on daily_material.account_id = allocation.account_id
|
|
|
|
+ where allocation.project_id in
|
|
|
|
+ (select project_id from ctop_user_allocation where account_id = #{accountId})
|
|
|
|
+ and to_days(now()) - to_days(daily_material.stat_date) <= #{days}
|
|
|
|
+ and daily_material.signature is not null
|
|
|
|
+ GROUP BY daily_material.signature
|
|
|
|
+ order by sum(daily_material.charge) desc
|
|
|
|
+ limit #{num}
|
|
|
|
+ )
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="selectPhotoIdsByAccountId" parameterType="java.lang.Long"
|
|
<select id="selectPhotoIdsByAccountId" parameterType="java.lang.Long"
|
|
resultType="cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet">
|
|
resultType="cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet">
|
|
- select * from ctop_kuaishou_video_get
|
|
|
|
|
|
+ select *
|
|
|
|
+ from ctop_kuaishou_video_get
|
|
where account_id = #{accountId}
|
|
where account_id = #{accountId}
|
|
- and status = 0
|
|
|
|
|
|
+ and status = 0
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="getVideoListByMap" resultType="com.alibaba.fastjson.JSONObject">
|
|
<select id="getVideoListByMap" resultType="com.alibaba.fastjson.JSONObject">
|
|
@@ -131,32 +132,32 @@
|
|
order by stat_date desc
|
|
order by stat_date desc
|
|
</select>
|
|
</select>
|
|
<select id="getPhotoIdsByParams" resultType="cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet">
|
|
<select id="getPhotoIdsByParams" resultType="cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet">
|
|
- select distinct photo_id from ctop_kuaishou_video_get
|
|
|
|
|
|
+ select distinct photo_id
|
|
|
|
+ from ctop_kuaishou_video_get
|
|
where account_id = #{accountId}
|
|
where account_id = #{accountId}
|
|
- and signature = #{signature}
|
|
|
|
- and status = 0
|
|
|
|
|
|
+ and signature = #{signature}
|
|
|
|
+ and status = 0
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<insert id="etlVideoBaseInfoByStaDate">
|
|
<insert id="etlVideoBaseInfoByStaDate">
|
|
- replace INTO ctop_etl_kuaishou_video_base_info (
|
|
|
|
|
|
+ replace
|
|
|
|
+ INTO ctop_etl_kuaishou_video_base_info (
|
|
signature,
|
|
signature,
|
|
channel_type,
|
|
channel_type,
|
|
photo_id,
|
|
photo_id,
|
|
photo_name,
|
|
photo_name,
|
|
material_type
|
|
material_type
|
|
- ) SELECT
|
|
|
|
- signature,
|
|
|
|
- channel_type,
|
|
|
|
- photo_id,
|
|
|
|
- photo_name,
|
|
|
|
- material_type
|
|
|
|
- FROM
|
|
|
|
- ctop_kuaishou_video_get
|
|
|
|
- where stat_date >= #{statDate}
|
|
|
|
- and signature is not null
|
|
|
|
- GROUP BY
|
|
|
|
- photo_id
|
|
|
|
- </insert>
|
|
|
|
|
|
+ )
|
|
|
|
+ SELECT signature,
|
|
|
|
+ channel_type,
|
|
|
|
+ photo_id,
|
|
|
|
+ photo_name,
|
|
|
|
+ material_type
|
|
|
|
+ FROM ctop_kuaishou_video_get
|
|
|
|
+ where stat_date >= #{statDate}
|
|
|
|
+ and signature is not null
|
|
|
|
+ GROUP BY photo_id
|
|
|
|
+ </insert>
|
|
|
|
|
|
<select id="getVideoInfoByPhotoIds" resultType="com.alibaba.fastjson.JSONObject">
|
|
<select id="getVideoInfoByPhotoIds" resultType="com.alibaba.fastjson.JSONObject">
|
|
select
|
|
select
|
|
@@ -175,49 +176,39 @@
|
|
group by photo_id
|
|
group by photo_id
|
|
</select>
|
|
</select>
|
|
<select id="getTotalCountByAccount" resultType="java.lang.Integer">
|
|
<select id="getTotalCountByAccount" resultType="java.lang.Integer">
|
|
- select
|
|
|
|
- count(distinct signature)
|
|
|
|
|
|
+ select count(distinct signature)
|
|
from ctop_kuaishou_video_get
|
|
from ctop_kuaishou_video_get
|
|
- where account_id = #{accountId}
|
|
|
|
|
|
+ where account_id = #{accountId}
|
|
</select>
|
|
</select>
|
|
<select id="getTotalCountByAccountAndStatDate" resultType="java.lang.Integer">
|
|
<select id="getTotalCountByAccountAndStatDate" resultType="java.lang.Integer">
|
|
- SELECT
|
|
|
|
- count(DISTINCT signature)
|
|
|
|
- FROM
|
|
|
|
- ctop_kuaishou_video_get
|
|
|
|
- WHERE
|
|
|
|
- account_id = #{accountId}
|
|
|
|
- AND DATE_FORMAT(stat_date, '%Y-%m-%d') = #{statDate}
|
|
|
|
|
|
+ SELECT count(DISTINCT signature)
|
|
|
|
+ FROM ctop_kuaishou_video_get
|
|
|
|
+ WHERE account_id = #{accountId}
|
|
|
|
+ AND DATE_FORMAT(stat_date, '%Y-%m-%d') = #{statDate}
|
|
</select>
|
|
</select>
|
|
<select id="getEffectiveCountByAccountId" resultType="java.lang.Integer">
|
|
<select id="getEffectiveCountByAccountId" resultType="java.lang.Integer">
|
|
- SELECT
|
|
|
|
- count(1)
|
|
|
|
- FROM
|
|
|
|
- (
|
|
|
|
- SELECT
|
|
|
|
- signature
|
|
|
|
- FROM
|
|
|
|
- ctop_kuaishou_video_get
|
|
|
|
- WHERE
|
|
|
|
- account_id = #{accountId}
|
|
|
|
- GROUP BY
|
|
|
|
- signature
|
|
|
|
- ) t1
|
|
|
|
- LEFT JOIN ctop_kuaishou_video_etl_info t2 ON t1.signature = t2.video_code
|
|
|
|
- WHERE
|
|
|
|
- t2.effect_date IS NOT NULL
|
|
|
|
- AND t2.effect_day_num <= 7
|
|
|
|
|
|
+ SELECT count(1)
|
|
|
|
+ FROM (
|
|
|
|
+ SELECT signature
|
|
|
|
+ FROM ctop_kuaishou_video_get
|
|
|
|
+ WHERE account_id = #{accountId}
|
|
|
|
+ GROUP BY signature
|
|
|
|
+ ) t1
|
|
|
|
+ LEFT JOIN ctop_kuaishou_video_etl_info t2 ON t1.signature = t2.video_code
|
|
|
|
+ WHERE t2.effect_date IS NOT NULL
|
|
|
|
+ AND t2.effect_day_num <= 7
|
|
|
|
|
|
</select>
|
|
</select>
|
|
<select id="getZeroVideoByParams" resultType="cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet">
|
|
<select id="getZeroVideoByParams" resultType="cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet">
|
|
select
|
|
select
|
|
video.*
|
|
video.*
|
|
from
|
|
from
|
|
- ctop_kuaishou_video_get video left join ctop_kuaishou_video_relate_creatives creative on video.photo_id = creative.photo_id and video.account_id = creative.account_id
|
|
|
|
|
|
+ ctop_kuaishou_video_get video left join ctop_kuaishou_video_relate_creatives creative on video.photo_id =
|
|
|
|
+ creative.photo_id and video.account_id = creative.account_id
|
|
where
|
|
where
|
|
- 1=1
|
|
|
|
|
|
+ 1=1
|
|
<if test="relativeCnt!=null">
|
|
<if test="relativeCnt!=null">
|
|
- and creative.creative_count <= #{relativeCnt}
|
|
|
|
|
|
+ and creative.creative_count <= #{relativeCnt}
|
|
</if>
|
|
</if>
|
|
|
|
|
|
<if test="accountId!=null">
|
|
<if test="accountId!=null">
|
|
@@ -244,36 +235,29 @@
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="getHotMoneyCountByAccountId" resultType="java.lang.Integer">
|
|
<select id="getHotMoneyCountByAccountId" resultType="java.lang.Integer">
|
|
- SELECT
|
|
|
|
- count(1)
|
|
|
|
- FROM
|
|
|
|
- (
|
|
|
|
- SELECT
|
|
|
|
- signature
|
|
|
|
- FROM
|
|
|
|
- ctop_kuaishou_video_get
|
|
|
|
- WHERE
|
|
|
|
- account_id = #{accountId}
|
|
|
|
- GROUP BY
|
|
|
|
- signature
|
|
|
|
- ) t1
|
|
|
|
- LEFT JOIN ctop_kuaishou_video_etl_info t2 ON t1.signature = t2.video_code
|
|
|
|
- WHERE
|
|
|
|
- t2.faddish_date is not null
|
|
|
|
- and faddish_day_num <=14
|
|
|
|
|
|
+ SELECT count(1)
|
|
|
|
+ FROM (
|
|
|
|
+ SELECT signature
|
|
|
|
+ FROM ctop_kuaishou_video_get
|
|
|
|
+ WHERE account_id = #{accountId}
|
|
|
|
+ GROUP BY signature
|
|
|
|
+ ) t1
|
|
|
|
+ LEFT JOIN ctop_kuaishou_video_etl_info t2 ON t1.signature = t2.video_code
|
|
|
|
+ WHERE t2.faddish_date is not null
|
|
|
|
+ and faddish_day_num <= 14
|
|
</select>
|
|
</select>
|
|
<select id="getHistoryTopVideoByParams"
|
|
<select id="getHistoryTopVideoByParams"
|
|
resultType="cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet">
|
|
resultType="cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet">
|
|
select
|
|
select
|
|
- video.*
|
|
|
|
|
|
+ video.*
|
|
from
|
|
from
|
|
- ctop_kuaishou_report_daily_material report
|
|
|
|
|
|
+ ctop_kuaishou_report_daily_material report
|
|
left join (select * from ctop_kuaishou_video_get
|
|
left join (select * from ctop_kuaishou_video_get
|
|
- where
|
|
|
|
- status = 0
|
|
|
|
- and signature is not null
|
|
|
|
|
|
+ where
|
|
|
|
+ status = 0
|
|
|
|
+ and signature is not null
|
|
<if test="accountId!=null">
|
|
<if test="accountId!=null">
|
|
- and account_id = #{accountId}
|
|
|
|
|
|
+ and account_id = #{accountId}
|
|
</if>
|
|
</if>
|
|
<if test="channelType!=null">
|
|
<if test="channelType!=null">
|
|
and channel_type = #{channelType}
|
|
and channel_type = #{channelType}
|
|
@@ -288,11 +272,11 @@
|
|
and photo_name like concat(#{appVersion},'%')
|
|
and photo_name like concat(#{appVersion},'%')
|
|
</if>
|
|
</if>
|
|
group by signature) video
|
|
group by signature) video
|
|
- on video.signature = report.signature
|
|
|
|
|
|
+ on video.signature = report.signature
|
|
left join (SELECT id, photo_id from ctop_ai_creative_limit WHERE account_id = #{accountId}) t2
|
|
left join (SELECT id, photo_id from ctop_ai_creative_limit WHERE account_id = #{accountId}) t2
|
|
- on video.photo_id = t2.photo_id
|
|
|
|
- where video.id is not null
|
|
|
|
- group by video.signature
|
|
|
|
|
|
+ on video.photo_id = t2.photo_id
|
|
|
|
+ where video.id is not null
|
|
|
|
+ group by video.signature
|
|
order by sum(report.charge) desc
|
|
order by sum(report.charge) desc
|
|
<if test="videoCnt!=null">
|
|
<if test="videoCnt!=null">
|
|
limit #{videoCnt}
|
|
limit #{videoCnt}
|
|
@@ -301,39 +285,54 @@
|
|
|
|
|
|
<select id="selectProjectVideo" resultType="cn.com.ctop.kuaishou.modules.batch.entity.KuaishouProjectVideoGet">
|
|
<select id="selectProjectVideo" resultType="cn.com.ctop.kuaishou.modules.batch.entity.KuaishouProjectVideoGet">
|
|
SELECT
|
|
SELECT
|
|
- t1.id,
|
|
|
|
- t2.project_id,
|
|
|
|
- t1.status,
|
|
|
|
- t1.photo_id,
|
|
|
|
- t1.width,
|
|
|
|
- t1.height,
|
|
|
|
- t1.url,
|
|
|
|
- t1.cover_url,
|
|
|
|
- t1.material_type,
|
|
|
|
- t1.channel_type,
|
|
|
|
- t1.stat_date,
|
|
|
|
- t1.signature,
|
|
|
|
- t1.photo_name,
|
|
|
|
- t1.update_time
|
|
|
|
|
|
+ t1.id,
|
|
|
|
+ t2.project_id,
|
|
|
|
+ t1.status,
|
|
|
|
+ t1.photo_id,
|
|
|
|
+ t1.width,
|
|
|
|
+ t1.height,
|
|
|
|
+ t1.url,
|
|
|
|
+ t1.cover_url,
|
|
|
|
+ t1.material_type,
|
|
|
|
+ t1.channel_type,
|
|
|
|
+ t1.stat_date,
|
|
|
|
+ t1.signature,
|
|
|
|
+ t1.photo_name,
|
|
|
|
+ t1.update_time
|
|
FROM ctop_kuaishou_video_get t1
|
|
FROM ctop_kuaishou_video_get t1
|
|
- INNER JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
|
|
|
|
|
|
+ INNER JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
|
|
WHERE t1.`status` =0
|
|
WHERE t1.`status` =0
|
|
- AND t2.project_id=#{projectId}
|
|
|
|
|
|
+ AND t2.project_id=#{projectId}
|
|
<if test="updateTime!=null">
|
|
<if test="updateTime!=null">
|
|
- AND t1.update_time >=#{updateTime}
|
|
|
|
|
|
+ AND t1.update_time >=#{updateTime}
|
|
</if>
|
|
</if>
|
|
|
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="getAccountIds" resultType="com.alibaba.fastjson.JSONObject">
|
|
<select id="getAccountIds" resultType="com.alibaba.fastjson.JSONObject">
|
|
- SELECT
|
|
|
|
- account_id 'accountId',DATE_FORMAT(MAX(create_time),'%Y-%m-%d %H:%i:%s') 'startDate'
|
|
|
|
|
|
+ SELECT account_id 'accountId',DATE_FORMAT(MAX(create_time), '%Y-%m-%d %H:%i:%s') 'startDate'
|
|
FROM ctop_kuaishou_video_get
|
|
FROM ctop_kuaishou_video_get
|
|
where channel_type = 1
|
|
where channel_type = 1
|
|
- and status = 0
|
|
|
|
|
|
+ and status = 0
|
|
GROUP BY account_id
|
|
GROUP BY account_id
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
+ <select id="queryPhotoIdsByProjectAndMd5" resultType="java.lang.String">
|
|
|
|
+ SELECT t1.photo_id
|
|
|
|
+ FROM ctop_kuaishou_video_get t1
|
|
|
|
+ LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
|
|
|
|
+ where t1.status = 0
|
|
|
|
+ AND t2.project_id = #{projectId}
|
|
|
|
+ AND t1.signature =#{signature}
|
|
|
|
+ <if test="accountId !=null">
|
|
|
|
+ AND t1.account_id IN
|
|
|
|
+ <foreach collection="accountId" item="id" separator="," open="(" close=")">
|
|
|
|
+ #{id}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ GROUP BY photo_id
|
|
|
|
+ </select>
|
|
|
|
+
|
|
<update id="updateBatch">
|
|
<update id="updateBatch">
|
|
UPDATE ctop_kuaishou_video_get SET
|
|
UPDATE ctop_kuaishou_video_get SET
|
|
material_tag = CASE id
|
|
material_tag = CASE id
|
|
@@ -353,7 +352,7 @@
|
|
END
|
|
END
|
|
WHERE id IN
|
|
WHERE id IN
|
|
<foreach item="videoGet" index="index" collection="videoGetList" open="(" separator="," close=")">
|
|
<foreach item="videoGet" index="index" collection="videoGetList" open="(" separator="," close=")">
|
|
- #{videoGet.id}
|
|
|
|
|
|
+ #{videoGet.id}
|
|
</foreach>
|
|
</foreach>
|
|
</update>
|
|
</update>
|
|
</mapper>
|
|
</mapper>
|