|  | @@ -49,6 +49,7 @@
 | 
	
		
			
				|  |  |          where year = #{year}
 | 
	
		
			
				|  |  |          and quarter = #{quarter}
 | 
	
		
			
				|  |  |          and user_id = #{userId}
 | 
	
		
			
				|  |  | +        and app_type = #{appType}
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <!-- 按人获取季度总视频数量 -->
 | 
	
	
		
			
				|  | @@ -71,7 +72,6 @@
 | 
	
		
			
				|  |  |                  b.shot_id = #{userId}
 | 
	
		
			
				|  |  |              </otherwise>
 | 
	
		
			
				|  |  |          </choose>
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <!-- 根据clip_id获取视频总消耗 -->
 | 
	
	
		
			
				|  | @@ -91,7 +91,7 @@
 | 
	
		
			
				|  |  |          and c.clip_id = #{userId}
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    <!-- 根据clip_id获取视频总消耗 -->
 | 
	
		
			
				|  |  | +    <!-- 根据shot_id获取视频总消耗 -->
 | 
	
		
			
				|  |  |      <select id="getTotalCostByShotId" resultType="java.math.BigDecimal">
 | 
	
		
			
				|  |  |              select
 | 
	
		
			
				|  |  |              sum(a.charge) as charge
 | 
	
	
		
			
				|  | @@ -108,7 +108,7 @@
 | 
	
		
			
				|  |  |          and c.shot_id = #{userId}
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    <!-- 根据clip_id获取视频总消耗 -->
 | 
	
		
			
				|  |  | +    <!-- 根据plan_id获取视频总消耗 -->
 | 
	
		
			
				|  |  |      <select id="getTotalCostByPlanId" resultType="java.math.BigDecimal">
 | 
	
		
			
				|  |  |              select
 | 
	
		
			
				|  |  |              sum(a.charge) as charge
 | 
	
	
		
			
				|  | @@ -170,7 +170,6 @@
 | 
	
		
			
				|  |  |          user_id = #{userId}
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |      <!-- 根据项目id获取平面设计师的数量 -->
 | 
	
		
			
				|  |  |      <select id="getPlaneCountByProjectId" resultType="java.lang.Integer">
 | 
	
		
			
				|  |  |          select
 | 
	
	
		
			
				|  | @@ -299,6 +298,66 @@
 | 
	
		
			
				|  |  |          and b.parent_id = '4e939124a5f541c88838e49d2a3ea72b'  <!-- 快手设计部 -->
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    <!-- 获取快手编导列表 -->
 | 
	
		
			
				|  |  | +    <select id="getKuaishouPlanList" resultType="cn.com.ctop.userefficientvideomap.entity.UserDto2">
 | 
	
		
			
				|  |  | +            select
 | 
	
		
			
				|  |  | +            a.user_id as userId,
 | 
	
		
			
				|  |  | +            c.realname as userName,
 | 
	
		
			
				|  |  | +            '0214283aa16f943efbb149ea4bb18f18' as roleId,
 | 
	
		
			
				|  |  | +            '策划' as roleName,
 | 
	
		
			
				|  |  | +            a.dep_id as depId
 | 
	
		
			
				|  |  | +        FROM sys_user_depart a
 | 
	
		
			
				|  |  | +        left join sys_user c on a.user_id = c.id
 | 
	
		
			
				|  |  | +        left join sys_depart b on a.dep_id = b.id
 | 
	
		
			
				|  |  | +                    WHERE a.user_id in(
 | 
	
		
			
				|  |  | +                        select
 | 
	
		
			
				|  |  | +                        user_id
 | 
	
		
			
				|  |  | +                        from sys_user_role
 | 
	
		
			
				|  |  | +                        WHERE role_id = '0214283aa16f943efbb149ea4bb18f18'    <!-- 编导 -->
 | 
	
		
			
				|  |  | +                        )
 | 
	
		
			
				|  |  | +        and b.parent_id = '4e939124a5f541c88838e49d2a3ea72b'  <!-- 快手设计部 -->
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <!-- 获取快手拍摄列表 -->
 | 
	
		
			
				|  |  | +    <select id="getKuaishouShotList" resultType="cn.com.ctop.userefficientvideomap.entity.UserDto2">
 | 
	
		
			
				|  |  | +            select
 | 
	
		
			
				|  |  | +            a.user_id as userId,
 | 
	
		
			
				|  |  | +            c.realname as userName,
 | 
	
		
			
				|  |  | +            '7bff9afed625aeeabca6bffe3c189183' as roleId,
 | 
	
		
			
				|  |  | +            '拍摄' as roleName,
 | 
	
		
			
				|  |  | +            a.dep_id as depId
 | 
	
		
			
				|  |  | +        FROM sys_user_depart a
 | 
	
		
			
				|  |  | +        left join sys_user c on a.user_id = c.id
 | 
	
		
			
				|  |  | +        left join sys_depart b on a.dep_id = b.id
 | 
	
		
			
				|  |  | +                    WHERE a.user_id in(
 | 
	
		
			
				|  |  | +                        select
 | 
	
		
			
				|  |  | +                        user_id
 | 
	
		
			
				|  |  | +                        from sys_user_role
 | 
	
		
			
				|  |  | +                        WHERE role_id = '7bff9afed625aeeabca6bffe3c189183'   <!-- 拍摄 -->
 | 
	
		
			
				|  |  | +                        )
 | 
	
		
			
				|  |  | +        and b.parent_id = '4e939124a5f541c88838e49d2a3ea72b'   <!-- 快手设计部 -->
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <!-- 获取快手剪辑列表 -->
 | 
	
		
			
				|  |  | +    <select id="getKuaishouClipList" resultType="cn.com.ctop.userefficientvideomap.entity.UserDto2">
 | 
	
		
			
				|  |  | +        select
 | 
	
		
			
				|  |  | +        a.user_id as userId,
 | 
	
		
			
				|  |  | +        c.realname as userName,
 | 
	
		
			
				|  |  | +        'f38d8d70cf7ec50d5357a749e4dbf8ee' as roleId,
 | 
	
		
			
				|  |  | +        '剪辑' as roleName,
 | 
	
		
			
				|  |  | +        a.dep_id as depId
 | 
	
		
			
				|  |  | +        FROM sys_user_depart a
 | 
	
		
			
				|  |  | +        left join sys_user c on a.user_id = c.id
 | 
	
		
			
				|  |  | +        left join sys_depart b on a.dep_id = b.id
 | 
	
		
			
				|  |  | +        WHERE a.user_id in(
 | 
	
		
			
				|  |  | +        select
 | 
	
		
			
				|  |  | +        user_id
 | 
	
		
			
				|  |  | +        from sys_user_role
 | 
	
		
			
				|  |  | +        WHERE role_id = 'f38d8d70cf7ec50d5357a749e4dbf8ee'   <!-- 拍摄 -->
 | 
	
		
			
				|  |  | +        )
 | 
	
		
			
				|  |  | +        and b.parent_id = '4e939124a5f541c88838e49d2a3ea72b'   <!-- 快手设计部 -->
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      <!-- 根据部门id -->
 | 
	
		
			
				|  |  |      <select id="getClip" resultType="string">
 | 
	
		
			
				|  |  |          select
 | 
	
	
		
			
				|  | @@ -322,4 +381,162 @@
 | 
	
		
			
				|  |  |          and user_id = #{userId}
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    <!-- 获取toutiao设计师leader的信息 -->
 | 
	
		
			
				|  |  | +    <select id="getToutiaoDesignLeaderList" resultType="cn.com.ctop.userefficientvideomap.entity.UserDto2">
 | 
	
		
			
				|  |  | +        select
 | 
	
		
			
				|  |  | +        a.user_id as userId,
 | 
	
		
			
				|  |  | +        c.realname as userName,
 | 
	
		
			
				|  |  | +        '8d3e2ed58bdedf17716f698ea674da27' as roleId,
 | 
	
		
			
				|  |  | +        '设计组长' as roleName,
 | 
	
		
			
				|  |  | +        a.dep_id as depId
 | 
	
		
			
				|  |  | +        FROM sys_user_depart a
 | 
	
		
			
				|  |  | +        left join sys_user c on a.user_id = c.id
 | 
	
		
			
				|  |  | +        left join sys_depart b on a.dep_id = b.id
 | 
	
		
			
				|  |  | +        WHERE a.user_id in(
 | 
	
		
			
				|  |  | +        select
 | 
	
		
			
				|  |  | +        user_id
 | 
	
		
			
				|  |  | +        from sys_user_role
 | 
	
		
			
				|  |  | +        WHERE role_id = '8d3e2ed58bdedf17716f698ea674da27'   <!-- 设计师 -->
 | 
	
		
			
				|  |  | +        )
 | 
	
		
			
				|  |  | +        and b.parent_id = '26c10ecb5e0d416bb01f8ff983f4588c'  <!-- 快手设计部 -->
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <!-- 获取toutiao编导列表 -->
 | 
	
		
			
				|  |  | +    <select id="getToutiaoPlanList" resultType="cn.com.ctop.userefficientvideomap.entity.UserDto2">
 | 
	
		
			
				|  |  | +        select
 | 
	
		
			
				|  |  | +        a.user_id as userId,
 | 
	
		
			
				|  |  | +        c.realname as userName,
 | 
	
		
			
				|  |  | +        '0214283aa16f943efbb149ea4bb18f18' as roleId,
 | 
	
		
			
				|  |  | +        '策划' as roleName,
 | 
	
		
			
				|  |  | +        a.dep_id as depId
 | 
	
		
			
				|  |  | +        FROM sys_user_depart a
 | 
	
		
			
				|  |  | +        left join sys_user c on a.user_id = c.id
 | 
	
		
			
				|  |  | +        left join sys_depart b on a.dep_id = b.id
 | 
	
		
			
				|  |  | +        WHERE a.user_id in(
 | 
	
		
			
				|  |  | +        select
 | 
	
		
			
				|  |  | +        user_id
 | 
	
		
			
				|  |  | +        from sys_user_role
 | 
	
		
			
				|  |  | +        WHERE role_id = '0214283aa16f943efbb149ea4bb18f18'    <!-- 编导 -->
 | 
	
		
			
				|  |  | +        )
 | 
	
		
			
				|  |  | +        and b.parent_id = '26c10ecb5e0d416bb01f8ff983f4588c'  <!-- 快手设计部 -->
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <!-- 获取toutiao拍摄列表 -->
 | 
	
		
			
				|  |  | +    <select id="getToutiaoShotList" resultType="cn.com.ctop.userefficientvideomap.entity.UserDto2">
 | 
	
		
			
				|  |  | +        select
 | 
	
		
			
				|  |  | +        a.user_id as userId,
 | 
	
		
			
				|  |  | +        c.realname as userName,
 | 
	
		
			
				|  |  | +        '7bff9afed625aeeabca6bffe3c189183' as roleId,
 | 
	
		
			
				|  |  | +        '拍摄' as roleName,
 | 
	
		
			
				|  |  | +        a.dep_id as depId
 | 
	
		
			
				|  |  | +        FROM sys_user_depart a
 | 
	
		
			
				|  |  | +        left join sys_user c on a.user_id = c.id
 | 
	
		
			
				|  |  | +        left join sys_depart b on a.dep_id = b.id
 | 
	
		
			
				|  |  | +        WHERE a.user_id in(
 | 
	
		
			
				|  |  | +        select
 | 
	
		
			
				|  |  | +        user_id
 | 
	
		
			
				|  |  | +        from sys_user_role
 | 
	
		
			
				|  |  | +        WHERE role_id = '7bff9afed625aeeabca6bffe3c189183'   <!-- 拍摄 -->
 | 
	
		
			
				|  |  | +        )
 | 
	
		
			
				|  |  | +        and b.parent_id = '26c10ecb5e0d416bb01f8ff983f4588c'   <!-- 快手设计部 -->
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <!-- 获取toutiao剪辑列表 -->
 | 
	
		
			
				|  |  | +    <select id="getToutiaoClipList" resultType="cn.com.ctop.userefficientvideomap.entity.UserDto2">
 | 
	
		
			
				|  |  | +        select
 | 
	
		
			
				|  |  | +        a.user_id as userId,
 | 
	
		
			
				|  |  | +        c.realname as userName,
 | 
	
		
			
				|  |  | +        'f38d8d70cf7ec50d5357a749e4dbf8ee' as roleId,
 | 
	
		
			
				|  |  | +        '剪辑' as roleName,
 | 
	
		
			
				|  |  | +        a.dep_id as depId
 | 
	
		
			
				|  |  | +        FROM sys_user_depart a
 | 
	
		
			
				|  |  | +        left join sys_user c on a.user_id = c.id
 | 
	
		
			
				|  |  | +        left join sys_depart b on a.dep_id = b.id
 | 
	
		
			
				|  |  | +        WHERE a.user_id in(
 | 
	
		
			
				|  |  | +        select
 | 
	
		
			
				|  |  | +        user_id
 | 
	
		
			
				|  |  | +        from sys_user_role
 | 
	
		
			
				|  |  | +        WHERE role_id = 'f38d8d70cf7ec50d5357a749e4dbf8ee'   <!-- 拍摄 -->
 | 
	
		
			
				|  |  | +        )
 | 
	
		
			
				|  |  | +        and b.parent_id = '26c10ecb5e0d416bb01f8ff983f4588c'   <!-- 快手设计部 -->
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <!-- 头条有效视频用户关系绑定 -->
 | 
	
		
			
				|  |  | +    <select id="getToutiaoUserVideoMap" resultType="cn.com.ctop.userefficientvideomap.entity.EffiVideoDTO">
 | 
	
		
			
				|  |  | +            select
 | 
	
		
			
				|  |  | +            c.signature as signature,
 | 
	
		
			
				|  |  | +            sum(a.cost) as charge, <!-- 总花费 -->
 | 
	
		
			
				|  |  | +            f1.id as clipId,
 | 
	
		
			
				|  |  | +            f1.realname as clipName,
 | 
	
		
			
				|  |  | +            f2.id as shotId,
 | 
	
		
			
				|  |  | +            f2.realname as shotName,
 | 
	
		
			
				|  |  | +            f3.id as planId,
 | 
	
		
			
				|  |  | +            f3.realname as planName,
 | 
	
		
			
				|  |  | +            f4.id as planeId,
 | 
	
		
			
				|  |  | +            f4.realname as planeName
 | 
	
		
			
				|  |  | +        from
 | 
	
		
			
				|  |  | +        ctop_bytedance_report_creative_daily a
 | 
	
		
			
				|  |  | +        left join ctop_bytedance_creative b on a.creative_id = b.id
 | 
	
		
			
				|  |  | +        left join ctop_bytedance_video_info c on b.video_id = c.id
 | 
	
		
			
				|  |  | +        left join ctop_material_info d on c.signature = d.code
 | 
	
		
			
				|  |  | +        left join ctop_material_ascription e on on d.id = e.material_id
 | 
	
		
			
				|  |  | +        left join sys_user f1 on e.clip_id = f1.id
 | 
	
		
			
				|  |  | +        left join sys_user f2 on e.shot_id = f2.id
 | 
	
		
			
				|  |  | +        left join sys_user f3 on e.plan_id = f3.id
 | 
	
		
			
				|  |  | +        left join sys_user f4 on e.plane_id = f4.id
 | 
	
		
			
				|  |  | +        where
 | 
	
		
			
				|  |  | +        c.signature is not null and d.id is not null and
 | 
	
		
			
				|  |  | +        date_format(a.stat_datetime, '%Y-%m-%d') >= #{startTime} and
 | 
	
		
			
				|  |  | +        date_format(a.stat_datetime, '%Y-%m-%d') <= #{endTime} and
 | 
	
		
			
				|  |  | +        date_format(d.create_time, '%Y-%m-%d') >= #{startDate} and
 | 
	
		
			
				|  |  | +        date_format(d.update_time, '%Y-%m-%d') <= #{endDate}
 | 
	
		
			
				|  |  | +        group by c.signature
 | 
	
		
			
				|  |  | +        having sum(a.charge) >= 5000
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <!-- 头条根据plan_id获取视频总消耗 -->
 | 
	
		
			
				|  |  | +    <select id="toutiaoGetTotalCostByPlanId" resultType="java.math.BigDecimal">
 | 
	
		
			
				|  |  | +            select
 | 
	
		
			
				|  |  | +            sum(a.charge) as charge
 | 
	
		
			
				|  |  | +            ctop_bytedance_report_creative_daily a
 | 
	
		
			
				|  |  | +        left join ctop_bytedance_creative b on a.creative_id = b.id
 | 
	
		
			
				|  |  | +        left join ctop_bytedance_video_info c on b.video_id = c.id
 | 
	
		
			
				|  |  | +        left join ctop_material_info d on c.signature = d.code
 | 
	
		
			
				|  |  | +        left join ctop_material_ascription e on on d.id = e.material_id
 | 
	
		
			
				|  |  | +        where c.signature is not null and d.id is not null
 | 
	
		
			
				|  |  | +        and DATE_FORMAT(d.create_time,'%Y-%m-%d') >= #{startDate}
 | 
	
		
			
				|  |  | +        and DATE_FORMAT(d.create_time,'%Y-%m-%d') <= #{endDate}
 | 
	
		
			
				|  |  | +        where e.plan_id = #{userId}
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <!-- 头条根据clip_id获取视频总消耗 -->
 | 
	
		
			
				|  |  | +    <select id="toutiaoGetTotalCostByClipId" resultType="java.math.BigDecimal">
 | 
	
		
			
				|  |  | +            select
 | 
	
		
			
				|  |  | +            sum(a.charge) as charge
 | 
	
		
			
				|  |  | +            ctop_bytedance_report_creative_daily a
 | 
	
		
			
				|  |  | +        left join ctop_bytedance_creative b on a.creative_id = b.id
 | 
	
		
			
				|  |  | +        left join ctop_bytedance_video_info c on b.video_id = c.id
 | 
	
		
			
				|  |  | +        left join ctop_material_info d on c.signature = d.code
 | 
	
		
			
				|  |  | +        left join ctop_material_ascription e on on d.id = e.material_id
 | 
	
		
			
				|  |  | +        where c.signature is not null and d.id is not null
 | 
	
		
			
				|  |  | +        and DATE_FORMAT(d.create_time,'%Y-%m-%d') >= #{startDate}
 | 
	
		
			
				|  |  | +        and DATE_FORMAT(d.create_time,'%Y-%m-%d') <= #{endDate}
 | 
	
		
			
				|  |  | +        where e.clip_id = #{userId}
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <!-- 头条根据shot_id获取视频总消耗 -->
 | 
	
		
			
				|  |  | +    <select id="toutiaoGetTotalCostByShotId" resultType="java.math.BigDecimal">
 | 
	
		
			
				|  |  | +            select
 | 
	
		
			
				|  |  | +            sum(a.charge) as charge
 | 
	
		
			
				|  |  | +            ctop_bytedance_report_creative_daily a
 | 
	
		
			
				|  |  | +        left join ctop_bytedance_creative b on a.creative_id = b.id
 | 
	
		
			
				|  |  | +        left join ctop_bytedance_video_info c on b.video_id = c.id
 | 
	
		
			
				|  |  | +        left join ctop_material_info d on c.signature = d.code
 | 
	
		
			
				|  |  | +        left join ctop_material_ascription e on on d.id = e.material_id
 | 
	
		
			
				|  |  | +        where c.signature is not null and d.id is not null
 | 
	
		
			
				|  |  | +        and DATE_FORMAT(d.create_time,'%Y-%m-%d') >= #{startDate}
 | 
	
		
			
				|  |  | +        and DATE_FORMAT(d.create_time,'%Y-%m-%d') <= #{endDate}
 | 
	
		
			
				|  |  | +        where e.shot_id = #{userId}
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  </mapper>
 |