Prechádzať zdrojové kódy

course_schedule 添加逻辑删除

zouxuan 3 týždňov pred
rodič
commit
3a95adf702

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

@@ -29,6 +29,7 @@
             left join sys_user su on cs.actual_teacher_id_ = su.id_
         </if>
         <where>
+            cs.del_flag_ = '0'
             <if test="param.patrolFlag != null and param.patrolFlag">
                 and t.id_ is not null
             </if>
@@ -92,7 +93,7 @@
             left join music_group mg on mg.id_ = cs.music_group_id_
             left join course_patrol_evaluation cpe on cpe.course_schedule_id_ = cs.id_
         <where>
-            cs.teach_mode_ = 'OFFLINE'
+            cs.teach_mode_ = 'OFFLINE' AND cs.del_flag_ = '0'
             <if test="param.startTime != null">
                 and cs.class_date_ &gt;= date_format(#{param.startTime},'%Y-%m-%d')
             </if>

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

@@ -362,6 +362,7 @@
         WHERE cs.id_ >= 1
           AND vg.id_ >= 1
           AND cs.is_lock_ = 0
+          AND cs.del_flag_ = '0'
           AND s.operating_tag_ = 0
           and cssp.tenant_id_ = #{tenantId}
         GROUP BY vg.organ_id_
@@ -378,6 +379,7 @@
           AND pg.buy_months_ >= 1
           AND cs.id_ >= 1
           AND cs.is_lock_ = 0
+          AND cs.del_flag_ = '0'
           AND s.operating_tag_ = 0
           and pg.tenant_id_ = #{tenantId}
         GROUP BY pg.organ_id_

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

@@ -280,7 +280,7 @@
         <include refid="global.limit"/>
     </select>
     <select id="countTeacherDemoGroups" resultType="Integer">
-		SELECT COUNT(DISTINCT cs.class_date_) FROM course_schedule cs WHERE cs.type_ = 'DEMO' AND cs.actual_teacher_id_ = #{teacherId}
+		SELECT COUNT(DISTINCT cs.class_date_) FROM course_schedule cs WHERE cs.type_ = 'DEMO' AND cs.actual_teacher_id_ = #{teacherId} AND cs.del_flag_ = '0'
 	</select>
 
     <select id="findDemoGroupStartClassTimesWithWeekByTeacherId"

+ 1 - 0
mec-biz/src/main/resources/config/mybatis/MusicGroupMapper.xml

@@ -748,6 +748,7 @@
                      LEFT JOIN music_group mg ON mg.id_ = cs.music_group_id_
         WHERE cs.actual_teacher_id_ = #{teacherId}
           AND cs.group_type_ = 'MUSIC' AND cs.pre_course_flag_ != 1
+        AND cs.del_flag_ = '0'
         GROUP BY mg.id_
     </select>
     <select id="queryUserMusicInfos" resultMap="queryUserMusicGroupsMap">

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

@@ -458,7 +458,7 @@
             #{classGroupId}
         </foreach>
         <![CDATA[AND class_date_ >= #{startDate,jdbcType=DATE} AND class_date_ <=#{endDate,jdbcType=DATE} ]]>
-        AND (del_flag_ =0 OR del_flag_ IS NULL)
+        AND del_flag_ = '0'
         GROUP BY class_group_id_
     </select>
 
@@ -640,6 +640,7 @@
             WHERE
                 cssp.user_id_ = #{studentId}
                 AND cs.actual_teacher_id_ = t.id_
+                AND cs.del_flag_ = '0'
 		        AND pg.type_='TRIAL'
                 AND cssp.group_type_ = 'PRACTICE')
     </select>
@@ -647,7 +648,9 @@
     <select id="findLastPracticeSubject" resultType="int">
         SELECT pg.subject_id_ FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_
         LEFT JOIN practice_group pg ON cssp.music_group_id_=pg.id_
-        WHERE cssp.group_type_='PRACTICE' AND cssp.user_id_=#{studentId} ORDER BY CONCAT(cs.class_date_, ' ', cs.start_class_time_) DESC LIMIT 1
+        WHERE cssp.group_type_='PRACTICE' AND cssp.user_id_=#{studentId}
+        AND cs.del_flag_ = '0'
+        ORDER BY CONCAT(cs.class_date_, ' ', cs.start_class_time_) DESC LIMIT 1
     </select>
 
     <select id="findStudentTrialPractices" resultMap="PracticeGroupDto">
@@ -665,7 +668,7 @@
         WHERE
             pg.student_id_ = #{studentId}
             AND cs.group_type_ = 'PRACTICE'
-            AND pg.type_ = 'TRIAL'
+            AND pg.type_ = 'TRIAL' AND cs.del_flag_ = '0'
         GROUP BY pg.id_
         ORDER BY pg.id_
     </select>
@@ -678,7 +681,7 @@
         WHERE
             pg.student_id_ = #{studentId}
             AND cs.group_type_ = 'PRACTICE'
-            AND pg.type_ = 'TRIAL'
+            AND pg.type_ = 'TRIAL' AND cs.del_flag_ = '0'
     </select>
     <select id="findStudentAndTeacherTrialPractices" resultMap="com.ym.mec.biz.dal.dao.CourseScheduleDao.CourseSchedule">
         SELECT

+ 6 - 4
mec-biz/src/main/resources/config/mybatis/StudentAttendanceMapper.xml

@@ -621,7 +621,7 @@
     </select>
     <sql id="exportStudentAttendancesQueryPageSql">
         <where>
-                cs.pre_course_flag_ != 1 and cs.tenant_id_ = #{tenantId}
+                cs.pre_course_flag_ != 1 and cs.tenant_id_ = #{tenantId} AND cs.del_flag_ = '0'
             <if test="organId != null and organId != ''">
                 AND FIND_IN_SET(cs.organ_id_,#{organId})
             </if>
@@ -674,7 +674,8 @@
     <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' AND cs.pre_course_flag_ != 1
+        WHERE DATE_FORMAT(cs.class_date_,'%Y-%m') = #{month} AND sa.user_id_ = #{userId}
+        AND sa.status_ = 'LEAVE' AND cs.pre_course_flag_ != 1 AND cs.del_flag_ = '0'
         <if test="attendanceId != null">
             AND sa.id_ != #{attendanceId}
         </if>
@@ -682,7 +683,8 @@
     <select id="queryLeaveNum" resultType="java.util.Map">
         SELECT sa.user_id_ 'key',COUNT(sa.id_) 'value' FROM student_attendance sa
         LEFT JOIN course_schedule cs ON cs.id_ = sa.course_schedule_id_
-        WHERE sa.status_ = 'LEAVE' AND DATE_FORMAT(cs.class_date_,'%Y-%m') = #{month} AND cs.pre_course_flag_ != 1
+        WHERE sa.status_ = 'LEAVE' AND DATE_FORMAT(cs.class_date_,'%Y-%m') = #{month}
+        AND cs.pre_course_flag_ != 1 AND cs.del_flag_ = '0'
         AND sa.user_id_ IN
         <foreach collection="userIds" item="userId" separator="," open="(" close=")">
             #{userId}
@@ -719,7 +721,7 @@
         left join course_schedule_student_payment cssp on cs.id_ = cssp.course_schedule_id_
         left join  student_attendance sa on sa.course_schedule_id_ = cs.id_ and sa.user_id_ = cssp.user_id_
         <where>
-            and cs.status_ = 'OVER'
+            and cs.status_ = 'OVER' AND cs.del_flag_ = '0'
             <if test="param.musicGroupId != null">
                 and cs.music_group_id_ = #{param.musicGroupId}
             </if>

+ 8 - 5
mec-biz/src/main/resources/config/mybatis/StudentStatisticsMapper.xml

@@ -568,7 +568,7 @@
 		from student_statistics ss
 		left join (select cssp.user_id_,COUNT(distinct cssp.course_schedule_id_) course_num_ from course_schedule cs
 		left join course_schedule_student_payment cssp ON cssp.course_schedule_id_ = cs.id_
-		where DATE_FORMAT(cs.class_date_,'%Y-%m') = #{queryInfo.month} AND cs.type_ = 'VIP'
+		where DATE_FORMAT(cs.class_date_,'%Y-%m') = #{queryInfo.month} AND cs.type_ = 'VIP' AND cs.del_flag_ = '0'
 		<include refid="com.ym.mec.biz.dal.dao.CourseScheduleDao.courseIgnore"/>
 		group by cssp.user_id_) cs ON cs.user_id_ = ss.user_id_
 		left join sys_user su ON su.id_ = ss.user_id_
@@ -589,7 +589,8 @@
 		from student_statistics ss
 		left join (select cssp.user_id_,COUNT(distinct cssp.course_schedule_id_) course_num_ from course_schedule cs
 		left join course_schedule_student_payment cssp ON cssp.course_schedule_id_ = cs.id_
-		where DATE_FORMAT(cs.class_date_,'%Y-%m-%d') BETWEEN #{queryInfo.startDate} AND #{queryInfo.endDate} AND cs.type_ = 'VIP'
+		where DATE_FORMAT(cs.class_date_,'%Y-%m-%d') BETWEEN #{queryInfo.startDate} AND #{queryInfo.endDate}
+		AND cs.type_ = 'VIP' AND cs.del_flag_ = '0'
 		<include refid="com.ym.mec.biz.dal.dao.CourseScheduleDao.courseIgnore"/>
 		group by cssp.user_id_) cs ON cs.user_id_ = ss.user_id_
 		left join sys_user su ON su.id_ = ss.user_id_
@@ -616,7 +617,8 @@
 		from student_statistics ss
 		left join (select COUNT(cssp.id_) course_sum_,cssp.user_id_,COUNT(distinct cssp.course_schedule_id_) course_num_ from course_schedule cs
 		left join course_schedule_student_payment cssp ON cssp.course_schedule_id_ = cs.id_
-		where DATE_FORMAT(cs.class_date_,'%Y-%m-%d') BETWEEN #{queryInfo.startDate} AND #{queryInfo.endDate} AND cs.status_ = 'OVER' AND cs.type_ = 'VIP'
+		where DATE_FORMAT(cs.class_date_,'%Y-%m-%d') BETWEEN #{queryInfo.startDate} AND #{queryInfo.endDate}
+		AND cs.status_ = 'OVER' AND cs.type_ = 'VIP' AND cs.del_flag_ = '0'
 		<include refid="com.ym.mec.biz.dal.dao.CourseScheduleDao.courseIgnore"/>
 		group by cssp.user_id_) cs ON cs.user_id_ = ss.user_id_
 		left join sys_user su ON su.id_ = ss.user_id_
@@ -643,7 +645,7 @@
 		from student_statistics ss
 		left join (select cssp.user_id_,COUNT(distinct cssp.course_schedule_id_) consumerNum from course_schedule cs
 		left join course_schedule_student_payment cssp ON cssp.course_schedule_id_ = cs.id_
-		where DATE_FORMAT(cs.class_date_,'%Y-%m') = #{month} AND cs.type_ = 'VIP'
+		where DATE_FORMAT(cs.class_date_,'%Y-%m') = #{month} AND cs.type_ = 'VIP' AND cs.del_flag_ = '0'
 		<include refid="com.ym.mec.biz.dal.dao.CourseScheduleDao.courseIgnore"/>
 		group by cssp.user_id_) cs ON cs.user_id_ = ss.user_id_
 		left join sys_user su ON su.id_ = ss.user_id_
@@ -681,7 +683,8 @@
 		left join (
 		select cssp.user_id_,COUNT(distinct cssp.course_schedule_id_) course_num_ from course_schedule cs
 		left join course_schedule_student_payment cssp ON cssp.course_schedule_id_ = cs.id_
-		where DATE_FORMAT(cs.class_date_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate} AND cs.type_ = 'VIP'
+		where DATE_FORMAT(cs.class_date_,'%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
+		AND cs.type_ = 'VIP' AND cs.del_flag_ = '0'
 		<include refid="com.ym.mec.biz.dal.dao.CourseScheduleDao.courseIgnore"/>
 		group by cssp.user_id_) cs ON ss.user_id_ = cs.user_id_
 		left join sys_user su ON su.id_ = ss.user_id_

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

@@ -201,7 +201,7 @@
         SELECT s.id_ user_id_,s.username_,s.avatar_ head_url_,s.gender_,s.phone_ FROM course_schedule cs
         LEFT JOIN course_schedule_student_payment cssp ON cssp.course_schedule_id_ = cs.id_
         LEFT JOIN sys_user s ON s.id_ = cssp.user_id_
-        WHERE cs.actual_teacher_id_ = #{teacherId}
+        WHERE cs.actual_teacher_id_ = #{teacherId} AND cs.del_flag_ = '0'
         <if test="student != null and student != ''">
             AND (s.phone_ LIKE CONCAT('%',#{student},'%') OR s.username_ LIKE CONCAT('%',#{student},'%'))
         </if>
@@ -213,7 +213,7 @@
         SELECT COUNT(DISTINCT s.id_) FROM course_schedule cs
         LEFT JOIN course_schedule_student_payment cssp ON cssp.course_schedule_id_ = cs.id_
         LEFT JOIN sys_user s ON s.id_ = cssp.user_id_
-        WHERE cs.actual_teacher_id_ = #{teacherId}
+        WHERE cs.actual_teacher_id_ = #{teacherId} AND cs.del_flag_ = '0'
         <if test="student != null and student != ''">
             AND (s.phone_ LIKE CONCAT('%',#{student},'%') OR s.username_ LIKE CONCAT('%',#{student},'%'))
         </if>