|
@@ -1507,4 +1507,26 @@
|
|
|
ORDER BY cs.class_date_ DESC,cs.start_class_time_ DESC
|
|
|
<include refid="global.limit"/>
|
|
|
</select>
|
|
|
+ <select id="getStudentErrorLeaveNumMap" resultType="java.util.Map">
|
|
|
+ SELECT user_id_ 'key',SUM(total_num_) 'value'
|
|
|
+ FROM (SELECT sa.user_id_,COUNT(sa.id_) total_num_
|
|
|
+ FROM student_attendance sa
|
|
|
+ LEFT JOIN course_schedule cs ON cs.id_ = sa.course_schedule_id_
|
|
|
+ LEFT JOIN sys_user su ON su.id_ = sa.user_id_
|
|
|
+ WHERE DATE_FORMAT(cs.class_date_,'%Y-%m') >= #{totalMonth} AND sa.status_ = 'LEAVE'
|
|
|
+ <if test="organId != null">
|
|
|
+ AND FIND_IN_SET(cs.organ_id_,#{organId})
|
|
|
+ </if>
|
|
|
+ <if test="classGroupIds != null and classGroupIds.size() > 0">
|
|
|
+ AND cs.class_group_id_ IN
|
|
|
+ <foreach collection="classGroupIds" item="classGroupId" open="(" close=")" separator=",">
|
|
|
+ #{classGroupId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="search != null and search != ''">
|
|
|
+ AND (sa.user_id_ = #{search} OR su.username_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%'))
|
|
|
+ </if>
|
|
|
+ GROUP BY sa.user_id_,DATE_FORMAT(cs.class_date_,'%Y-%m') HAVING COUNT(sa.id_) > 1 AND COUNT(sa.id_) > SUM(sa.leave_visit_flag_) ORDER BY cs.class_date_ DESC)c
|
|
|
+ GROUP BY c.user_id_
|
|
|
+ </select>
|
|
|
</mapper>
|