zouxuan 5 years ago
parent
commit
31f629e2fd

+ 5 - 3
mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -1467,13 +1467,15 @@
     </delete>
     
     <select id="queryUnsignedStudentList" resultMap="StudentAttendance">
-        SELECT a.*,cg.current_class_times_ FROM (SELECT cgsm.user_id_,cs.actual_teacher_id_ teacher_id_,
+        SELECT a.*,cg.current_class_times_,sa.id_ FROM (SELECT cgsm.user_id_,cs.actual_teacher_id_ teacher_id_,
         cs.id_ course_schedule_id_,cs.class_group_id_,cs.music_group_id_,cs.group_type_
         FROM class_group_student_mapper cgsm
         right JOIN course_schedule cs ON cgsm.class_group_id_ = cs.class_group_id_
         WHERE cgsm.status_ = 'NORMAL' AND CONCAT(cs.class_date_,' ',cs.end_class_time_) &lt;= now()) a
-        LEFT JOIN student_attendance sa ON a.course_schedule_id_ = sa.course_schedule_id_
-        LEFT JOIN class_group cg ON a.class_group_id_ = cg.id_ WHERE sa.id_ IS NULL
+        LEFT JOIN class_group cg ON a.class_group_id_ = cg.id_
+        LEFT JOIN student_attendance sa ON sa.user_id_ = a.user_id_ AND a.teacher_id_ = sa.teacher_id_
+        AND sa.class_group_id_ = a.class_group_id_ AND sa.course_schedule_id_ = a.course_schedule_id_
+        WHERE sa.id_ IS NULL
     </select>
     <select id="getNextCourseSchedule" resultMap="CourseSchedule">
         SELECT

+ 32 - 32
mec-biz/src/main/resources/config/mybatis/TeacherMapper.xml

@@ -209,6 +209,7 @@
         t.job_nature_,t.is_probation_period_,GROUP_CONCAT(s.name_) subject_name_,su.del_flag_
         FROM teacher t LEFT JOIN sys_user su ON t.id_ = su.id_
         LEFT JOIN `subject` s ON FIND_IN_SET(s.id_,t.subject_id_)
+        WHERE su.del_flag_ = 0
         <include refid="queryPageMap"/>
         GROUP BY t.id_
         ORDER BY t.update_time_ DESC
@@ -218,30 +219,29 @@
     <select id="queryCount" resultType="int">
         SELECT COUNT(DISTINCT t.id_)
         FROM teacher t LEFT JOIN sys_user su ON t.id_ = su.id_
+        WHERE su.del_flag_ = 0
         <include refid="queryPageMap"/>
     </select>
 
     <sql id="queryPageMap">
-        <where>
-            <if test="lockFlag != null">
-                AND su.lock_flag_ = #{lockFlag}
-            </if>
-            <if test="subjectId != null">
-                AND FIND_IN_SET(#{subjectId},t.subject_id_)
-            </if>
-            <if test="organId != null">
-                AND FIND_IN_SET(su.organ_id_,#{organId})
-            </if>
-            <if test="search != null">
-                AND (su.real_name_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%'))
-            </if>
-            <if test="jobNature != null">
-                AND t.job_nature_ = #{jobNature}
-            </if>
-            <if test="isProbationPeriod != null">
-                AND t.is_probation_period_ = #{isProbationPeriod}
-            </if>
-        </where>
+        <if test="lockFlag != null">
+            AND su.lock_flag_ = #{lockFlag}
+        </if>
+        <if test="subjectId != null">
+            AND FIND_IN_SET(#{subjectId},t.subject_id_)
+        </if>
+        <if test="organId != null">
+            AND FIND_IN_SET(su.organ_id_,#{organId})
+        </if>
+        <if test="search != null">
+            AND (su.real_name_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%'))
+        </if>
+        <if test="jobNature != null">
+            AND t.job_nature_ = #{jobNature}
+        </if>
+        <if test="isProbationPeriod != null">
+            AND t.is_probation_period_ = #{isProbationPeriod}
+        </if>
     </sql>
 
     <!-- 根据证件号查询老师 -->
@@ -346,6 +346,7 @@
         LEFT JOIN class_group_teacher_mapper cgtm ON t.id_ = cgtm.user_id_
         LEFT JOIN class_group cg ON cg.id_ = cgtm.class_group_id_
         LEFT JOIN sys_user su ON t.id_ = su.id_
+        WHERE cg.del_flag_ != '1'
         <include refid="queryMusicGroupTeachersSql"/>
         GROUP BY t.id_
         <include refid="global.limit"/>
@@ -356,21 +357,20 @@
         LEFT JOIN class_group_teacher_mapper cgtm ON t.id_ = cgtm.user_id_
         LEFT JOIN class_group cg ON cg.id_ = cgtm.class_group_id_
         LEFT JOIN sys_user su ON t.id_ = su.id_
+        WHERE cg.del_flag_ != '1'
         <include refid="queryMusicGroupTeachersSql"/>
     </select>
     <sql id="queryMusicGroupTeachersSql">
-        <where>
-            <if test="search != null and search != ''">
-                AND (su.real_name_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%') OR
-                su.id_=#{search})
-            </if>
-            <if test="musicGroupId != null and musicGroupId != ''">
-                AND cgtm.music_group_id_ = #{musicGroupId}
-            </if>
-            <if test="classGroupId != null">
-                AND cg.id_ = #{classGroupId}
-            </if>
-        </where>
+        <if test="search != null and search != ''">
+            AND (su.real_name_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%') OR
+            su.id_=#{search})
+        </if>
+        <if test="musicGroupId != null and musicGroupId != ''">
+            AND cgtm.music_group_id_ = #{musicGroupId}
+        </if>
+        <if test="classGroupId != null">
+            AND cg.id_ = #{classGroupId}
+        </if>
     </sql>
 
     <select id="findSignNum" resultType="java.util.Map">