zouxuan 4 years ago
parent
commit
fb9d844a4b

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/TeacherAttendanceDao.java

@@ -230,4 +230,11 @@ public interface TeacherAttendanceDao extends BaseDAO<Long, TeacherAttendance> {
 	 * @return
 	 */
 	int countTeacherAttendanceComplaints(Map<String, Object> params);
+
+	/**
+	 * 删除老师考勤
+	 * @param courseScheduleIds
+	 * @param teacherId
+	 */
+	void deleteByCourseAndTeacherId(@Param("courseScheduleIds") Set<Long> courseScheduleIds, @Param("teacherId") Integer teacherId);
 }

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -4260,6 +4260,9 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 			//修改关联班级老师
 			List<Integer> collect = courseSchedules.stream().map(e -> e.getClassGroupId()).collect(Collectors.toList());
 			batchUpdateClassTeacher(collect,teacherId,targetTeacherId);
+			//修改老师考勤
+			Set<Long> collect1 = courseSchedules.stream().map(e -> e.getId()).collect(Collectors.toSet());
+			teacherAttendanceDao.deleteByCourseAndTeacherId(collect1,teacherId);
 		}
 		List<CourseSchedule> courseSchedules1 = this.queryNoStartCourseByTeacherId(classGroupIds, teacherId, "TEACHING");
 		if(courseSchedules1.size() > 0){
@@ -4269,6 +4272,8 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 				e.setTeachingTeacherIdList(teachingTeacherIdList);
 			});
 			this.courseAdjust(courseSchedules1);
+			Set<Long> collect1 = courseSchedules1.stream().map(e -> e.getId()).collect(Collectors.toSet());
+			teacherAttendanceDao.deleteByCourseAndTeacherId(collect1,teacherId);
 		}
 	}
 

+ 2 - 2
mec-biz/src/main/resources/config/mybatis/ClassGroupMapper.xml

@@ -268,7 +268,7 @@
         LEFT JOIN music_group mg ON cgtm.music_group_id_ = mg.id_
         LEFT JOIN class_group cg ON cg.id_ = cgtm.class_group_id_
         LEFT JOIN teacher t ON t.id_ = cgtm.user_id_
-        LEFT JOIN course_schedule cs ON (FIND_IN_SET(cs.class_group_id_,cg.id_) AND CONCAT(cs.class_date_,' ',cs.start_class_time_) > NOW())
+        LEFT JOIN course_schedule cs ON (FIND_IN_SET(cs.class_group_id_,cg.id_) AND CONCAT(cs.class_date_,' ',cs.start_class_time_) > NOW() AND cs.actual_teacher_id_ = #{search})
         WHERE cgtm.user_id_ = #{search} AND cg.del_flag_ = 0 AND cg.group_type_ = 'MUSIC'
         <if test="status != null">
             AND mg.status_ = #{status}
@@ -625,7 +625,7 @@
         vg.id_,cg.id_
     </select>
     <select id="countGroupCourses" resultType="java.lang.Integer">
-        SELECT COUNT(DISTINCT mg.id_)
+        SELECT COUNT(DISTINCT cgtm.id_)
         FROM class_group_teacher_mapper cgtm
         LEFT JOIN music_group mg ON cgtm.music_group_id_ = mg.id_
         LEFT JOIN class_group cg ON cg.id_ = cgtm.class_group_id_

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

@@ -3107,7 +3107,28 @@
         cssp.user_id_
     </select>
     <select id="queryNoStartCourseByTeacherId" resultMap="CourseSchedule">
-        SELECT cs.* FROM course_schedule cs
+        SELECT cs.id_,
+               cs.music_group_id_,
+               cs.group_type_,
+               cs.class_group_id_,
+               cs.status_,
+               cs.subsidy_,
+               cs.class_date_,
+               CONCAT(cs.class_date_, ' ', cs.start_class_time_) start_class_time_,
+               CONCAT(cs.class_date_, ' ', cs.end_class_time_)   end_class_time_,
+               cs.teacher_id_,
+               cs.actual_teacher_id_,
+               cs.create_time_,
+               cs.update_time_,
+               cs.teach_mode_,
+               cs.type_,
+               cs.name_,
+               cs.student_num_,
+               cs.leave_student_num_,
+               cs.teaching_content_,
+               cs.note_,
+               cs.schoole_id_,
+               cs.organ_id_ FROM course_schedule cs
         LEFT JOIN course_schedule_teacher_salary csts ON csts.course_schedule_id_ = cs.id_
         WHERE FIND_IN_SET(cs.class_group_id_,#{classGroupIds}) AND csts.teacher_role_ = #{teacherRole}
         AND csts.user_id_ = #{teacherId} AND CONCAT(cs.class_date_,' ',cs.start_class_time_) > NOW() AND cs.del_flag_ = 0

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

@@ -72,6 +72,9 @@
             <if test="memo!=null">
                 memo_=#{memo},
             </if>
+            <if test="userId != null">
+                user_id_ = #{userId},
+            </if>
             <if test="name!=null">
                 name_=#{name},
             </if>
@@ -185,7 +188,7 @@
         FROM
         practice_group pg
         LEFT JOIN sys_user su ON pg.user_id_ = su.id_
-        LEFT JOIN course_schedule cs ON (FIND_IN_SET(cs.music_group_id_,pg.id_) AND CONCAT(cs.class_date_,' ',cs.start_class_time_) > NOW() AND cs.group_type_ = 'PRACTICE')
+        LEFT JOIN course_schedule cs ON (FIND_IN_SET(cs.music_group_id_,pg.id_) AND CONCAT(cs.class_date_,' ',cs.start_class_time_) > NOW() AND cs.group_type_ = 'PRACTICE' AND cs.actual_teacher_id_ = #{teacherId})
         <include refid="practiceGroupQueryCondition"/>
         GROUP BY pg.id_ ORDER BY pg.id_ DESC
         <include refid="global.limit"/>

+ 6 - 0
mec-biz/src/main/resources/config/mybatis/TeacherAttendanceMapper.xml

@@ -582,4 +582,10 @@
     <delete id="deleteByGroup">
         DELETE FROM teacher_attendance WHERE music_group_id_=#{groupId} AND group_type_=#{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
     </delete>
+    <delete id="deleteByCourseAndTeacherId">
+        DELETE FROM teacher_attendance WHERE teacher_id_ = #{teacherId} AND course_schedule_id_ IN
+        <foreach collection="courseScheduleIds" item="courseScheduleId" open="(" close=")" separator=",">
+            #{courseScheduleId}
+        </foreach>
+    </delete>
 </mapper>

+ 1 - 1
mec-gateway/mec-gateway-web/pom.xml

@@ -55,7 +55,7 @@
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-starter-security</artifactId>
 		</dependency>
-	</dependencies>
+    </dependencies>
 
 	<build>
 		<plugins>