|  | @@ -168,13 +168,13 @@
 | 
	
		
			
				|  |  |          <where>
 | 
	
		
			
				|  |  |              (cs.del_flag_ != 1 OR cs.del_flag_ IS NULL)
 | 
	
		
			
				|  |  |              <if test="teacherId != null">
 | 
	
		
			
				|  |  | -                and cs.actual_teacher_id_ = #{teacherId}
 | 
	
		
			
				|  |  | +                AND cs.actual_teacher_id_ = #{teacherId}
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  |              <if test="courseStartDate != null">
 | 
	
		
			
				|  |  | -                and cs.class_date_ >= #{courseStartDate}
 | 
	
		
			
				|  |  | +                AND cs.class_date_ >= #{courseStartDate}
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  |              <if test="courseEndDate != null">
 | 
	
		
			
				|  |  | -                and cs.class_date_ <= #{courseEndDate}
 | 
	
		
			
				|  |  | +                AND cs.class_date_ <= #{courseEndDate}
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  |              <if test="signInStatus != null and signInStatus != 3">
 | 
	
		
			
				|  |  |                  AND ta.sign_in_status_ = #{signInStatus}
 | 
	
	
		
			
				|  | @@ -189,10 +189,10 @@
 | 
	
		
			
				|  |  |                  AND ta.sign_in_status_ IS NULL
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  |              <if test="courseScheduleType != null">
 | 
	
		
			
				|  |  | -                and cs.type_ = #{courseScheduleType}
 | 
	
		
			
				|  |  | +                AND cs.type_ = #{courseScheduleType}
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  |              <if test="classGroupName != null">
 | 
	
		
			
				|  |  | -                and cs.name_ like CONCAT('%',#{classGroupName},'%')
 | 
	
		
			
				|  |  | +                AND cs.name_ LIKE CONCAT('%',#{classGroupName},'%')
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  |          </where>
 | 
	
		
			
				|  |  |      </sql>
 | 
	
	
		
			
				|  | @@ -204,20 +204,21 @@
 | 
	
		
			
				|  |  |              IF(ta.sign_out_status_ IS NULL,3,ta.sign_out_status_) sign_out_status_,
 | 
	
		
			
				|  |  |              ta.remark_
 | 
	
		
			
				|  |  |          FROM
 | 
	
		
			
				|  |  | -            course_schedule cs left join teacher_attendance ta  ON ta.course_schedule_id_=cs.id_
 | 
	
		
			
				|  |  | +            course_schedule cs
 | 
	
		
			
				|  |  | +            LEFT JOIN teacher_attendance ta  ON ta.course_schedule_id_=cs.id_
 | 
	
		
			
				|  |  |          <include refid="queryCondition"/>
 | 
	
		
			
				|  |  |          ORDER BY cs.class_date_ ASC,cs.start_class_time_ ASC
 | 
	
		
			
				|  |  |          <include refid="global.limit"/>
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <select id="getTeacherPersonalAttendancesCount" resultType="int">
 | 
	
		
			
				|  |  | -        SELECT count(cs.id_) FROM course_schedule cs left join teacher_attendance ta
 | 
	
		
			
				|  |  | +        SELECT count(cs.id_) FROM course_schedule cs LEFT JOIN teacher_attendance ta
 | 
	
		
			
				|  |  |          ON ta.course_schedule_id_=cs.id_
 | 
	
		
			
				|  |  |          <include refid="queryCondition"/>
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <select id="countClassTime" resultType="java.lang.Integer">
 | 
	
		
			
				|  |  | -        select count(*) from teacher_attendance where class_group_id_=#{classGroupId} for update
 | 
	
		
			
				|  |  | +        SELECT COUNT(*) FROM teacher_attendance WHERE class_group_id_=#{classGroupId} FOR UPDATE
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |      
 | 
	
		
			
				|  |  |      <select id="findByTeacherAttendanceInfo" resultMap="TeacherAttendance">
 | 
	
	
		
			
				|  | @@ -301,10 +302,10 @@
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <select id="queryNoSignOutListByOverMinutes" resultMap="Mapper">
 | 
	
		
			
				|  |  |          SELECT ta.teacher_id_ key_,u.real_name_ value_,cs.id_ course_schedule_id_
 | 
	
		
			
				|  |  | -        FROM course_schedule cs right join teacher_attendance ta on ta.course_schedule_id_ = cs.id_
 | 
	
		
			
				|  |  | -        left join sys_user u on ta.teacher_id_ = u.id_
 | 
	
		
			
				|  |  | -        WHERE ta.sign_out_status_ = 0 and date(cs.class_date_) = date(now())
 | 
	
		
			
				|  |  | -        and SUBTIME(cs.end_class_time_, CONCAT(#{minutes},'00')) < CURRENT_TIME()
 | 
	
		
			
				|  |  | +        FROM course_schedule cs RIGHT JOIN teacher_attendance ta on ta.course_schedule_id_ = cs.id_
 | 
	
		
			
				|  |  | +        LEFT JOIN sys_user u on ta.teacher_id_ = u.id_
 | 
	
		
			
				|  |  | +        WHERE ta.sign_out_status_ IS NULL
 | 
	
		
			
				|  |  | +        AND CONCAT( cs.class_date_, ' ', cs.end_class_time_ ) <= DATE_SUB(now(),INTERVAL #{minutes} MINUTE) AND cs.del_flag_ = 0
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |      <select id="findTeacherIdByCourseSchedule" resultMap="TeacherAttendance">
 | 
	
		
			
				|  |  |          SELECT
 | 
	
	
		
			
				|  | @@ -345,16 +346,16 @@
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <update id="updateViPSignOutStatus" parameterType="string">
 | 
	
		
			
				|  |  | -    	update teacher_attendance set sign_out_status_ = 1,sign_out_time_= now()
 | 
	
		
			
				|  |  | -    	where FIND_IN_SET(course_schedule_id_,#{courseScheduleIdList}) and sign_in_status_ = 1
 | 
	
		
			
				|  |  | +    	UPDATE teacher_attendance SET sign_out_status_ = 1,sign_out_time_= now()
 | 
	
		
			
				|  |  | +    	WHERE FIND_IN_SET(course_schedule_id_,#{courseScheduleIdList}) AND sign_in_status_ = 1
 | 
	
		
			
				|  |  |      </update>
 | 
	
		
			
				|  |  |      <update id="cleanCourseTeacherSignInfo">
 | 
	
		
			
				|  |  | -        update teacher_attendance
 | 
	
		
			
				|  |  | -        set sign_in_time_=null,sign_in_status_=null,sign_out_status_ = null,sign_out_time_= null
 | 
	
		
			
				|  |  | -    	where course_schedule_id_=#{courseScheduleId}
 | 
	
		
			
				|  |  | +        UPDATE teacher_attendance
 | 
	
		
			
				|  |  | +        SET sign_in_time_ = NULL,sign_in_status_=NULL,sign_out_status_ = NULL,sign_out_time_= NULL
 | 
	
		
			
				|  |  | +    	WHERE course_schedule_id_=#{courseScheduleId}
 | 
	
		
			
				|  |  |      </update>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <delete id="deleteByMusicGroupId" parameterType="map" >
 | 
	
		
			
				|  |  | -		DELETE ta FROM teacher_attendance ta left join course_schedule cs on ta.course_schedule_id_ = cs.id_ WHERE ta.music_group_id_=#{musicGroupId} AND ta.group_type_=#{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler} and cs.status_ = 'NOT_START'
 | 
	
		
			
				|  |  | +		DELETE ta FROM teacher_attendance ta LEFT JOIN course_schedule cs ON ta.course_schedule_id_ = cs.id_ WHERE ta.music_group_id_=#{musicGroupId} AND ta.group_type_=#{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler} and cs.status_ = 'NOT_START'
 | 
	
		
			
				|  |  |  	</delete>
 | 
	
		
			
				|  |  |  </mapper>
 |