|
|
@@ -295,6 +295,98 @@ public interface FsCourseWatchLogMapper extends BaseMapper<FsCourseWatchLog> {
|
|
|
"</script>"})
|
|
|
List<FsCourseWatchLogStatisticsListVO> selectFsCourseWatchLogStatisticsListVO(FsCourseWatchLogStatisticsListParam param);
|
|
|
|
|
|
+ @Select({"<script> " +
|
|
|
+ " \tselect \n" +
|
|
|
+ "\t'总合计' as qw_user_name,\n" +
|
|
|
+ "\tsum(t1.type1) as type1,\n" +
|
|
|
+ "\tsum(t1.type2) as type2,\n" +
|
|
|
+ "\tsum(t1.type3) as type3,\n" +
|
|
|
+ "\tsum(t1.type4) as type4,\n" +
|
|
|
+ "\t (\n" +
|
|
|
+ " sum(t1.type1)+\n" +
|
|
|
+ " sum(t1.type2) +\n" +
|
|
|
+ " sum(t1.type4)\n" +
|
|
|
+ " ) AS on_line_num,\n" +
|
|
|
+ "\t sum(send_number) as send_number,\n" +
|
|
|
+ "\t sum(is_user_wait_number) as is_user_wait_number,\n" +
|
|
|
+ "\t sum(no_user_wait_number) as no_user_wait_number,\n" +
|
|
|
+ "\t sum(red_amount) as red_amount\n" +
|
|
|
+ "\tfrom ( select t.* " +
|
|
|
+ "<if test= 'sendType != 1 '> " +
|
|
|
+ " ,concat(round(if(t.send_number=0,0,(t.on_line_num/t.send_number)*100),2),'%') on_line_rate" +
|
|
|
+ " ,concat(round(if(t.send_number=0,0,(t.type2/t.send_number)*100),2),'%') finished_rate" +
|
|
|
+ "</if> " +
|
|
|
+ "from (" +
|
|
|
+ "SELECT \n" +
|
|
|
+ "o.video_id,o.company_id,o.qw_user_id,DATE(o.create_time) create_time," +
|
|
|
+ "<if test= 'sendType != 1 '> " +
|
|
|
+ " qu.qw_user_name qw_user_name," +
|
|
|
+ "</if>\n" +
|
|
|
+ "<if test= 'sendType == 1 '> " +
|
|
|
+ " cu.nick_name qw_user_name," +
|
|
|
+ "</if>\n" +
|
|
|
+ "v.title videoName,uc.course_name,\n" +
|
|
|
+ "SUM(CASE WHEN o.log_type = '1' THEN 1 ELSE 0 END) AS type1,\n" +
|
|
|
+ "SUM(CASE WHEN o.log_type = '2' THEN 1 ELSE 0 END) AS type2,\n" +
|
|
|
+ "SUM(CASE WHEN o.log_type = '3' THEN 1 ELSE 0 END) AS type3,\n" +
|
|
|
+ "SUM(CASE WHEN o.log_type = '4' THEN 1 ELSE 0 END) AS type4,\n" +
|
|
|
+ "(\n" +
|
|
|
+ " SUM(CASE WHEN o.log_type = '1' THEN 1 ELSE 0 END) +\n" +
|
|
|
+ " SUM(CASE WHEN o.log_type = '2' THEN 1 ELSE 0 END) +\n" +
|
|
|
+ " SUM(CASE WHEN o.log_type = '4' THEN 1 ELSE 0 END)\n" +
|
|
|
+ ") AS on_line_num " +
|
|
|
+ "<if test= 'sendType != 1 '> " +
|
|
|
+ " ,count(o.log_id) send_number" +
|
|
|
+ " ,sum(if((o.user_id is not null or o.user_id>0) and o.log_type=3,1,0)) is_user_wait_number" +
|
|
|
+ " ,sum(if((o.user_id is null or o.user_id=0) and o.log_type=3,1,0)) no_user_wait_number" +
|
|
|
+// " ,sum(ifnull(fcr.amount,0)) red_amount" +
|
|
|
+ ",(SELECT SUM(amount) FROM fs_course_red_packet_log \n" +
|
|
|
+ " WHERE user_id = o.user_id AND video_id = o.video_id) as red_amount " +
|
|
|
+ "</if> " +
|
|
|
+ "FROM fs_course_watch_log o " +
|
|
|
+ "<if test= 'sendType != 1 '> " +
|
|
|
+ " LEFT JOIN qw_user qu on qu.id=o.qw_user_id " +
|
|
|
+// " LEFT JOIN fs_course_red_packet_log fcr on o.user_id = fcr.user_id and fcr.video_id = o.video_id" + //会有笛卡尔积问题
|
|
|
+ "</if>\n" +
|
|
|
+ "LEFT JOIN fs_user_course_video v on v.video_id=o.video_id \n" +
|
|
|
+ "LEFT JOIN fs_user_course uc on uc.course_id=v.course_id\n" +
|
|
|
+ "<if test= 'sendType == 1 '> " +
|
|
|
+ " LEFT JOIN company_user cu on cu.user_id=o.company_user_id\n" +
|
|
|
+ "</if>\n" +
|
|
|
+ "where o.company_id=#{companyId} " +
|
|
|
+ "<if test= 'sendType != null '> " +
|
|
|
+ " and send_type= #{sendType} " +
|
|
|
+ "</if>\n" +
|
|
|
+ "<if test= 'sTime != null '> " +
|
|
|
+ " and DATE(o.create_time) >= DATE(#{sTime})\n" +
|
|
|
+ "</if>\n" +
|
|
|
+ "<if test='eTime != null '> " +
|
|
|
+ " and DATE(o.create_time) <= DATE(#{eTime})\n" +
|
|
|
+ "</if>" +
|
|
|
+ "<if test ='sendType != 1 and nickName !=null and nickName!=\"\"'>\n" +
|
|
|
+ " and qu.qw_user_name like concat( #{nickName}, '%')\n" +
|
|
|
+ "</if>" +
|
|
|
+ "<if test ='sendType == 1 and nickName !=null and nickName!=\"\"'>\n" +
|
|
|
+ " and cu.nick_name like concat( #{nickName}, '%')\n" +
|
|
|
+ "</if>" +
|
|
|
+ "<if test ='courseId !=null'> " +
|
|
|
+ " and o.course_id = #{courseId} " +
|
|
|
+ "</if>" +
|
|
|
+ "<if test ='videoId !=null'> " +
|
|
|
+ " and o.video_id = #{videoId} " +
|
|
|
+ "</if>" +
|
|
|
+ "GROUP BY o.video_id," +
|
|
|
+ "<if test= 'sendType != 1 '> " +
|
|
|
+ " o.qw_user_id," +
|
|
|
+ "</if>\n" +
|
|
|
+ "<if test= 'sendType == 1 '> " +
|
|
|
+ " o.company_user_id," +
|
|
|
+ "</if>\n" +
|
|
|
+ "DATE(o.create_time)\n" +
|
|
|
+ "ORDER BY o.video_id ,DATE(o.create_time) " +
|
|
|
+ ") t ) t1 \n"+
|
|
|
+ "</script>"})
|
|
|
+ FsCourseWatchLogStatisticsListVO getTotalDataAddItem(FsCourseWatchLogStatisticsListParam param);
|
|
|
@Select({"<script> " +
|
|
|
"SELECT COUNT(*) FROM (" +
|
|
|
" SELECT 1 " +
|