|
@@ -58,15 +58,17 @@
|
|
|
keyColumn="id" keyProperty="id">
|
|
|
INSERT INTO student_attendance
|
|
|
(group_type_,music_group_id_,class_group_id_,course_schedule_id_,user_id_,teacher_id_,status_,create_time_,
|
|
|
- update_time_,remark_,current_class_times_,sign_in_time_,sign_out_time_,current_schedule_id_,visit_flag_,normal_remind_)
|
|
|
+ update_time_,remark_,current_class_times_,sign_in_time_,sign_out_time_,current_schedule_id_,visit_flag_,normal_remind_,first_leave_)
|
|
|
VALUES(#{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{musicGroupId},#{classGroupId},
|
|
|
#{courseScheduleId},#{userId},#{teacherId},#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},now(),now(),
|
|
|
- #{remark},#{currentClassTimes},#{signInTime},#{signOutTime},#{currentScheduleId},#{visitFlag,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{normalRemind})
|
|
|
+ #{remark},#{currentClassTimes},#{signInTime},#{signOutTime},#{currentScheduleId},#{visitFlag,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
|
|
|
+ #{normalRemind},#{firstLeave,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler})
|
|
|
</insert>
|
|
|
|
|
|
<insert id="addStudentAttendances" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id_">
|
|
|
INSERT INTO student_attendance (group_type_, music_group_id_, class_group_id_, course_schedule_id_,
|
|
|
- user_id_, teacher_id_, status_, create_time_,update_time_, remark_ ,current_class_times_,sign_in_time_,sign_out_time_,current_schedule_id_,visit_flag_,normal_remind_)
|
|
|
+ user_id_, teacher_id_, status_, create_time_,update_time_, remark_ ,current_class_times_,sign_in_time_,
|
|
|
+ sign_out_time_,current_schedule_id_,visit_flag_,normal_remind_,first_leave_)
|
|
|
VALUES
|
|
|
<foreach collection="list" item="studentAttendance" separator=",">
|
|
|
(#{studentAttendance.groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
|
|
@@ -75,7 +77,7 @@
|
|
|
#{studentAttendance.status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},now(),#{studentAttendance.updateTime},
|
|
|
#{studentAttendance.remark},#{studentAttendance.currentClassTimes},
|
|
|
#{studentAttendance.signInTime},#{studentAttendance.signOutTime},#{studentAttendance.currentScheduleId},#{studentAttendance.visitFlag,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
|
|
|
- #{studentAttendance.normalRemind})
|
|
|
+ #{studentAttendance.normalRemind},#{studentAttendance.firstLeave,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler})
|
|
|
</foreach>
|
|
|
</insert>
|
|
|
|
|
@@ -83,6 +85,9 @@
|
|
|
<update id="update" parameterType="com.ym.mec.biz.dal.entity.StudentAttendance">
|
|
|
UPDATE student_attendance
|
|
|
<set>
|
|
|
+ <if test="firstLeave != null">
|
|
|
+ first_leave_ = #{firstLeave,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
|
|
|
+ </if>
|
|
|
<if test="status != null">
|
|
|
status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
|
|
|
</if>
|
|
@@ -130,54 +135,6 @@
|
|
|
WHERE id_ = #{id}
|
|
|
</update>
|
|
|
|
|
|
- <update id="batchUpdate" parameterType="java.util.List">
|
|
|
- <foreach collection="list" item="item" index="index" open="" close="" separator=";">
|
|
|
- update student_attendance
|
|
|
- <set>
|
|
|
- <if test="item.visitFlag != null">
|
|
|
- visit_flag_ = #{item.visitFlag,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
|
|
|
- </if>
|
|
|
- <if test="item.status != null">
|
|
|
- status_ = #{item.status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
|
|
|
- </if>
|
|
|
- <if test="item.signOutTime != null">
|
|
|
- sign_out_time_ = #{item.signOutTime},
|
|
|
- </if>
|
|
|
- <if test="item.signInTime != null">
|
|
|
- sign_in_time_ = #{item.signInTime},
|
|
|
- </if>
|
|
|
- <if test="item.userId != null">
|
|
|
- user_id_ = #{item.userId},
|
|
|
- </if>
|
|
|
- <if test="item.remark != null">
|
|
|
- remark_ = #{item.remark},
|
|
|
- </if>
|
|
|
- <if test="item.classGroupId != null">
|
|
|
- class_group_id_ = #{item.classGroupId},
|
|
|
- </if>
|
|
|
- <if test="item.groupType != null">
|
|
|
- group_type_ = #{item.groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
|
|
|
- </if>
|
|
|
- <if test="item.teacherId != null">
|
|
|
- teacher_id_ = #{item.teacherId},
|
|
|
- </if>
|
|
|
- <if test="item.courseScheduleId != null">
|
|
|
- course_schedule_id_ = #{item.courseScheduleId},
|
|
|
- </if>
|
|
|
- <if test="item.musicGroupId != null">
|
|
|
- music_group_id_ = #{item.musicGroupId},
|
|
|
- </if>
|
|
|
- <if test="item.currentClassTimes != null">
|
|
|
- current_class_times_ = #{item.currentClassTimes},
|
|
|
- </if>
|
|
|
- <if test="item.normalRemind != null">
|
|
|
- normal_remind_ = #{item.normalRemind},
|
|
|
- </if>
|
|
|
- update_time_=NOW()
|
|
|
- </set>
|
|
|
- where id_ = #{item.id}
|
|
|
- </foreach>
|
|
|
- </update>
|
|
|
<update id="cleanCourseStudentSignOut">
|
|
|
UPDATE student_attendance
|
|
|
SET sign_out_time_= NULL
|
|
@@ -690,4 +647,12 @@
|
|
|
LEFT JOIN student_attendance sa ON sa.course_schedule_id_ = cssp.course_schedule_id_ AND cssp.user_id_ = sa.user_id_
|
|
|
WHERE (sa.status_ != 'NORMAL' OR sa.status_ IS NULL) AND cssp.course_schedule_id_ = #{courseScheduleId}
|
|
|
</select>
|
|
|
+ <select id="getLeaveNum" resultType="java.lang.Integer">
|
|
|
+ SELECT COUNT(sa.id_) FROM student_attendance sa
|
|
|
+ LEFT JOIN course_schedule cs ON cs.id_ = sa.course_schedule_id_
|
|
|
+ WHERE DATE_FORMAT(cs.class_date_,'%Y-%m') = #{month} AND sa.user_id_ = #{userId} AND sa.status_ = 'LEAVE'
|
|
|
+ <if test="attendanceId != null">
|
|
|
+ AND sa.id_ != #{attendanceId}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
</mapper>
|