| 
					
				 | 
			
			
				@@ -386,4 +386,26 @@ public interface FsCourseWatchLogMapper extends BaseMapper<FsCourseWatchLog> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ") dd ON ds.report_date = dd.log_date\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             "ORDER BY ds.report_date ASC") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     List<WatchLogDTO> selectFsCourseWatchLog30DayByExtId(@Param("extId") Long extId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Select("select count(*) from fs_course_watch_log where user_id =#{userId} and project =#{projectId} ") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    Long selectByWatchLjDay(@Param("userId") Long userId,@Param("projectId")  Long projectId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Select("SELECT IFNULL(MAX(streak), 0) AS current_consecutive_days\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            "FROM (\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            "    SELECT \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            "        watch_date,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            "        @streak := IF(\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            "            DATEDIFF(@prev_date, watch_date) = 1, \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            "            @streak + 1, \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            "            1\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            "        ) AS streak,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            "        @prev_date := watch_date\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            "    FROM (\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            "        SELECT DISTINCT DATE(create_time) AS watch_date\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            "        FROM fs_course_watch_log\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            "        WHERE user_id = #{userId} AND project = #{projectId}\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            "        ORDER BY watch_date DESC\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            "    ) AS dates,\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            "    (SELECT @streak := 0, @prev_date := NULL) AS vars\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ") AS streak_data;") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    Long selectByWatchlxDay(@Param("userId") Long userId,@Param("projectId")  Long projectId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |