|
@@ -1405,28 +1405,42 @@
|
|
|
SELECT COUNT(DISTINCT c.user_id_) FROM (
|
|
|
SELECT sa.user_id_ 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)
|
|
|
+ AND FIND_IN_SET(cs.organ_id_,#{organId})
|
|
|
+ </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_)) c
|
|
|
</select>
|
|
|
<resultMap id="StudentErrorLeaveDto" type="com.ym.mec.biz.dal.dto.StudentErrorLeaveDto">
|
|
|
- <result property="currentNum" column="currentNum"/>
|
|
|
- <result property="totalNum" column="totalNum"/>
|
|
|
+ <result property="currentNum" column="current_num_"/>
|
|
|
+ <result property="totalNum" column="total_num_"/>
|
|
|
<result property="userId" column="user_id_"/>
|
|
|
<result property="studentName" column="username_"/>
|
|
|
+ <result property="phone" column="phone_"/>
|
|
|
+ <result property="organId" column="organ_id_"/>
|
|
|
+ <result property="organName" column="organ_name_"/>
|
|
|
</resultMap>
|
|
|
<select id="queryStudentErrorLeave" resultMap="StudentErrorLeaveDto">
|
|
|
- SELECT * FROM (SELECT sa.user_id_,su.username_,COUNT(sa.id_) total_num_,
|
|
|
+ SELECT * FROM (SELECT cs.organ_id_,o.name_ organ_name_,sa.user_id_,su.username_,su.phone_,COUNT(sa.id_) total_num_,
|
|
|
COUNT(CASE WHEN DATE_FORMAT(cs.class_date_,'%Y-%m') = #{currentMonth} THEN 1 ELSE NULL END) current_num_,cs.class_date_
|
|
|
FROM student_attendance sa
|
|
|
+ LEFT JOIN course_schedule cs ON cs.id_ = sa.course_schedule_id_
|
|
|
+ LEFT JOIN organization o ON o.id_ = cs.organ_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)
|
|
|
+ AND FIND_IN_SET(cs.organ_id_,#{organId})
|
|
|
+ </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)c
|
|
|
+ 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_))c
|
|
|
WHERE DATE_FORMAT(c.class_date_ ,'%Y-%m') = #{currentMonth}
|
|
|
+ <include refid="global.limit"/>
|
|
|
</select>
|
|
|
</mapper>
|