zouxuan 5 years ago
parent
commit
f9fa1c3bc7

+ 4 - 1
mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -1450,7 +1450,10 @@
     </select>
     </select>
     
     
     <select id="queryStudentNotStartCourseScheduleIn90Mins" resultMap="Mapper">
     <select id="queryStudentNotStartCourseScheduleIn90Mins" resultMap="Mapper">
-    	select cssp.user_id_ key_,cs.name_ value_ from course_schedule cs right join course_schedule_student_payment cssp on cs.id_ = cssp.course_schedule_id_ where CONCAT( cs.class_date_, ' ', cs.start_class_time_ ) &lt; DATE_ADD(now(),INTERVAL 6 HOUR) and cs.status_ = 'NOT_START'
+    	select cssp.user_id_ key_,cs.name_ value_
+    	from course_schedule cs
+    	right join course_schedule_student_payment cssp on cs.id_ = cssp.course_schedule_id_
+    	where CONCAT( cs.class_date_, ' ', cs.start_class_time_ ) &lt; DATE_ADD(now(),INTERVAL 90 MINUTE) and cs.status_ = 'NOT_START'
     </select>
     </select>
     
     
     <select id="queryTeacherCoursesTimesOfTomorrow" resultMap="Mapper">
     <select id="queryTeacherCoursesTimesOfTomorrow" resultMap="Mapper">

+ 19 - 18
mec-biz/src/main/resources/config/mybatis/TeacherAttendanceMapper.xml

@@ -168,13 +168,13 @@
         <where>
         <where>
             (cs.del_flag_ != 1 OR cs.del_flag_ IS NULL)
             (cs.del_flag_ != 1 OR cs.del_flag_ IS NULL)
             <if test="teacherId != null">
             <if test="teacherId != null">
-                and cs.actual_teacher_id_ = #{teacherId}
+                AND cs.actual_teacher_id_ = #{teacherId}
             </if>
             </if>
             <if test="courseStartDate != null">
             <if test="courseStartDate != null">
-                and cs.class_date_ &gt;= #{courseStartDate}
+                AND cs.class_date_ &gt;= #{courseStartDate}
             </if>
             </if>
             <if test="courseEndDate != null">
             <if test="courseEndDate != null">
-                and cs.class_date_ &lt;= #{courseEndDate}
+                AND cs.class_date_ &lt;= #{courseEndDate}
             </if>
             </if>
             <if test="signInStatus != null and signInStatus != 3">
             <if test="signInStatus != null and signInStatus != 3">
                 AND ta.sign_in_status_ = #{signInStatus}
                 AND ta.sign_in_status_ = #{signInStatus}
@@ -189,10 +189,10 @@
                 AND ta.sign_in_status_ IS NULL
                 AND ta.sign_in_status_ IS NULL
             </if>
             </if>
             <if test="courseScheduleType != null">
             <if test="courseScheduleType != null">
-                and cs.type_ = #{courseScheduleType}
+                AND cs.type_ = #{courseScheduleType}
             </if>
             </if>
             <if test="classGroupName != null">
             <if test="classGroupName != null">
-                and cs.name_ like CONCAT('%',#{classGroupName},'%')
+                AND cs.name_ LIKE CONCAT('%',#{classGroupName},'%')
             </if>
             </if>
         </where>
         </where>
     </sql>
     </sql>
@@ -204,20 +204,21 @@
             IF(ta.sign_out_status_ IS NULL,3,ta.sign_out_status_) sign_out_status_,
             IF(ta.sign_out_status_ IS NULL,3,ta.sign_out_status_) sign_out_status_,
             ta.remark_
             ta.remark_
         FROM
         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"/>
         <include refid="queryCondition"/>
         ORDER BY cs.class_date_ ASC,cs.start_class_time_ ASC
         ORDER BY cs.class_date_ ASC,cs.start_class_time_ ASC
         <include refid="global.limit"/>
         <include refid="global.limit"/>
     </select>
     </select>
 
 
     <select id="getTeacherPersonalAttendancesCount" resultType="int">
     <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_
         ON ta.course_schedule_id_=cs.id_
         <include refid="queryCondition"/>
         <include refid="queryCondition"/>
     </select>
     </select>
 
 
     <select id="countClassTime" resultType="java.lang.Integer">
     <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>
     
     
     <select id="findByTeacherAttendanceInfo" resultMap="TeacherAttendance">
     <select id="findByTeacherAttendanceInfo" resultMap="TeacherAttendance">
@@ -301,10 +302,10 @@
 
 
     <select id="queryNoSignOutListByOverMinutes" resultMap="Mapper">
     <select id="queryNoSignOutListByOverMinutes" resultMap="Mapper">
         SELECT ta.teacher_id_ key_,u.real_name_ value_,cs.id_ course_schedule_id_
         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')) &lt; 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_ = 0 AND DATE(cs.class_date_) = DATE(now())
+        AND SUBTIME(cs.end_class_time_, CONCAT(#{minutes},'00')) &lt; CURRENT_TIME()
     </select>
     </select>
     <select id="findTeacherIdByCourseSchedule" resultMap="TeacherAttendance">
     <select id="findTeacherIdByCourseSchedule" resultMap="TeacherAttendance">
         SELECT
         SELECT
@@ -345,16 +346,16 @@
     </select>
     </select>
 
 
     <update id="updateViPSignOutStatus" parameterType="string">
     <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>
     <update id="cleanCourseTeacherSignInfo">
     <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>
     </update>
 
 
     <delete id="deleteByMusicGroupId" parameterType="map" >
     <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>
 	</delete>
 </mapper>
 </mapper>