| 
					
				 | 
			
			
				@@ -1772,9 +1772,10 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         count(DISTINCT l.user_id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         FROM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         fs_course_watch_log l 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LEFT JOIN fs_user on fs_user.user_id = l.user_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         LEFT JOIN company_user ON l.company_user_id = company_user.user_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         where 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            l.log_type != 3 and send_type = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            l.log_type != 3 and send_type = 1 AND fs_user.is_del = 0 AND fs_user.`status` = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="userId != null and userId != 0 "> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 and (l.company_user_id = #{userId} OR company_user.parent_id = #{userId} ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             </if> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1803,9 +1804,10 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         count(DISTINCT l.user_id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         FROM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         fs_course_watch_log l 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LEFT JOIN fs_user on fs_user.user_id = l.user_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         LEFT JOIN company_user ON l.company_user_id = company_user.user_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         where 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        l.log_type = 2 and send_type = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        l.log_type = 2 and send_type = 1 AND fs_user.is_del = 0 AND fs_user.`status` = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <if test="userId != null and userId != 0 "> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             and (l.company_user_id = #{userId} OR company_user.parent_id = #{userId} ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </if> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1831,4 +1833,35 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ) as courseCompleteNum 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <select id="countCourseDetailsNew" resultType="Map"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        SELECT 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        count( DISTINCT l.period_id ) as courseNum, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        count( DISTINCT l.video_id ) as videoNum, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        count( DISTINCT l.user_id ) as courseUserNum 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        FROM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        fs_course_watch_log l 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        left join fs_user on fs_user.user_id = l.user_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LEFT JOIN company_user ON l.company_user_id = company_user.user_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        WHERE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        l.log_type != 3 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        AND send_type = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        AND fs_user.is_del = 0 AND fs_user.`status` = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="userId != null and userId != 0 "> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            AND l.company_user_id = #{userId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="userId != null and userId == 0 "> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            and l.company_id = #{companyId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="periodId != null and periodId != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            AND l.period_id =  #{periodId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="videoId != null and videoId != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            AND l.video_id = #{videoId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        -- 单独通过销售id查询 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="companyUserId != null and companyUserId != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            AND l.company_user_id = #{companyUserId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 </mapper> 
			 |