|
@@ -292,34 +292,79 @@
|
|
|
|
|
|
<!-- 通投智选 - 横图大图 -->
|
|
<!-- 通投智选 - 横图大图 -->
|
|
<select id="getModeImageLarge" resultType="org.jeecg.modules.bytedance.advertise.entity.ByteDanceVideoInfo">
|
|
<select id="getModeImageLarge" resultType="org.jeecg.modules.bytedance.advertise.entity.ByteDanceVideoInfo">
|
|
- select distinct image.*,
|
|
|
|
- (select count(1) from ctop_bytedance_creative c
|
|
|
|
- where SUBSTRING_INDEX(SUBSTRING_INDEX(image_ids,'["',-1),'"]',1) in(image.id)
|
|
|
|
- and c.account_id = '${accountId}') as creativeCnt,
|
|
|
|
- 'image' as materialType
|
|
|
|
- from ctop_bytedance_image_info image
|
|
|
|
- where account_id = #{accountId}
|
|
|
|
- and image.type = '1'
|
|
|
|
- and image.image_create_time >= #{startTime}
|
|
|
|
- and image.image_create_time <= #{endTime}
|
|
|
|
- order by creativeCnt ASC
|
|
|
|
|
|
+ SELECT
|
|
|
|
+ image.*,
|
|
|
|
+ IFNULL(t.creativeCnt,0) as creativeCnt
|
|
|
|
+ FROM
|
|
|
|
+ ctop_bytedance_image_info image
|
|
|
|
+ LEFT JOIN
|
|
|
|
+ (
|
|
|
|
+ SELECT c2.*,
|
|
|
|
+ COUNT(c2.imageId) as creativeCnt
|
|
|
|
+ from (
|
|
|
|
+ SELECT c1.*,
|
|
|
|
+ substring_index(substring_index(c1.quchu,',',s.num),',',-1) as imageId
|
|
|
|
+ from (
|
|
|
|
+ SELECT
|
|
|
|
+ c.account_id,
|
|
|
|
+ c.image_ids,
|
|
|
|
+ REPLACE(SUBSTRING_INDEX(SUBSTRING_INDEX(c.image_ids, '["', -1), '"]', 1),'"','') quchu
|
|
|
|
+ FROM ctop_bytedance_creative c
|
|
|
|
+ WHERE c.account_id = '${accountId}'
|
|
|
|
+ ) c1
|
|
|
|
+ cross join ctop_dim_group_by as s
|
|
|
|
+ on s.num <= (length(c1.image_ids)-length(replace(c1.image_ids,',',''))+1)
|
|
|
|
+ ) c2
|
|
|
|
+ GROUP BY c2.imageId
|
|
|
|
+ )t on image.account_id = t.account_id and t.imageId = image.id
|
|
|
|
+ WHERE
|
|
|
|
+ image.account_id = #{accountId}
|
|
|
|
+ AND image.type = '1'
|
|
|
|
+ AND image.image_create_time >= #{startTime}
|
|
|
|
+ AND image.image_create_time <= #{endTime}
|
|
|
|
+ GROUP BY
|
|
|
|
+ image.id
|
|
|
|
+ ORDER BY
|
|
|
|
+ creativeCnt,image.id ASC
|
|
limit #{videoCnt}
|
|
limit #{videoCnt}
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<!-- 通投智选 - 竖图大图 -->
|
|
<!-- 通投智选 - 竖图大图 -->
|
|
<select id="getModeImageVertical" resultType="org.jeecg.modules.bytedance.advertise.entity.ByteDanceVideoInfo">
|
|
<select id="getModeImageVertical" resultType="org.jeecg.modules.bytedance.advertise.entity.ByteDanceVideoInfo">
|
|
- select distinct image.*,
|
|
|
|
- (select count(1) from ctop_bytedance_creative c
|
|
|
|
- where SUBSTRING_INDEX(SUBSTRING_INDEX(image_ids,'["',-1),'"]',1) in(image.id)
|
|
|
|
- and c.account_id = '${accountId}') as creativeCnt,
|
|
|
|
- 'image' as materialType
|
|
|
|
- from ctop_bytedance_image_info image
|
|
|
|
- where account_id = #{accountId}
|
|
|
|
- and image.type = '2'
|
|
|
|
- and image.image_create_time >= #{startTime}
|
|
|
|
- and image.image_create_time <= #{endTime}
|
|
|
|
- order by creativeCnt ASC
|
|
|
|
- limit #{videoCnt}
|
|
|
|
|
|
+ SELECT
|
|
|
|
+ image.*,
|
|
|
|
+ IFNULL(t.creativeCnt,0) as creativeCnt
|
|
|
|
+ FROM
|
|
|
|
+ ctop_bytedance_image_info image
|
|
|
|
+ LEFT JOIN
|
|
|
|
+ (
|
|
|
|
+ SELECT c2.*,
|
|
|
|
+ COUNT(c2.imageId) as creativeCnt
|
|
|
|
+ from (
|
|
|
|
+ SELECT c1.*,
|
|
|
|
+ substring_index(substring_index(c1.quchu,',',s.num),',',-1) as imageId
|
|
|
|
+ from (
|
|
|
|
+ SELECT c.account_id,
|
|
|
|
+ c.image_ids,
|
|
|
|
+ REPLACE(SUBSTRING_INDEX(SUBSTRING_INDEX(c.image_ids, '["', -1), '"]', 1),'"','') quchu
|
|
|
|
+ FROM ctop_bytedance_creative c
|
|
|
|
+ WHERE c.account_id = '${accountId}'
|
|
|
|
+ ) c1
|
|
|
|
+ cross join ctop_dim_group_by as s
|
|
|
|
+ on s.num <= (length(c1.image_ids)-length(replace(c1.image_ids,',',''))+1)
|
|
|
|
+ ) c2
|
|
|
|
+ GROUP BY c2.imageId
|
|
|
|
+ )t on image.account_id = t.account_id and t.imageId = image.id
|
|
|
|
+ WHERE
|
|
|
|
+ image.account_id = #{accountId}
|
|
|
|
+ AND image.type = '2'
|
|
|
|
+ AND image.image_create_time >= #{startTime}
|
|
|
|
+ AND image.image_create_time <= #{endTime}
|
|
|
|
+ GROUP BY
|
|
|
|
+ image.id
|
|
|
|
+ ORDER BY
|
|
|
|
+ creativeCnt,image.id ASC
|
|
|
|
+ limit #{videoCnt}
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
|