|
@@ -493,98 +493,64 @@
|
|
|
LEFT JOIN sys_user su ON cssp.user_id_ = su.id_
|
|
|
left join sys_user tu on tu.id_ = cs.actual_teacher_id_
|
|
|
left join organization o on o.id_ = cs.organ_id_
|
|
|
+ <include refid="findStudentAttendanceSql"/>
|
|
|
+ ORDER BY CONCAT(cs.class_date_, ' ', cs.start_class_time_) asc
|
|
|
+ <include refid="global.limit"/>
|
|
|
+ </select>
|
|
|
+ <sql id="findStudentAttendanceSql">
|
|
|
<where>
|
|
|
- <if test="courseScheduleId != null">
|
|
|
- cssp.course_schedule_id_ = #{courseScheduleId}
|
|
|
- </if>
|
|
|
- <if test="search != null">
|
|
|
- and cssp.course_schedule_id_ = #{search}
|
|
|
- </if>
|
|
|
- <if test="studentID != null">
|
|
|
- and cssp.user_id_ = #{studentID}
|
|
|
- </if>
|
|
|
- <if test="startDateOfCourse != null">
|
|
|
- and cs.class_date_ >= #{startDateOfCourse}
|
|
|
- </if>
|
|
|
- <if test="endDateOfCourse != null">
|
|
|
- and cs.class_date_ <= #{endDateOfCourse}
|
|
|
- </if>
|
|
|
- <if test="courseScheduleType != null">
|
|
|
- and cs.type_ = #{courseScheduleType}
|
|
|
- </if>
|
|
|
- <if test="teacherId != null">
|
|
|
- and cs.actual_teacher_id_ = #{teacherId}
|
|
|
- </if>
|
|
|
- <if test="courseStatus != null">
|
|
|
- and cs.status_ = #{courseStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
|
|
|
- </if>
|
|
|
- <if test="status != null">
|
|
|
+ <if test="courseScheduleId != null">
|
|
|
+ cssp.course_schedule_id_ = #{courseScheduleId}
|
|
|
+ </if>
|
|
|
+ <if test="search != null">
|
|
|
+ and cssp.course_schedule_id_ = #{search}
|
|
|
+ </if>
|
|
|
+ <if test="studentID != null">
|
|
|
+ and cssp.user_id_ = #{studentID}
|
|
|
+ </if>
|
|
|
+ <if test="startDateOfCourse != null">
|
|
|
+ and cs.class_date_ >= #{startDateOfCourse}
|
|
|
+ </if>
|
|
|
+ <if test="endDateOfCourse != null">
|
|
|
+ and cs.class_date_ <= #{endDateOfCourse}
|
|
|
+ </if>
|
|
|
+ <if test="courseScheduleType != null">
|
|
|
+ and cs.type_ = #{courseScheduleType}
|
|
|
+ </if>
|
|
|
+ <if test="teacherId != null">
|
|
|
+ and cs.actual_teacher_id_ = #{teacherId}
|
|
|
+ </if>
|
|
|
+ <if test="courseStatus != null">
|
|
|
+ and cs.status_ = #{courseStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
and (sa.status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
|
|
|
<if test="status.code == 'TRUANT'">
|
|
|
OR sa.id_ IS NULL
|
|
|
</if>
|
|
|
)
|
|
|
- </if>
|
|
|
- <if test="groupType != null">
|
|
|
- and cssp.group_type_ = #{groupType}
|
|
|
- </if>
|
|
|
- <if test="musicGroupId != null">
|
|
|
- and cssp.music_group_id_ = #{musicGroupId}
|
|
|
- </if>
|
|
|
+ </if>
|
|
|
+ <if test="groupType != null">
|
|
|
+ and cssp.group_type_ = #{groupType}
|
|
|
+ </if>
|
|
|
+ <if test="musicGroupId != null">
|
|
|
+ and cssp.music_group_id_ = #{musicGroupId}
|
|
|
+ </if>
|
|
|
<if test="organId != null and organId != ''">
|
|
|
AND FIND_IN_SET(cs.organ_id_,#{organId})
|
|
|
</if>
|
|
|
+ <if test="ids != null and ids != ''">
|
|
|
+ AND FIND_IN_SET(cssp.id_,#{ids})
|
|
|
+ </if>
|
|
|
</where>
|
|
|
- ORDER BY CONCAT(cs.class_date_, ' ', cs.start_class_time_) asc
|
|
|
- <include refid="global.limit"/>
|
|
|
- </select>
|
|
|
+ </sql>
|
|
|
|
|
|
<select id="countStudentAttendance" resultType="java.lang.Integer">
|
|
|
SELECT count(cssp.id_)
|
|
|
- FROM course_schedule_student_payment cssp left join course_schedule cs on cs.id_ = cssp.course_schedule_id_
|
|
|
+ FROM course_schedule_student_payment cssp
|
|
|
+ left join course_schedule cs on cs.id_ = cssp.course_schedule_id_
|
|
|
left join student_attendance sa on cssp.course_schedule_id_ = sa.course_schedule_id_ and cssp.user_id_ = sa.user_id_
|
|
|
- <where>
|
|
|
- <if test="courseScheduleId != null">
|
|
|
- cssp.course_schedule_id_ = #{courseScheduleId}
|
|
|
- </if>
|
|
|
- <if test="search != null">
|
|
|
- and cssp.course_schedule_id_ = #{search}
|
|
|
- </if>
|
|
|
- <if test="studentID != null">
|
|
|
- and cssp.user_id_ = #{studentID}
|
|
|
- </if>
|
|
|
- <if test="startDateOfCourse != null">
|
|
|
- and cs.class_date_ >= #{startDateOfCourse}
|
|
|
- </if>
|
|
|
- <if test="endDateOfCourse != null">
|
|
|
- and cs.class_date_ <= #{endDateOfCourse}
|
|
|
- </if>
|
|
|
- <if test="courseScheduleType != null">
|
|
|
- and cs.type_ = #{courseScheduleType}
|
|
|
- </if>
|
|
|
- <if test="teacherId != null">
|
|
|
- and cs.actual_teacher_id_ = #{teacherId}
|
|
|
- </if>
|
|
|
- <if test="courseStatus != null">
|
|
|
- and cs.status_ = #{courseStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
|
|
|
- </if>
|
|
|
- <if test="status != null">
|
|
|
- and (sa.status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
|
|
|
- <if test="status.code == 'TRUANT'">
|
|
|
- OR sa.id_ IS NULL
|
|
|
- </if>
|
|
|
- )
|
|
|
- </if>
|
|
|
- <if test="groupType != null">
|
|
|
- and cssp.group_type_ = #{groupType}
|
|
|
- </if>
|
|
|
- <if test="musicGroupId != null">
|
|
|
- and cssp.music_group_id_ = #{musicGroupId}
|
|
|
- </if>
|
|
|
- <if test="organId != null and organId != ''">
|
|
|
- AND FIND_IN_SET(cs.organ_id_,#{organId})
|
|
|
- </if>
|
|
|
- </where>
|
|
|
+ <include refid="findStudentAttendanceSql"/>
|
|
|
</select>
|
|
|
<select id="findByCourseId" resultMap="StudentAttendance">
|
|
|
SELECT * FROM student_attendance WHERE course_schedule_id_=#{courseId}
|