|
@@ -207,5 +207,78 @@
|
|
|
|
|
|
</select>
|
|
|
|
|
|
+ <select id="courseDepartTotal" resultType="com.gyee.exam.modules.course.dto.response.CourseDepartTotalDTO">
|
|
|
+ SELECT
|
|
|
+ sd.dept_name deptName,
|
|
|
+ dept.dept_code deptCode,
|
|
|
+ COUNT( uc.id) AS ecTotalUser,-- 应培训人数
|
|
|
+ COUNT(DISTINCT cl.user_id) AS ecActualUser,-- 学习人数
|
|
|
+ COUNT(IF( cl.state = 1 ,1, NULL)) AS ecPassUser -- 学完人数
|
|
|
+ FROM el_course ec
|
|
|
+ LEFT JOIN el_course_depart dept on ec.id = dept.course_id
|
|
|
+ LEFT JOIN sys_depart sd on sd.dept_code = dept.dept_code
|
|
|
+ LEFT JOIN sys_user uc ON dept.dept_code=uc.dept_code
|
|
|
+ LEFT JOIN el_course_learn cl ON cl.user_id=uc.id AND cl.course_id=dept.course_id
|
|
|
+ <where>
|
|
|
+ AND uc.id IS NOT NULL
|
|
|
+ <if test="query!=null">
|
|
|
+
|
|
|
+ <if test="query.statDateL!=null ">
|
|
|
+ AND ec.create_time >= #{query.statDateL}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="query.statDateR!=null ">
|
|
|
+ AND ec.create_time < #{query.statDateR}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="query.q!=null and query.q!=''">
|
|
|
+ AND dept.dept_code = #{query.q}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+
|
|
|
+ GROUP BY dept.dept_code
|
|
|
+ ORDER BY ecActualUser desc ,ecPassUser desc
|
|
|
+
|
|
|
+
|
|
|
+ </select>
|
|
|
+ <select id="courseDepartIdTotal"
|
|
|
+ resultType="com.gyee.exam.modules.course.dto.response.courseDepartIdTotalDTO">
|
|
|
+ SELECT
|
|
|
+ ec.id,
|
|
|
+ ec.title,
|
|
|
+ ec.periods,
|
|
|
+ ec.create_time,
|
|
|
+ SUM(IF( cl.state = 1 ,1, 0)) passUser,
|
|
|
+ count(uc.id) actualUser,
|
|
|
+ (CASE WHEN SUM(IF( cl.state = 1 ,1, 0))>=count(uc.id) THEN 1 ELSE 0 END) AS passed
|
|
|
+
|
|
|
+ FROM el_course ec
|
|
|
+ LEFT JOIN el_course_depart dept on ec.id = dept.course_id
|
|
|
+ LEFT JOIN sys_user uc ON dept.dept_code=uc.dept_code
|
|
|
+ LEFT JOIN el_course_learn cl ON cl.user_id=uc.id AND cl.course_id=dept.course_id
|
|
|
+ <where>
|
|
|
+
|
|
|
+ <if test="query!=null">
|
|
|
+
|
|
|
+ <if test="query.statDateL!=null ">
|
|
|
+ AND ec.create_time >= #{query.statDateL}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="query.statDateR!=null ">
|
|
|
+ AND ec.create_time < #{query.statDateR}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="query.q!=null and query.q!=''">
|
|
|
+ AND dept.dept_code = #{query.q}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </where>
|
|
|
+ GROUP BY ec.id
|
|
|
+ </select>
|
|
|
+
|
|
|
|
|
|
</mapper>
|