|
@@ -257,9 +257,8 @@
|
|
and signature = #{signature}
|
|
and signature = #{signature}
|
|
</update>
|
|
</update>
|
|
|
|
|
|
- <select id="videoInfoListWeek" resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
|
|
- select
|
|
|
|
- -- a.material_id as materialId,
|
|
|
|
|
|
+ <sql id="selectSql">
|
|
|
|
+-- a.material_id as materialId,
|
|
-- a.account_id as accountId,
|
|
-- a.account_id as accountId,
|
|
-- b.auth_name as authName,
|
|
-- b.auth_name as authName,
|
|
a.project_id as projectId,
|
|
a.project_id as projectId,
|
|
@@ -461,43 +460,165 @@
|
|
when sum(a.click) != 0
|
|
when sum(a.click) != 0
|
|
then sum(a.download_start) / sum(a.click)
|
|
then sum(a.download_start) / sum(a.click)
|
|
else 0 end as downloadStartRate -- 应用下载广告数据-安卓下载开始率 计算方法:安卓下载开始数/点击数
|
|
else 0 end as downloadStartRate -- 应用下载广告数据-安卓下载开始率 计算方法:安卓下载开始数/点击数
|
|
|
|
+ </sql>
|
|
|
|
|
|
|
|
+ <select id="videoInfoListGroupAdmin" resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
|
|
+ select
|
|
|
|
+ <include refid="selectSql"></include>
|
|
from ctop_bytedance_video_report_daily a
|
|
from ctop_bytedance_video_report_daily a
|
|
left join (select material_id,clip_id,shot_id,plan_id,plane_id from ctop_material_ascription group by material_id) f on a.signature = f.material_id
|
|
left join (select material_id,clip_id,shot_id,plan_id,plane_id from ctop_material_ascription group by material_id) f on a.signature = f.material_id
|
|
|
|
+ left join ctop_bytedance_account_video_map p on a.signature = p.signature
|
|
where stat_datetime >= #{startDate}
|
|
where stat_datetime >= #{startDate}
|
|
and stat_datetime <= #{endDate}
|
|
and stat_datetime <= #{endDate}
|
|
|
|
+ and f.material_id is not null
|
|
|
|
+ <if test="accountIds != null">
|
|
|
|
+ and p.account_id in
|
|
|
|
+ <foreach item="item" index="index" collection="accountIds" open="(" separator="," close=")">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
|
|
- <if test=" role != 'admin' ">
|
|
|
|
- and a.company_id = #{companyId}
|
|
|
|
|
|
+ <if test="signature != null and signature != '' ">
|
|
|
|
+ and a.signature = #{signature}
|
|
</if>
|
|
</if>
|
|
|
|
+ group by a.signature
|
|
|
|
+ <if test="cost != null">
|
|
|
|
+ having sum(a.cost) >= #{cost}
|
|
|
|
+ </if>
|
|
|
|
+ order by sum(a.cost)
|
|
|
|
+ </select>
|
|
|
|
|
|
|
|
+ <select id="videoInfoListGroupdesignTeamLeader" resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
|
|
+ select
|
|
|
|
+ <include refid="selectSql"></include>
|
|
|
|
+ from ctop_bytedance_video_report_daily a
|
|
|
|
+ left join (select material_id,clip_id,shot_id,plan_id,plane_id from ctop_material_ascription group by material_id) f on a.signature = f.material_id
|
|
|
|
+ left join ctop_bytedance_account_video_map p on a.signature = p.signature
|
|
|
|
+ where stat_datetime >= #{startDate}
|
|
|
|
+ and stat_datetime <= #{endDate}
|
|
|
|
+ and a.company_id = #{companyId}
|
|
and f.material_id is not null
|
|
and f.material_id is not null
|
|
|
|
|
|
- <choose> <!-- 编导、剪辑、拍摄、平面只能查看自己本职工作制作的视频,设计组长和管理员能查看所有的-->
|
|
|
|
- <when test="role == 'plan'">
|
|
|
|
- and f.plan = #{userId}
|
|
|
|
- </when>
|
|
|
|
- <when test="role == 'clip'">
|
|
|
|
- and f.clip = #{userId}
|
|
|
|
- </when>
|
|
|
|
- <when test="role == 'shot' ">
|
|
|
|
- and f.shot = #{userId}
|
|
|
|
- </when>
|
|
|
|
- <when test="role == 'plane' or role == 'planeLeader' ">
|
|
|
|
- and f.plan = #{userId}
|
|
|
|
- </when>
|
|
|
|
- <when test="role == 'admin' or role == 'designTeamLeader'">
|
|
|
|
- and 1=1
|
|
|
|
- </when>
|
|
|
|
- <otherwise>F
|
|
|
|
- and a.id = 0
|
|
|
|
- </otherwise>
|
|
|
|
- </choose>
|
|
|
|
|
|
+ <if test="accountIds != null">
|
|
|
|
+ and p.account_id in
|
|
|
|
+ <foreach item="item" index="index" collection="accountIds" open="(" separator="," close=")">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+
|
|
|
|
+ <if test="signature != null and signature != '' ">
|
|
|
|
+ and a.signature = #{signature}
|
|
|
|
+ </if>
|
|
|
|
+ group by a.signature
|
|
|
|
+ <if test="cost != null">
|
|
|
|
+ having sum(a.cost) >= #{cost}
|
|
|
|
+ </if>
|
|
|
|
+ order by sum(a.cost)
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="videoInfoListGroupPlaneAndPlaneLeader" resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
|
|
+ select
|
|
|
|
+ <include refid="selectSql"></include>
|
|
|
|
+ from ctop_bytedance_video_report_daily a
|
|
|
|
+ left join (select material_id,clip_id,shot_id,plan_id,plane_id from ctop_material_ascription group by material_id) f on a.signature = f.material_id
|
|
|
|
+ left join ctop_bytedance_account_video_map p on a.signature = p.signature
|
|
|
|
+ where stat_datetime >= #{startDate}
|
|
|
|
+ and stat_datetime <= #{endDate}
|
|
|
|
+ and a.company_id = #{companyId}
|
|
|
|
+ and f.material_id is not null
|
|
|
|
+ and f.plane = #{userId}
|
|
|
|
+ and f.material_id is not null
|
|
|
|
+ <if test="accountIds != null">
|
|
|
|
+ and p.account_id in
|
|
|
|
+ <foreach item="item" index="index" collection="accountIds" open="(" separator="," close=")">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="signature != null and signature != '' ">
|
|
|
|
+ and a.signature = #{signature}
|
|
|
|
+ </if>
|
|
|
|
+ group by a.signature
|
|
|
|
+ <if test="cost != null">
|
|
|
|
+ having sum(a.cost) >= #{cost}
|
|
|
|
+ </if>
|
|
|
|
+ order by sum(a.cost)
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="videoInfoListGroupPlan" resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
|
|
+ select
|
|
|
|
+ <include refid="selectSql"></include>
|
|
|
|
+ from ctop_bytedance_video_report_daily a
|
|
|
|
+ left join (select material_id,clip_id,shot_id,plan_id,plane_id from ctop_material_ascription group by material_id) f on a.signature = f.material_id
|
|
|
|
+ left join ctop_bytedance_account_video_map p on a.signature = p.signature
|
|
|
|
+ where stat_datetime >= #{startDate}
|
|
|
|
+ and stat_datetime <= #{endDate}
|
|
|
|
+ and a.company_id = #{companyId}
|
|
|
|
+ and f.material_id is not null
|
|
|
|
+ and f.plan = #{userId}
|
|
|
|
+ and f.material_id is not null
|
|
|
|
+ <if test="accountIds != null">
|
|
|
|
+ and p.account_id in
|
|
|
|
+ <foreach item="item" index="index" collection="accountIds" open="(" separator="," close=")">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="signature != null and signature != '' ">
|
|
|
|
+ and a.signature = #{signature}
|
|
|
|
+ </if>
|
|
|
|
+ group by a.signature
|
|
|
|
+ <if test="cost != null">
|
|
|
|
+ having sum(a.cost) >= #{cost}
|
|
|
|
+ </if>
|
|
|
|
+ order by sum(a.cost)
|
|
|
|
+ </select>
|
|
|
|
|
|
|
|
+ <select id="videoInfoListGroupClip" resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
|
|
+ select
|
|
|
|
+ <include refid="selectSql"></include>
|
|
|
|
+ from ctop_bytedance_video_report_daily a
|
|
|
|
+ left join (select material_id,clip_id,shot_id,plan_id,plane_id from ctop_material_ascription group by material_id) f on a.signature = f.material_id
|
|
|
|
+ left join ctop_bytedance_account_video_map p on a.signature = p.signature
|
|
|
|
+ where stat_datetime >= #{startDate}
|
|
|
|
+ and stat_datetime <= #{endDate}
|
|
|
|
+ and a.company_id = #{companyId}
|
|
|
|
+ and f.material_id is not null
|
|
|
|
+ and f.clip = #{userId}
|
|
|
|
+ <if test="accountIds != null">
|
|
|
|
+ and p.account_id in
|
|
|
|
+ <foreach item="item" index="index" collection="accountIds" open="(" separator="," close=")">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
<if test="signature != null and signature != '' ">
|
|
<if test="signature != null and signature != '' ">
|
|
and a.signature = #{signature}
|
|
and a.signature = #{signature}
|
|
</if>
|
|
</if>
|
|
|
|
+ group by a.signature
|
|
|
|
+ <if test="cost != null">
|
|
|
|
+ having sum(a.cost) >= #{cost}
|
|
|
|
+ </if>
|
|
|
|
+ order by sum(a.cost)
|
|
|
|
+ </select>
|
|
|
|
|
|
|
|
+ <select id="videoInfoListGroupShot" resultType="cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily">
|
|
|
|
+ select
|
|
|
|
+ <include refid="selectSql"></include>
|
|
|
|
+ from ctop_bytedance_video_report_daily a
|
|
|
|
+ left join (select material_id,clip_id,shot_id,plan_id,plane_id from ctop_material_ascription group by material_id) f on a.signature = f.material_id
|
|
|
|
+ left join ctop_bytedance_account_video_map p on a.signature = p.signature
|
|
|
|
+ where stat_datetime >= #{startDate}
|
|
|
|
+ and stat_datetime <= #{endDate}
|
|
|
|
+ and a.company_id = #{companyId}
|
|
|
|
+ and f.material_id is not null
|
|
|
|
+ and f.shot = #{userId}
|
|
|
|
+ <if test="accountIds != null">
|
|
|
|
+ and p.account_id in
|
|
|
|
+ <foreach item="item" index="index" collection="accountIds" open="(" separator="," close=")">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="signature != null and signature != '' ">
|
|
|
|
+ and a.signature = #{signature}
|
|
|
|
+ </if>
|
|
group by a.signature
|
|
group by a.signature
|
|
<if test="cost != null">
|
|
<if test="cost != null">
|
|
having sum(a.cost) >= #{cost}
|
|
having sum(a.cost) >= #{cost}
|
|
@@ -738,4 +859,34 @@
|
|
</if>
|
|
</if>
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
+ <select id="accountVideoMap" resultType="cn.com.ctop.toutiao.modules.report.DTO.AccountVideoDTO">
|
|
|
|
+ select
|
|
|
|
+ a.account_id,b.signature
|
|
|
|
+ FROM
|
|
|
|
+ ctop_bytedance_report_material_daily a
|
|
|
|
+ left join ctop_bytedance_video_info b on a.material_id = b.material_id
|
|
|
|
+ where a.image_mode in ('CREATIVE_IMAGE_MODE_VIDEO','CREATIVE_IMAGE_MODE_VIDEO_VERTICAL')
|
|
|
|
+ and b.signature is not null
|
|
|
|
+ group by a.account_id,b.signature
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <insert id="replaceIntoAccountVideoMapBatch">
|
|
|
|
+ replace into
|
|
|
|
+ ctop_bytedance_account_video_map
|
|
|
|
+ (
|
|
|
|
+ account_id,
|
|
|
|
+ signature
|
|
|
|
+ )
|
|
|
|
+ values
|
|
|
|
+ <foreach collection="accountVideoDTOList" item="accountVideo" separator=",">
|
|
|
|
+ (
|
|
|
|
+ #{accountVideo.accountId},
|
|
|
|
+ #{accountVideo.signature}
|
|
|
|
+ )
|
|
|
|
+ </foreach>
|
|
|
|
+ </insert>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
</mapper>
|
|
</mapper>
|