Explorar el Código

course_schedule 添加逻辑删除

zouxuan hace 3 semanas
padre
commit
9d1e1ad6b1

+ 0 - 12
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java

@@ -71,12 +71,8 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
 
     int batchDeleteByCourseSchedules(@Param("courseScheduleIds") List<Long> courseScheduleIds);
 
-    int batchDelete(@Param("courseScheduleIds") List<Long> courseScheduleIds);
-
     int batchDeleteCourseSchedulesWithLogic(@Param("courseScheduleIds") List<Long> courseScheduleIds);
 
-    int batchDeleteAllCourseSchedules(@Param("courseScheduleIds") List<Long> courseScheduleIds);
-
     /**
      * @param courseScheduleIds: 课程计划编号
      * @return java.util.List<java.lang.Long>
@@ -867,14 +863,6 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
 
 
     /**
-     * 根据班级编号列表删除课程
-     *
-     * @param classGroupIds 班级编号列表
-     * @return
-     */
-    int deleteCourseSchedulesByClassGroupIds(@Param("courseScheduleIds") List<Long> courseScheduleIds);
-
-    /**
      * @param currentCourseDate: 班级编号
      * @return java.lang.Integer
      * @describe 统计已上的课时数

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

@@ -568,7 +568,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                     courseScheduleTeacherSalaryDao.batchDeleteByCourseScheduleIds(courseScheduleIds);
                     teacherAttendanceDao.batchDeleteByCourseSchedules(courseScheduleIds);
                     // 删除基础提高班课程
-                    courseScheduleDao.deleteCourseSchedulesByClassGroupIds(courseScheduleIds);
+                    courseScheduleDao.batchDeleteByCourseSchedules(courseScheduleIds);
                 }
 
                 List<ImGroupModel> imGroupModelList = new ArrayList<>();
@@ -2919,7 +2919,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                 //删除课程以及关联的学员老师
                 courseScheduleStudentPaymentDao.deleteByCourseSchedule(courseScheduleIds);
                 courseScheduleTeacherSalaryDao.batchDeleteByCourseScheduleIds(courseScheduleIds);
-                courseScheduleDao.deleteCourseSchedulesByClassGroupIds(courseScheduleIds);
+                courseScheduleDao.batchDeleteByCourseSchedules(courseScheduleIds);
             }
             //取消所有预排课
             musicGroupSchoolTermStudentCourseDetailDao.deleteByDetailId(musicGroupSchoolTermCourseDetailId, null);
@@ -2960,7 +2960,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             //删除课程以及关联的学员老师
             courseScheduleStudentPaymentDao.deleteByCourseSchedule(courseScheduleIds);
             courseScheduleTeacherSalaryDao.batchDeleteByCourseScheduleIds(courseScheduleIds);
-            courseScheduleDao.deleteCourseSchedulesByClassGroupIds(courseScheduleIds);
+            courseScheduleDao.batchDeleteByCourseSchedules(courseScheduleIds);
         }
     }
 
@@ -4447,7 +4447,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             List<Long> delCourseIds = courseScheduleDao.findNoStudentCourseIds(courseIds);
             if (delCourseIds != null && delCourseIds.size() > 0) {
                 //删除课程
-                courseScheduleDao.deleteCourseSchedulesByClassGroupIds(delCourseIds);
+                courseScheduleDao.batchDeleteByCourseSchedules(delCourseIds);
                 //删除教师考勤
                 teacherAttendanceDao.batchDeleteByCourseSchedules(delCourseIds);
                 //删除教师课酬
@@ -4954,7 +4954,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             List<Long> delCourseIds = courseScheduleDao.findNoStudentCourseIds(courseIds);
             if (delCourseIds != null && delCourseIds.size() > 0) {
                 //删除课程
-                courseScheduleDao.deleteCourseSchedulesByClassGroupIds(delCourseIds);
+                courseScheduleDao.batchDeleteByCourseSchedules(delCourseIds);
                 //删除教师考勤
                 teacherAttendanceDao.batchDeleteByCourseSchedules(delCourseIds);
                 //删除教师课酬

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseConvertLogServiceImpl.java

@@ -81,7 +81,7 @@ public class CourseConvertLogServiceImpl extends BaseServiceImpl<Integer, Course
 		courseConvertLog.setOldClassName(classGroup.getName());
 		courseConvertLog.setOldCourseJson(JSONObject.toJSONString(courseSchedules));
 		//删除课程
-		courseScheduleDao.batchDelete(oldCourseIdList);
+		courseScheduleDao.batchDeleteByCourseSchedules(oldCourseIdList);
 
 		//记录老师考勤
 		List<TeacherAttendance> teacherAttendances = teacherAttendanceDao.findByCourseSchedules(oldCourseIdList);

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleConvertServiceImpl.java

@@ -191,7 +191,7 @@ public class CourseScheduleConvertServiceImpl implements CourseScheduleConvertSe
 
     private void delByCourse(List<Long> newCourseIdList){
         //删除转换后的课程、课酬、学员课程价值
-        courseScheduleService.getDao().batchDelete(newCourseIdList);
+        courseScheduleService.getDao().batchDeleteByCourseSchedules(newCourseIdList);
         //删除老师考勤
         teacherAttendanceService.getDao().batchDeleteByCourseSchedules(newCourseIdList);
         //删除老师课酬

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

@@ -350,7 +350,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 				}
 			}
 		}
-		courseScheduleDao.batchDeleteAllCourseSchedules(courseScheduleIds);
+		courseScheduleDao.batchDeleteByCourseSchedules(courseScheduleIds);
 		courseScheduleTeacherSalaryDao.batchDeleteByCourseScheduleIds(courseScheduleIds);
 		courseScheduleStudentPaymentDao.deleteByCourseSchedule(courseScheduleIds);
 		// 删除考勤
@@ -376,7 +376,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		}
 		List<Long> courseScheduleIds = courseScheduleList.stream().map(CourseSchedule::getId).collect(Collectors.toList());
 
-		courseScheduleDao.batchDelete(courseScheduleIds);
+		courseScheduleDao.batchDeleteByCourseSchedules(courseScheduleIds);
 		courseScheduleTeacherSalaryDao.batchDeleteByCourseScheduleIds(courseScheduleIds);
 		courseScheduleStudentPaymentDao.deleteByCourseSchedule(courseScheduleIds);
 		// 删除考勤
@@ -973,7 +973,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		oldCourseScheduleTeacherSalaries = oldCourseScheduleTeacherSalaries.stream().filter(c->TeachTypeEnum.BISHOP.equals(c.getTeacherRole())).collect(Collectors.toList());
 		oldCourseScheduleTeacherSalaries.forEach(o->o.setCourseSchedule(idCourseMap.get(o.getCourseScheduleId())));
 
-		courseScheduleDao.batchDeleteAllCourseSchedules(courseScheduleIds);
+		courseScheduleDao.batchDeleteByCourseSchedules(courseScheduleIds);
 		courseScheduleTeacherSalaryDao.batchDeleteByCourseScheduleIds(courseScheduleIds);
 		courseScheduleStudentPaymentDao.deleteByCourseSchedule(courseScheduleIds);
 		// 删除考勤

+ 126 - 142
mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -386,25 +386,22 @@
     </update>
 
     <!-- 根据主键删除一条记录 -->
-    <delete id="delete">
-        DELETE
-        FROM course_schedule
-        WHERE id_ = #{id}
-    </delete>
+    <update id="delete">
+        update course_schedule set del_flag_    = '1',del_time_ = NOW() WHERE id_ = #{id}
+    </update>
 
-    <delete id="deleteCourseSchedulesByMusicGroupID" parameterType="map">
-        DELETE
-        FROM course_schedule
+    <update id="deleteCourseSchedulesByMusicGroupID" parameterType="map">
+        update course_schedule set del_flag_    = '1',del_time_ = NOW()
         WHERE music_group_id_ = #{musicGroupId}
         <if test="groupType != null and groupType != ''">
           AND group_type_ = #{groupType}
         </if>
           and status_ = 'NOT_START'
-    </delete>
+    </update>
 
     <update id="logicDeleteCourseSchedulesByMusicGroupID">
         update course_schedule
-        set del_flag_    = '1'
+        set del_flag_    = '1',del_time_ = NOW()
         WHERE music_group_id_ = #{musicGroupID}
           AND group_type_ = 'MUSIC'
           and status_ = 'NOT_START'
@@ -412,32 +409,24 @@
 
     <update id="resumeCourseScheduleByMusicGroupId">
         update course_schedule
-        set del_flag_    = '0'
+        set del_flag_    = '0',del_time_ = null
         WHERE music_group_id_ = #{musicGroupID}
           AND group_type_ = 'MUSIC'
           and status_ = 'NOT_START'
           and del_flag_ = '1'
     </update>
 
-    <delete id="batchDeleteCourseSchedules">
-        DELETE FROM course_schedule
+    <update id="batchDeleteCourseSchedules">
+        update course_schedule set del_flag_    = '1',del_time_ = NOW()
         WHERE
         CONCAT( class_date_, ' ', start_class_time_ ) &gt; NOW()
         AND id_ IN
         <foreach collection="courseScheduleIds" item="courseScheduleId" open="(" close=")" separator=",">
             #{courseScheduleId}
         </foreach>
-    </delete>
+    </update>
     <delete id="batchDeleteByCourseSchedules">
-        UPDATE course_schedule SET del_flag_ = '1',update_time_ = NOW()
-        WHERE id_ IN
-        <foreach collection="courseScheduleIds" item="courseScheduleId" open="(" close=")" separator=",">
-            #{courseScheduleId}
-        </foreach>
-    </delete>
-
-    <delete id="batchDelete">
-        DELETE FROM course_schedule
+        UPDATE course_schedule SET del_flag_ = '1',del_time_ = NOW()
         WHERE id_ IN
         <foreach collection="courseScheduleIds" item="courseScheduleId" open="(" close=")" separator=",">
             #{courseScheduleId}
@@ -455,18 +444,10 @@
             </foreach>
     </update>
 
-    <delete id="batchDeleteAllCourseSchedules">
-        DELETE FROM course_schedule
-        WHERE id_ IN
-        <foreach collection="courseScheduleIds" item="courseScheduleId" open="(" close=")" separator=",">
-            #{courseScheduleId}
-        </foreach>
-    </delete>
-
     <select id="filterNotStartCourseIdsWithIds" resultType="long">
         SELECT id_ FROM course_schedule
         WHERE
-        CONCAT( class_date_, ' ', start_class_time_ ) &gt; NOW()
+        CONCAT( class_date_, ' ', start_class_time_ ) &gt; NOW() AND del_flag_ = '0'
         AND id_ IN
         <foreach collection="courseScheduleIds" item="courseScheduleId" open="(" close=")" separator=",">
             #{courseScheduleId}
@@ -475,14 +456,14 @@
 
     <!-- 分页查询 -->
     <select id="queryPage" resultMap="CourseSchedule" parameterType="map">
-        SELECT * FROM course_schedule where tenant_id_ = #{tenantId} ORDER BY id_
+        SELECT * FROM course_schedule where tenant_id_ = #{tenantId} AND del_flag_ = '0' ORDER BY id_
         <include refid="global.limit"/>
     </select>
 
     <!-- 查询当前表的总记录数 -->
     <select id="queryCount" resultType="int">
         SELECT COUNT(*)
-        FROM course_schedule where tenant_id_ = #{tenantId}
+        FROM course_schedule where tenant_id_ = #{tenantId} AND del_flag_ = '0'
     </select>
 
     <resultMap type="com.ym.mec.biz.dal.dto.TeacherAttendanceDto" id="TeacherAttendanceViewUtilEntity">
@@ -570,7 +551,7 @@
                  LEFT JOIN school s ON mg.school_id_ = s.id_
                  LEFT JOIN sys_user su ON cs.actual_teacher_id_ = su.id_
                  LEFT JOIN teacher_attendance ta ON cs.id_ = ta.course_schedule_id_
-        WHERE cs.actual_teacher_id_ = #{teacherId}
+        WHERE cs.actual_teacher_id_ = #{teacherId} AND cs.del_flag_ = '0'
           AND (CONCAT(cs.class_date_, ' ', cs.end_class_time_) BETWEEN #{startTime} AND #{endTime})
           AND cs.schoole_id_ = #{schoolId}
           AND ta.sign_in_time_ IS NOT NULL AND cs.pre_course_flag_ != 1
@@ -944,7 +925,7 @@
                  LEFT JOIN class_group cg ON cs.class_group_id_ = cg.id_
         WHERE cs.class_date_ BETWEEN #{firstDayOfMonth} AND #{lastDayOfMonth}
           AND cg.music_group_id_ = #{musicGroupID}
-          AND cg.group_type_ = 'MUSIC' AND cs.pre_course_flag_ = 0
+          AND cg.group_type_ = 'MUSIC' AND cs.pre_course_flag_ = 0 AND cs.del_flag_ = '0'
         GROUP BY cs.class_date_
     </select>
 
@@ -952,7 +933,7 @@
             resultType="int">
         SELECT COUNT(*)
         FROM course_schedule cs
-        WHERE cs.teacher_id_ = #{teacherId}
+        WHERE cs.teacher_id_ = #{teacherId} AND cs.del_flag_ = '0'
           AND cs.class_date_ = DATE_FORMAT(#{classDate}, '%Y-%m-%d')
           AND (
                     CONCAT(cs.class_date_, ' ', cs.start_class_time_) &lt;
@@ -977,7 +958,7 @@
         FROM
         course_schedule cs
         WHERE
-        cs.teacher_id_ = #{teacherId}
+        cs.teacher_id_ = #{teacherId} AND cs.del_flag_ = '0'
         AND cs.class_date_ IN
         <foreach collection="dates" item="date" open="(" close=")" separator=",">
             #{date}
@@ -989,7 +970,7 @@
         FROM
         course_schedule cs
         WHERE
-        cs.tenant_id_ = #{tenantId}
+        cs.tenant_id_ = #{tenantId} AND cs.del_flag_ = '0'
         and cs.class_date_ IN
         <foreach collection="dates" item="date" open="(" close=")" separator=",">
             DATE_FORMAT(#{date},'%Y-%m-%d')
@@ -1019,7 +1000,7 @@
         FROM
         course_schedule cs
         LEFT JOIN course_schedule_teacher_salary csts ON cs.id_ = csts.course_schedule_id_
-        WHERE cs.tenant_id_ = #{tenantId} and
+        WHERE cs.tenant_id_ = #{tenantId} AND cs.del_flag_ = '0' and
         cs.class_date_ IN
         <foreach collection="dates" item="date" open="(" close=")" separator=",">
             DATE_FORMAT(#{date},'%Y-%m-%d')
@@ -1045,7 +1026,7 @@
     <!-- 获取班级未开始的课程 -->
     <select id="findClassGroupNoStartCourseSchedules" resultMap="CourseSchedule">
         SELECT * FROM course_schedule
-        WHERE status_ = 'NOT_START' AND pre_course_flag_ = 0
+        WHERE status_ = 'NOT_START' AND pre_course_flag_ = 0 AND del_flag_ = '0'
         AND class_group_id_ IN
         <foreach collection="classGroupIds" item="classGroupId" index="index" open="(" close=")" separator=",">
             #{classGroupId}
@@ -1296,7 +1277,7 @@
         LEFT JOIN course_schedule cs ON cs.id_ = cssp.course_schedule_id_
         LEFT JOIN school s ON s.id_ = cs.schoole_id_
         LEFT JOIN sys_user su ON cs.actual_teacher_id_ = su.id_
-        WHERE cs.is_lock_ = 0
+        WHERE cs.is_lock_ = 0 AND cs.del_flag_ = '0'
         AND cs.status_ = 'NOT_START'
         AND cssp.user_id_ = #{userId}
         AND cs.class_date_ = DATE_FORMAT(#{date}, '%Y%m%d')
@@ -1313,7 +1294,7 @@
     <select id="countClassTimes" resultType="int">
         SELECT COUNT(*)
         FROM course_schedule
-        WHERE class_group_id_ = #{classGroupId}
+        WHERE class_group_id_ = #{classGroupId} AND del_flag_ = '0'
           AND CONCAT(class_date_, ' ', end_class_time_) &lt;= #{startClassTime} AND pre_course_flag_ = 0
     </select>
     <select id="getCourseSchedules" resultMap="courseScheduleDto">
@@ -1349,7 +1330,7 @@
     <select id="findVipGroupNotStartCourseScheduleIds" resultType="long">
         SELECT cs.id_
         FROM course_schedule cs
-        WHERE cs.music_group_id_ = #{groupId}
+        WHERE cs.music_group_id_ = #{groupId} AND cs.del_flag_ = '0'
           AND cs.group_type_ = #{groupType}
           AND CONCAT(cs.class_date_, ' ', cs.start_class_time_) &gt; NOW()
     </select>
@@ -1371,7 +1352,7 @@
         teach_mode_
         FROM
         course_schedule
-        where tenant_id_ = #{tenantId}
+        where tenant_id_ = #{tenantId} AND del_flag_ = '0'
         <if test="classGroupId!=null">
             AND class_group_id_ = #{classGroupId}
         </if>
@@ -1394,14 +1375,14 @@
         select *
         from course_schedule
         where CONCAT(class_date_, ' ', end_class_time_) &lt;= now()
-          and status_ != 'OVER'
+          and status_ != 'OVER' AND del_flag_ = '0'
     </select>
 
     <select id="queryUnderwayWithNoUpdateStatus" resultMap="CourseSchedule">
         select *
         from course_schedule
         where CONCAT(class_date_, ' ', start_class_time_) &lt;= now()
-          and status_ = 'NOT_START'
+          and status_ = 'NOT_START' AND del_flag_ = '0'
     </select>
 
     <update id="batchUpdate" parameterType="java.util.List">
@@ -1539,7 +1520,7 @@
         SELECT cs.*
         FROM course_schedule cs
                  left join teacher_attendance ta on ta.course_schedule_id_ = cs.id_
-        WHERE ta.sign_in_time_ is null
+        WHERE ta.sign_in_time_ is null AND cs.del_flag_ = '0'
           and SUBTIME(start_class_time_, CONCAT(#{minutes}, '00')) &lt; CURRENT_TIME()
     </select>
 
@@ -1650,7 +1631,7 @@
     <sql id="teacherGroupCourseQueryCondition">
         <where>
             cs.actual_teacher_id_ = #{teacherId} AND cs.pre_course_flag_ != 1
-            AND cs.music_group_id_ = #{groupId}
+            AND cs.music_group_id_ = #{groupId} AND cs.del_flag_ = '0'
             AND cs.group_type_ = #{groupType}
         </where>
     </sql>
@@ -1804,7 +1785,7 @@
         SELECT *
         FROM course_schedule
         WHERE class_group_id_ = #{classGroupId}
-          AND class_date_ >= #{startDate}
+          AND class_date_ >= #{startDate} AND del_flag_ = '0'
         ORDER BY class_date_ ASC
         LIMIT #{times}
     </select>
@@ -2000,7 +1981,7 @@
         select cssp.user_id_ key_, count(1) value_
         from course_schedule cs
                  right join course_schedule_student_payment cssp on cs.id_ = cssp.course_schedule_id_
-        where class_date_ = date(DATE_ADD(now(), INTERVAL 1 DAY)) AND cs.pre_course_flag_ != 1
+        where class_date_ = date(DATE_ADD(now(), INTERVAL 1 DAY)) AND cs.pre_course_flag_ != 1 AND cs.del_flag_ = '0'
         group by cssp.user_id_
     </select>
 
@@ -2009,7 +1990,7 @@
         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' AND cs.pre_course_flag_ != 1
+          and cs.status_ = 'NOT_START' AND cs.pre_course_flag_ != 1 AND cs.del_flag_ = '0'
     </select>
 
     <select id="queryTeacherCoursesTimesOfTomorrow" resultMap="Mapper">
@@ -2017,7 +1998,7 @@
         from course_schedule cs
                  right join course_schedule_teacher_salary cssp on cs.id_ = cssp.course_schedule_id_
                  left join sys_user u on u.id_ = cssp.user_id_
-        where cs.merge_flag_ IN (0,1) AND class_date_ = date(DATE_ADD(now(), INTERVAL 1 DAY)) AND cs.pre_course_flag_ != 1
+        where cs.merge_flag_ IN (0,1) AND cs.class_date_ = date(DATE_ADD(now(), INTERVAL 1 DAY)) AND cs.pre_course_flag_ != 1 AND cs.del_flag_ = '0'
         group by cssp.user_id_
     </select>
 
@@ -2109,7 +2090,7 @@
                cs.schoole_id_
         from course_schedule cs
                  LEFT JOIN course_schedule_teacher_salary csts ON cs.id_ = csts.course_schedule_id_
-        where cs.class_group_id_ = #{classGroupId}
+        where cs.class_group_id_ = #{classGroupId} AND cs.del_flag_ = '0'
     </select>
     <select id="findByClassGroupAndStatus" resultMap="CourseSchedule">
         select cs.id_,
@@ -2137,7 +2118,7 @@
         from course_schedule cs
                  LEFT JOIN course_schedule_teacher_salary csts ON cs.id_ = csts.course_schedule_id_
         where cs.class_group_id_ = #{classGroupId} AND cs.pre_course_flag_ != 1
-          AND cs.status_ = #{status}
+          AND cs.status_ = #{status} AND cs.del_flag_ = '0'
     </select>
     <select id="findByClassGroups" resultMap="CourseSchedule">
         select
@@ -2168,7 +2149,7 @@
         <foreach collection="classGroupIds" item="classGroupId" open="(" close=")" separator=",">
             #{classGroupId}
         </foreach>
-        AND cs.pre_course_flag_ != 1
+        AND cs.pre_course_flag_ != 1 AND cs.del_flag_ = '0'
         ORDER BY start_class_time_
     </select>
     <select id="findStudentMap" resultType="java.util.Map">
@@ -2181,7 +2162,7 @@
     <select id="findOneCourseScheduleByClassGroupId" resultMap="CourseSchedule">
         SELECT *
         FROM course_schedule
-        WHERE class_group_id_ = #{classGroupId}  AND pre_course_flag_ = 0
+        WHERE class_group_id_ = #{classGroupId}  AND pre_course_flag_ = 0 AND del_flag_ = '0'
         LIMIT 1
     </select>
     <select id="countClassGroupCourseTimes" resultType="map">
@@ -2206,21 +2187,21 @@
         SELECT COUNT(1)
         FROM course_schedule
         WHERE class_group_id_ = #{classGroupId}
-          AND (del_flag_ != 1 OR del_flag_ IS NULL) AND pre_course_flag_ = 0
+        AND del_flag_ = '0' AND pre_course_flag_ = 0
     </select>
     <select id="findMusicGroupCourseSchedules" resultMap="CourseSchedule">
         SELECT cs.*
         FROM course_schedule cs
                  LEFT JOIN class_group cg ON cs.class_group_id_ = cg.id_
         WHERE cg.music_group_id_ = #{musicGroupId}
-          AND cs.group_type_ = #{groupType}
+          AND cs.group_type_ = #{groupType} AND cs.del_flag_ = '0'
           AND status_ = #{status} AND cs.pre_course_flag_ != 1
     </select>
     <select id="findMusicGroupAllCourseSchedules" resultMap="CourseSchedule">
         SELECT cs.*
         FROM course_schedule cs
                  LEFT JOIN class_group cg ON cs.class_group_id_ = cg.id_
-        WHERE cg.music_group_id_ = #{musicGroupId}
+        WHERE cg.music_group_id_ = #{musicGroupId} AND cs.del_flag_ = '0'
           AND cs.group_type_ = #{groupType} AND cs.pre_course_flag_ != 1
     </select>
     <select id="findMusicGroupCourseSchedulesWithStudent" resultMap="CourseSchedule">
@@ -2259,28 +2240,21 @@
     </delete>
 
     <select id="getClassGroupNotStartCourse" resultMap="CourseSchedule">
-        SELECT * FROM course_schedule WHERE class_group_id_=#{classGroupId} AND CONCAT(class_date_,' ', start_class_time_) &gt; NOW()
+        SELECT * FROM course_schedule WHERE class_group_id_=#{classGroupId} AND CONCAT(class_date_,' ', start_class_time_) &gt; NOW() AND del_flag_ = '0'
     </select>
 
     <select id="getClassGroupCourses" resultMap="CourseSchedule">
-        SELECT * FROM course_schedule WHERE class_group_id_=#{classGroupId}
+        SELECT * FROM course_schedule WHERE class_group_id_=#{classGroupId} AND del_flag_ = '0'
     </select>
 
-    <delete id="deleteCourseSchedulesByClassGroupIds">
-        DELETE FROM course_schedule WHERE id_ IN
-        <foreach collection="courseScheduleIds" item="courseScheduleId" open="(" close=")" separator=",">
-            #{courseScheduleId}
-        </foreach>
-    </delete>
-    <delete id="deleteByGroup">
-        DELETE
-        FROM course_schedule
+    <update id="deleteByGroup">
+        update course_schedule SET del_flag_ = '1',del_time_ = NOW()
         WHERE music_group_id_ = #{groupId}
           AND group_type_ = #{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
-    </delete>
-    <delete id="deletePreCourse">
-        DELETE FROM course_schedule WHERE music_group_id_ = #{musicGroupId} AND group_type_ = 'MUSIC' AND pre_course_flag_ = 1
-    </delete>
+    </update>
+    <update id="deletePreCourse">
+        update course_schedule SET del_flag_ = '1',del_time_ = NOW() WHERE music_group_id_ = #{musicGroupId} AND group_type_ = 'MUSIC' AND pre_course_flag_ = 1
+    </update>
 
     <select id="countCurrentTimes" resultType="int">
         SELECT COUNT(*)
@@ -2329,7 +2303,7 @@
         SELECT count(cs.id_)
         FROM course_schedule cs
         WHERE cs.music_group_id_ = #{vipGroupId}
-          AND cs.group_type_ = #{groupType}
+          AND cs.group_type_ = #{groupType} AND cs.del_flag_ = '0'
     </select>
     <select id="findCourseNoStartNum" resultType="java.lang.Integer">
         SELECT COUNT(cs.id_)
@@ -2337,7 +2311,7 @@
         WHERE cs.music_group_id_ = #{vipGroupId}
           AND cs.group_type_ = 'VIP'
           AND cs.status_ = 'NOT_START'
-          AND cs.del_flag_ != '1'
+          AND cs.del_flag_ = '0'
     </select>
     <select id="findCourseEndNum" resultType="java.lang.Integer">
         SELECT COUNT(cs.id_)
@@ -2349,7 +2323,7 @@
     </select>
     <select id="countCourseNum" resultType="java.lang.Integer">
         SELECT COUNT(cs.id_) FROM course_schedule cs
-        WHERE cs.music_group_id_ = #{vipGroupId} AND cs.group_type_ = 'VIP' AND cs.del_flag_ != '1'
+        WHERE cs.music_group_id_ = #{vipGroupId} AND cs.group_type_ = 'VIP' AND cs.del_flag_ = '0'
         <if test="teachMode != null">
             AND cs.teach_mode_ = #{teachMode}
         </if>
@@ -2544,13 +2518,13 @@
     <select id="getMinCourseTime" resultType="java.util.Date">
         SELECT MIN(CONCAT(class_date_, ' ', start_class_time_))
         FROM course_schedule
-        WHERE group_type_ = #{groupType}
+        WHERE group_type_ = #{groupType} AND del_flag_ = '0'
           AND music_group_id_ = #{groupId} AND pre_course_flag_ = 0
     </select>
     <select id="getMaxCourseTime" resultType="java.util.Date">
         SELECT MAX(CONCAT(class_date_, ' ', end_class_time_))
         FROM course_schedule
-        WHERE group_type_ = #{groupType}
+        WHERE group_type_ = #{groupType} AND del_flag_ = '0'
           AND music_group_id_ = #{groupId} AND pre_course_flag_ = 0
     </select>
     <select id="findSurplusCourseWithGroup" resultMap="CourseSchedule">
@@ -2572,7 +2546,7 @@
     <select id="countClassGroupOverCourseNum" resultType="int">
         SELECT COUNT(*)
         FROM course_schedule
-        WHERE class_group_id_ = #{classGroupId}
+        WHERE class_group_id_ = #{classGroupId} AND del_flag_ = '0'
           AND CONCAT(class_date_, ' ', end_class_time_) &lt; NOW() AND pre_course_flag_ = 0
     </select>
 
@@ -2687,7 +2661,7 @@
         SELECT MIN(CONCAT(class_date_, ' ', start_class_time_))
         FROM course_schedule
         WHERE group_type_ = #{groupType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
-          AND music_group_id_ = #{groupId}
+          AND music_group_id_ = #{groupId} AND del_flag_ = '0'
     </select>
 
     <select id="findGroupCourseEndTime" resultType="java.util.Date">
@@ -2700,7 +2674,7 @@
         SELECT COUNT(*)
         FROM course_schedule
         WHERE group_type_ = #{groupType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
-          AND music_group_id_ = #{groupId}
+          AND music_group_id_ = #{groupId} AND del_flag_ = '0'
     </select>
     <sql id="queryVipCourseScheduleIds">
         <if test="mergeCourseType != null and mergeCourseType != ''">
@@ -2886,7 +2860,7 @@
         WHERE cs.group_type_ = 'PRACTICE'
           AND cssp.user_id_ = #{userId}
           AND cssp.expect_price_ = 0
-          AND pg.type_ = 'FREE'
+          AND pg.type_ = 'FREE' AND cs.del_flag_ = '0'
     </select>
     <select id="findTeacherCoursesWithIncludeDateRange" resultMap="CourseSchedule" useCache="false" flushCache="true">
         SELECT cs.id_,
@@ -2960,7 +2934,7 @@
         LEFT JOIN student_attendance sa ON cs.id_ = sa.course_schedule_id_
         WHERE TIMESTAMPDIFF(MINUTE, #{endDateTime}, CONCAT(cs.class_date_, ' ', cs.start_class_time_)) >= 0
           AND TIMESTAMPDIFF(MINUTE, #{endDateTime}, CONCAT(cs.class_date_, ' ', cs.start_class_time_)) &lt;= #{continueCourseTime}
-          AND cs.teacher_id_ = #{courseSchedule.teacherId}
+          AND cs.teacher_id_ = #{courseSchedule.teacherId} AND cs.del_flag_ = '0'
           AND cs.class_group_id_ = #{courseSchedule.classGroupId}
           AND (NOW() > CONCAT(cs.class_date_,' ', cs.start_class_time_) OR sa.sign_in_time_ IS NOT NULL) AND cs.pre_course_flag_ != 1
         LIMIT 1
@@ -2971,7 +2945,7 @@
         LEFT JOIN teacher_attendance ta ON cs.id_ = ta.course_schedule_id_
         WHERE TIMESTAMPDIFF(MINUTE, #{endDateTime}, CONCAT(cs.class_date_, ' ', cs.start_class_time_)) >= 0
           AND TIMESTAMPDIFF(MINUTE, #{endDateTime}, CONCAT(cs.class_date_, ' ', cs.start_class_time_)) &lt;= #{continueCourseTime}
-          AND cs.teacher_id_ = #{courseSchedule.teacherId}
+          AND cs.teacher_id_ = #{courseSchedule.teacherId} AND cs.del_flag_ = '0'
           AND cs.class_group_id_ = #{courseSchedule.classGroupId}
           AND (NOW() > CONCAT(cs.class_date_,' ', cs.start_class_time_) OR ta.sign_in_time_ IS NOT NULL) AND cs.pre_course_flag_ != 1
         LIMIT 1
@@ -2988,7 +2962,7 @@
         COUNT(cs.Id_) AS 'value'
         FROM
         course_schedule cs
-        WHERE cs.status_='OVER'
+        WHERE cs.status_='OVER' AND cs.del_flag_ = '0'
         AND DATE_FORMAT(cs.class_date_,'%Y-%m')=DATE_FORMAT(NOW(),'%Y-%m')
         AND cs.group_type_ = #{groupType}
         AND cs.music_group_id_ IN
@@ -3003,7 +2977,7 @@
         FROM
             course_schedule cs
         WHERE CONCAT(cs.class_date_, ' ', cs.start_class_time_) &lt; NOW()
-            AND cs.group_type_ = #{groupType}
+            AND cs.group_type_ = #{groupType} AND cs.del_flag_ = '0'
             AND cs.music_group_id_ = #{groupId} AND cs.pre_course_flag_ != 1
     </select>
     <select id="findUserCourses" resultMap="CourseSchedule">
@@ -3200,7 +3174,7 @@
                cs.leave_student_num_,
                cs.schoole_id_
         FROM course_schedule cs
-        WHERE cs.group_type_ = #{groupType}
+        WHERE cs.group_type_ = #{groupType} AND cs.del_flag_ = '0'
           AND cs.music_group_id_ = #{groupId}
         ORDER BY CONCAT(cs.class_date_, ' ', cs.start_class_time_) DESC
         LIMIT 1
@@ -3216,6 +3190,7 @@
         <foreach collection="classGroupIds" item="classGroupId" open="(" close=")" separator=",">
             #{classGroupId}
         </foreach>
+        AND del_flag_ = '0'
         GROUP BY class_group_id_
         )
     </select>
@@ -3241,7 +3216,7 @@
                schoole_id_
         FROM course_schedule
         WHERE group_type_ = #{groupType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
-          AND music_group_id_ = #{groupId}
+          AND music_group_id_ = #{groupId} AND del_flag_ = '0'
           AND CONCAT(class_date_, ' ', start_class_time_) &gt; NOW()
     </select>
 
@@ -3267,7 +3242,7 @@
                schoole_id_
         FROM course_schedule
         WHERE group_type_ = #{groupType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
-          AND music_group_id_ = #{groupId}
+          AND music_group_id_ = #{groupId} AND del_flag_ = '0'
           AND CONCAT(class_date_, ' ', start_class_time_) &gt; NOW()
     </select>
     <select id="getSubjectNameById" resultType="java.lang.String">
@@ -3297,7 +3272,7 @@
         cs.status_
         FROM course_schedule cs
         LEFT JOIN course_schedule_evaluate cse ON cs.id_ = cse.course_schedule_id_
-        WHERE cs.group_type_ = #{groupType} AND cs.pre_course_flag_ != 10 and cs.tenant_id_ = #{tenantId}
+        WHERE cs.group_type_ = #{groupType} AND cs.pre_course_flag_ != 10 and cs.tenant_id_ = #{tenantId} AND cs.del_flag_ = '0'
         <if test="groupId != null">
             AND cs.music_group_id_ = #{groupId}
         </if>
@@ -3310,7 +3285,7 @@
     <select id="getLastEndCourse" resultMap="CourseSchedule">
         SELECT cs.id_
         FROM course_schedule cs
-        WHERE cs.music_group_id_ = #{groupId}
+        WHERE cs.music_group_id_ = #{groupId} AND cs.del_flag_ = '0'
           AND cs.group_type_ = #{groupType}
           AND NOW() > CONCAT(cs.class_date_, ' ', cs.end_class_time_) AND cs.pre_course_flag_ != 1
         ORDER BY cs.class_date_, cs.end_class_time_ ASC
@@ -3341,7 +3316,7 @@
         LEFT JOIN course_schedule cs ON cs.class_group_id_ = cg.id_ AND CONCAT( cs.class_date_, ' ',
         cs.start_class_time_ ) > NOW( )
         WHERE
-        cg.group_type_ = #{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+        cg.group_type_ = #{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler} AND cs.del_flag_ = '0'
         AND cg.music_group_id_ IN
         <foreach collection="groupIds" item="groupId" separator="," open="(" close=")">
             #{groupId}
@@ -3358,7 +3333,7 @@
         FROM
         course_schedule cs
         WHERE
-        cs.group_type_ = #{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+        cs.group_type_ = #{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler} AND cs.del_flag_ = '0'
         AND cs.music_group_id_ IN
         <foreach collection="groupIds" item="groupId" separator="," open="(" close=")">
             #{groupId}
@@ -3390,7 +3365,7 @@
         FROM teacher_attendance ta
                  LEFT JOIN course_schedule cs ON ta.course_schedule_id_ = cs.id_
                  LEFT JOIN student_attendance sa ON ta.course_schedule_id_ = sa.course_schedule_id_
-        WHERE ta.sign_out_status_ = 1
+        WHERE ta.sign_out_status_ = 1 AND cs.del_flag_ = '0'
           AND ta.sign_in_time_ IS NOT NULL
           AND MONTH(ta.sign_in_time_) = #{month}
           AND cs.teach_mode_ = 'ONLINE'
@@ -3506,7 +3481,7 @@
         WHERE cs.class_group_id_ = #{classGroupId}
         AND TIMESTAMPDIFF(MINUTE, CONCAT(cs.class_date_," ",cs.end_class_time_),#{startTime}) &lt;= #{continueCourseTime}
         AND TIMESTAMPDIFF(MINUTE, CONCAT(cs.class_date_," ",cs.end_class_time_),#{startTime}) >= 0
-        AND cs.actual_teacher_id_ = #{teacherId} AND cs.pre_course_flag_ != 1
+        AND cs.actual_teacher_id_ = #{teacherId} AND cs.pre_course_flag_ != 1 AND cs.del_flag_ = '0'
         ORDER BY cs.class_date_ DESC,cs.end_class_time_ DESC
         LIMIT 1
     </select>
@@ -3515,14 +3490,15 @@
         WHERE cs.class_group_id_ = #{classGroupId}
         AND TIMESTAMPDIFF(MINUTE, #{endTime},CONCAT(cs.class_date_," ",cs.start_class_time_)) &lt;= #{continueCourseTime}
         AND TIMESTAMPDIFF(MINUTE, #{endTime},CONCAT(cs.class_date_," ",cs.start_class_time_)) >= 0
-        AND cs.actual_teacher_id_ = #{teacherId} AND cs.pre_course_flag_ != 1
+        AND cs.actual_teacher_id_ = #{teacherId} AND cs.pre_course_flag_ != 1 AND cs.del_flag_ = '0'
         ORDER BY cs.class_date_ DESC,cs.start_class_time_ DESC
         LIMIT 1
     </select>
     <select id="findLastOverTime" resultType="java.util.Map">
         SELECT cs.music_group_id_ 'key',MAX(CONCAT(cs.class_date_,' ',cs.start_class_time_)) 'value'
         FROM course_schedule cs
-        WHERE cs.status_ = 'OVER' AND cs.group_type_ = 'VIP' AND cs.music_group_id_ IN
+        WHERE cs.status_ = 'OVER' AND cs.group_type_ = 'VIP' AND cs.del_flag_ = '0'
+        AND cs.music_group_id_ IN
         <foreach collection="vipGroupIds" open="(" close=")" separator="," item="item">
             #{item}
         </foreach>
@@ -3533,7 +3509,7 @@
         <foreach collection="courseScheduleIds" open="(" close=")" separator="," item="item">
             #{item}
         </foreach>
-        AND cs.status_ = 'NOT_START'
+        AND cs.status_ = 'NOT_START' AND cs.del_flag_ = '0'
     </select>
     <select id="getLastTime" resultType="java.util.Date">
         SELECT MAX(CONCAT(cs.class_date_," ",cs.end_class_time_))
@@ -3558,7 +3534,7 @@
             #{studentId}
         </foreach>
         AND cssp.group_type_ = #{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
-        AND cs.class_date_ BETWEEN #{startTime} AND #{endTime}
+        AND cs.class_date_ BETWEEN #{startTime} AND #{endTime} AND cs.del_flag_ = '0'
         GROUP BY
         cssp.user_id_
     </select>
@@ -3576,7 +3552,7 @@
             #{studentId}
         </foreach>
         AND cssp.group_type_ = 'PRACTICE'
-        AND pg.type_='CHARGE'
+        AND pg.type_='CHARGE' AND cs.del_flag_ = '0'
         AND cs.class_date_ BETWEEN #{startTime} AND #{endTime}
         GROUP BY
         cssp.user_id_
@@ -3594,7 +3570,7 @@
         <foreach collection="studentIds" item="studentId" separator="," open="(" close=")">
             #{studentId}
         </foreach>
-        AND cssp.group_type_ = 'VIP'
+        AND cssp.group_type_ = 'VIP' AND cs.del_flag_ = '0'
         AND CONCAT(cs.class_date_," ",cs.start_class_time_) &gt; NOW()
         GROUP BY
         cssp.user_id_
@@ -3662,7 +3638,7 @@
                 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 csts.user_id_=#{teacherId}
+        WHERE csts.user_id_=#{teacherId} AND cs.del_flag_ = '0'
         AND cs.class_date_ = DATE_FORMAT(#{startClassTime},'%Y-%m-%d')
         AND cs.start_class_time_ &lt; DATE_FORMAT(#{startClassTime},'%H:%i:%S')
         ORDER BY start_class_time_ DESC LIMIT 1;
@@ -3694,7 +3670,7 @@
         FROM course_schedule cs
             LEFT JOIN course_schedule_teacher_salary csts ON csts.course_schedule_id_=cs.id_
             LEFT JOIN teacher_attendance ta ON cs.id_=ta.course_schedule_id_ AND ta.teacher_id_=#{teacherId}
-        WHERE csts.user_id_=#{teacherId}
+        WHERE csts.user_id_=#{teacherId} AND cs.del_flag_ = '0'
         AND cs.class_date_ = DATE_FORMAT(#{startClassTime},'%Y-%m-%d')
         AND cs.start_class_time_ &lt; DATE_FORMAT(#{startClassTime},'%H:%i:%S') AND cs.pre_course_flag_ != 1
         AND ta.sign_in_status_ IS NOT NULL
@@ -3706,12 +3682,13 @@
 		(SELECT cs.type_ course_type_,SUM(TIMESTAMPDIFF(MINUTE,STR_TO_DATE(concat(cs.class_date_,' ',cs.start_class_time_),'%Y-%m-%d %H:%i:%s'),
         STR_TO_DATE(concat(cs.class_date_,' ',cs.end_class_time_),'%Y-%m-%d %H:%i:%s'))) remain_minutes_,COUNT(cs.id_) temp_merged_course_num_
 		FROM course_schedule cs WHERE FIND_IN_SET(cs.class_group_id_,#{classGroupIdList}) AND cs.status_ = 'NOT_START'
-		AND cs.merge_flag_ = 0 AND cs.member_flag_ = #{memberFlag} AND cs.pre_course_flag_ != 1 GROUP BY cs.type_
+		AND cs.merge_flag_ = 0 AND cs.del_flag_ = '0' AND cs.member_flag_ = #{memberFlag} AND cs.pre_course_flag_ != 1 GROUP BY cs.type_
 		UNION ALL
 		SELECT ncs.type_ course_type_,SUM(TIMESTAMPDIFF(MINUTE,STR_TO_DATE(concat(ncs.class_date_,' ',ncs.start_class_time_),'%Y-%m-%d %H:%i:%s'),
         STR_TO_DATE(concat(ncs.class_date_,' ',ncs.end_class_time_),'%Y-%m-%d %H:%i:%s'))) remain_minutes_,COUNT(cs.id_) temp_merged_course_num_
 		FROM course_schedule cs LEFT JOIN course_schedule ncs ON ncs.id_ = cs.new_course_id_
-		WHERE FIND_IN_SET(cs.class_group_id_,#{classGroupIdList}) AND cs.new_course_id_ &gt; 0 AND ncs.status_ = 'NOT_START' AND cs.pre_course_flag_ != 1 AND cs.member_flag_ = #{memberFlag} GROUP BY ncs.type_) a
+		WHERE FIND_IN_SET(cs.class_group_id_,#{classGroupIdList}) AND cs.new_course_id_ &gt; 0 AND cs.del_flag_ = '0'
+		AND ncs.status_ = 'NOT_START' AND cs.pre_course_flag_ != 1 AND cs.member_flag_ = #{memberFlag} GROUP BY ncs.type_) a
 		group BY a.course_type_
     </select>
 
@@ -3745,25 +3722,26 @@
     </select>
 
     <select id="countCourseMergeTime" resultType="int">
-        SELECT COUNT(id_) FROM course_schedule WHERE new_course_id_=#{courseId}
+        SELECT COUNT(id_) FROM course_schedule WHERE new_course_id_=#{courseId} AND del_flag_ = '0'
     </select>
 
     <select id="findByMainMergeCourse" resultMap="CourseSchedule">
         SELECT
         <include refid="resultSql"/>
-        FROM course_schedule cs WHERE new_course_id_=#{mainMergeCourseId}
+        FROM course_schedule cs WHERE new_course_id_=#{mainMergeCourseId} AND cs.del_flag_ = '0'
     </select>
 
     <select id="querySubCourseNumMap" resultType="java.util.Map">
         SELECT cs.type_ 'key',COUNT(CASE WHEN (CONCAT(cs.class_date_,' ',cs.start_class_time_) > NOW()) THEN 1 ELSE NULL END) 'value'
         FROM course_schedule cs
-        WHERE cs.class_group_id_ = #{classGroupId} AND cs.pre_course_flag_ != 1
+        WHERE cs.class_group_id_ = #{classGroupId} AND cs.pre_course_flag_ != 1 AND cs.del_flag_ = '0'
         GROUP BY cs.type_
     </select>
     <select id="querySubCourseTimeMap" resultType="java.util.Map">
         SELECT cs.type_ 'key',SUM(ROUND((UNIX_TIMESTAMP(CONCAT(cs.class_date_,' ',cs.end_class_time_)) - UNIX_TIMESTAMP(CONCAT(cs.class_date_,' ',cs.start_class_time_)))/60)) 'value'
         FROM course_schedule cs
         WHERE cs.class_group_id_ = #{classGroupId} AND CONCAT(cs.class_date_,' ',cs.start_class_time_) > NOW() AND cs.pre_course_flag_ != 1
+         AND cs.del_flag_ = '0'
         GROUP BY cs.type_
     </select>
     <select id="findClassMaxCourseNumMap" resultType="java.util.Map">
@@ -3772,7 +3750,7 @@
         <foreach collection="classGroupIds" open="(" close=")" separator="," item="item">
             #{item}
         </foreach>
-        AND CONCAT(cs.class_date_," ",cs.start_class_time_) > NOW() AND cs.pre_course_flag_ != 1
+        AND CONCAT(cs.class_date_," ",cs.start_class_time_) > NOW() AND cs.pre_course_flag_ != 1 AND cs.del_flag_ = '0'
         GROUP BY cs.class_group_id_,cs.type_)c
         GROUP BY c.type_
     </select>
@@ -3789,7 +3767,7 @@
                 #{item}
             </foreach>
         </if>
-        AND CONCAT(cs.class_date_," ",cs.start_class_time_) > NOW() AND cs.pre_course_flag_ != 1
+        AND CONCAT(cs.class_date_," ",cs.start_class_time_) > NOW() AND cs.pre_course_flag_ != 1 AND cs.del_flag_ = '0'
         GROUP BY cssp.course_schedule_id_
     </select>
     <select id="findNoStudentCourseIds" resultType="Long">
@@ -3799,6 +3777,7 @@
         <foreach collection="courseIds" open="(" close=")" separator="," item="item">
             #{item}
         </foreach>
+        AND cs.del_flag_ = '0'
         GROUP BY cssp.course_schedule_id_,cs.id_  HAVING COUNT(cssp.id_) = 0
     </select>
     <select id="findNoStartMasterCourseNum" resultType="int">
@@ -3808,7 +3787,7 @@
             #{item}
         </foreach>
         AND merge_flag_ IN (1,2) AND pre_course_flag_ = 0
-        AND status_ = 'NOT_START'
+        AND status_ = 'NOT_START' AND del_flag_ = '0'
     </select>
     <select id="getLock" resultMap="CourseSchedule">
         SELECT * FROM course_schedule WHERE id_ = #{courseId}
@@ -3825,7 +3804,7 @@
             <foreach collection="courseIds" item="courseId" open="(" close=")" separator=",">
                 #{courseId}
             </foreach>
-        AND pre_course_flag_ = 0
+        AND pre_course_flag_ = 0 AND del_flag_ = '0'
         GROUP BY
             new_course_id_
     </select>
@@ -3848,7 +3827,7 @@
             LEFT JOIN practice_group vg ON vg.id_ = cs.music_group_id_
         </if>
         WHERE cssp.user_id_ = #{studentId} AND CONCAT(cs.class_date_,' ',cs.start_class_time_) > NOW()
-        AND vg.educational_teacher_id_ = #{teacherId} AND cs.pre_course_flag_ != 1
+        AND vg.educational_teacher_id_ = #{teacherId} AND cs.pre_course_flag_ != 1 AND cs.del_flag_ = '0'
         <include refid="global.limit"/>
     </select>
     <select id="countStudentNoStartCourse" resultType="int">
@@ -3861,10 +3840,10 @@
             LEFT JOIN practice_group vg ON vg.id_ = cs.music_group_id_
         </if>
         WHERE cssp.user_id_ = #{studentId} AND CONCAT(cs.class_date_,' ',cs.start_class_time_) > NOW()
-        AND vg.educational_teacher_id_ = #{teacherId} AND cs.pre_course_flag_ != 1
+        AND vg.educational_teacher_id_ = #{teacherId} AND cs.pre_course_flag_ != 1 AND cs.del_flag_ = '0'
     </select>
     <select id="findCoursesByClassGroupIdAndCourseIds" resultMap="CourseSchedule">
-        SELECT * FROM course_schedule WHERE class_group_id_ = #{classGroupId}
+        SELECT * FROM course_schedule WHERE class_group_id_ = #{classGroupId} AND del_flag_ = '0'
         AND id_ IN
         <foreach collection="allLockCourseIds" item="courseId" open="(" close=")" separator=",">
             #{courseId}
@@ -3874,10 +3853,11 @@
     <select id="queryTotalCourseTimes" resultType="java.lang.Integer">
         SELECT SUM(ROUND((UNIX_TIMESTAMP(CONCAT(cs.class_date_,' ',cs.end_class_time_)) - UNIX_TIMESTAMP(CONCAT(cs.class_date_,' ',cs.start_class_time_)))/60))
         FROM course_schedule cs
-        WHERE cs.class_group_id_ = #{classGroupId} AND CONCAT(cs.class_date_,' ',cs.start_class_time_) > NOW()
+        WHERE cs.class_group_id_ = #{classGroupId} AND CONCAT(cs.class_date_,' ',cs.start_class_time_) > NOW() AND cs.del_flag_ = '0'
     </select>
     <select id="getUnderwayCourseNum" resultType="int">
-        SELECT COUNT(*) FROM course_schedule WHERE music_group_id_ = #{musicGroupId} AND group_type_ = #{groupType} AND status_=#{status} AND pre_course_flag_ = 0
+        SELECT COUNT(*) FROM course_schedule WHERE music_group_id_ = #{musicGroupId}
+        AND group_type_ = #{groupType} AND status_=#{status} AND pre_course_flag_ = 0 AND cs.del_flag_ = '0'
     </select>
 
     <select id="getMusicGroupCourseInfo" resultMap="CourseSchedule"><![CDATA[
@@ -3889,7 +3869,7 @@
             AND cs.start_class_time_ >= DATE_FORMAT(#{startTime},'%H:%i:%S')
             AND cs.end_class_time_ <= DATE_FORMAT(#{endTime},'%H:%i:%S')
             AND cs.group_type_ = 'MUSIC'
-            AND cs.teach_mode_ = 'OFFLINE' AND cs.pre_course_flag_ != 1
+            AND cs.teach_mode_ = 'OFFLINE' AND cs.pre_course_flag_ != 1 AND cs.del_flag_ = '0'
         ORDER BY cs.id_ ASC
     ]]></select>
     <select id="findHasCourseStudent" resultType="java.lang.Integer">
@@ -3900,7 +3880,7 @@
             #{item}
         </foreach>
         AND CONCAT(cs.class_date_,' ',cs.start_class_time_) > NOW()
-        AND FIND_IN_SET(cs.group_type_,#{groupType})
+        AND FIND_IN_SET(cs.group_type_,#{groupType}) AND cs.del_flag_ = '0'
         GROUP BY cssp.user_id_
     </select>
 
@@ -3928,7 +3908,7 @@
     <select id="getMusicGroupHasStartCourseNum" resultType="integer">
         SELECT COUNT(*) FROM course_schedule
         WHERE music_group_id_ = #{musicGroupId}
-        AND group_type_='MUSIC'
+        AND group_type_='MUSIC' AND del_flag_ = '0'
         AND status_ IN ('UNDERWAY','OVER') AND pre_course_flag_ = 0
     </select>
 
@@ -3938,7 +3918,8 @@
         <foreach collection="ids" item="id" open="(" close=")" separator=",">
             #{id}
         </foreach>
-        AND group_type_='MUSIC' AND DATE_FORMAT(NOW(),'%Y-%m-%d') >= class_date_ AND member_flag_ = 1 AND pre_course_flag_ = 0
+        AND group_type_='MUSIC' AND DATE_FORMAT(NOW(),'%Y-%m-%d') >= class_date_
+        AND member_flag_ = 1 AND pre_course_flag_ = 0 AND del_flag_ = '0'
         GROUP BY music_group_id_
     </select>
 
@@ -4017,7 +3998,7 @@
         FROM
         course_schedule cs
         WHERE
-            cs.merge_flag_ = 2
+            cs.merge_flag_ = 2 AND cs.del_flag_ = '0'
             AND cs.new_course_id_ IN
             <foreach collection="courseIds" item="courseId" open="(" close=")" separator=",">
                 #{courseId}
@@ -4025,7 +4006,7 @@
     </select>
     <select id="queryPreCourseListByClassGroupId" resultMap="CourseSchedule">
         SELECT <include refid="resultSql"/> FROM course_schedule cs WHERE class_group_id_ = #{classGroupId}
-        AND is_lock_ = 1 AND pre_course_flag_ = 1
+        AND is_lock_ = 1 AND pre_course_flag_ = 1 AND cs.del_flag_ = '0'
     </select>
 
     <select id="queryPreCourseListByClassGroupIds" resultType="int">
@@ -4034,11 +4015,12 @@
         <foreach collection="classGroupIds" open="(" item="classGroupId" separator="," close=")">
             #{classGroupId}
         </foreach>
-        AND is_lock_ = 1 AND pre_course_flag_ = 1
+        AND is_lock_ = 1 AND pre_course_flag_ = 1 AND cs.del_flag_ = '0'
     </select>
 
     <select id="queryPreCourseListByMusicGroupId" resultMap="CourseSchedule">
-        SELECT * FROM course_schedule WHERE music_group_id_ = #{musicGroupId} AND group_type_ = 'MUSIC' AND is_lock_ = 1 AND pre_course_flag_ = 1
+        SELECT * FROM course_schedule WHERE music_group_id_ = #{musicGroupId}
+        AND group_type_ = 'MUSIC' AND is_lock_ = 1 AND pre_course_flag_ = 1 AND del_flag_ = '0'
     </select>
     <select id="sumCourseMinutes" resultType="int">
         SELECT SUM(c.course_mintues_) FROM (SELECT FLOOR((UNIX_TIMESTAMP(CONCAT(class_date_, ' ', end_class_time_)) -
@@ -4066,12 +4048,12 @@
         <foreach collection="classGroupSet" open="(" close=")" item="classGroupId" separator=",">
             #{classGroupId}
         </foreach>
-        AND group_type_ = 'MUSIC' AND pre_course_flag_ = 1
+        AND group_type_ = 'MUSIC' AND pre_course_flag_ = 1 AND del_flag_ = '0'
         GROUP BY class_group_id_
     </select>
     <select id="queryOverPreCourseListByMusicGroupId" resultType="int">
         SELECT count(id_) FROM course_schedule WHERE music_group_id_ = #{musicGroupId} AND group_type_ = 'MUSIC' AND is_lock_ = 1 AND pre_course_flag_ = 1
-                                        AND CONCAT(class_date_,' ', start_class_time_) &lt;= NOW()
+                                        AND CONCAT(class_date_,' ', start_class_time_) &lt;= NOW() AND del_flag_ = '0'
     </select>
     <select id="queryClassDateList" resultType="java.lang.String">
         SELECT CONCAT(cs.class_date_,' ',cs.start_class_time_,'~',end_class_time_) start_class_time_ FROM course_schedule cs
@@ -4121,7 +4103,7 @@
         FROM course_schedule cs
         LEFT JOIN teacher_attendance ta ON ta.course_schedule_id_ = cs.id_
         LEFT JOIN class_group cg ON cs.class_group_id_ = cg.id_
-        WHERE ta.teacher_id_ = #{teacherId} AND cs.id_ IN
+        WHERE ta.teacher_id_ = #{teacherId} AND cs.del_flag_ = '0' AND cs.id_ IN
         <foreach collection="courseIds" item="courseId" open="(" close=")" separator=",">
             #{courseId}
         </foreach>
@@ -4147,7 +4129,7 @@
         LEFT JOIN course_schedule_student_payment cssp ON s.user_id_ = cssp.user_id_
         LEFT JOIN course_schedule cs ON cs.id_ = cssp.course_schedule_id_ AND cs.group_type_ = #{groupType} AND cs.del_flag_ = '0' AND cs.pre_course_flag_ != 1
         LEFT JOIN sys_user su ON su.id_ = s.user_id_
-        WHERE 1=1 and s.tenant_id_ = #{tenantId}
+        WHERE s.tenant_id_ = #{tenantId}
         <if test="hasMember != null">
             <if test="hasMember == 1">
                 AND s.member_rank_setting_id_ IS NOT NULL
@@ -4257,7 +4239,7 @@
     </select>
     <sql id="countStudyStandardWaitVisitSql">
         WHERE csts.user_id_ = #{teacherId} AND cs.evaluate_flag_ = 1 AND sa.qualified_flag_ = 0
-        AND sv.id_ IS NULL AND sa.status_ IN ('NORMAL','LATE')
+        AND sv.id_ IS NULL AND sa.status_ IN ('NORMAL','LATE') AND cs.del_flag_ = '0'
         <if test="startDate != null and startDate != ''">
             AND cs.class_date_ >= #{startDate}
         </if>
@@ -4313,6 +4295,7 @@
         left join school co ON co.id_ = cs.schoole_id_
         left join student_attendance sa ON sa.course_schedule_id_ = cs.id_ AND sa.user_id_ = cssp.user_id_
         where cssp.music_group_id_ = #{queryInfo.groupId} AND cssp.user_id_ = #{queryInfo.userId} AND cssp.group_type_ = #{queryInfo.groupType}
+        AND cs.del_flag_ = '0'
         <if test="queryInfo.courseStatus != null and queryInfo.courseStatus != ''">
             <if test=" queryInfo.groupType == 'LIVE'">
                 <if test="queryInfo.courseStatus == 'UNDERWAY'">
@@ -4345,7 +4328,7 @@
     </select>
     
     <select id="queryStartedCourseMusicGroupIdList" resultType="java.lang.String">
-		select distinct cs.music_group_id_ from course_schedule cs where cs.group_type_ = #{groupType} and cs.status_ = 'OVER'
+		select distinct cs.music_group_id_ from course_schedule cs where cs.group_type_ = #{groupType} and cs.status_ = 'OVER' AND cs.del_flag_ = '0'
     </select>
 
     <select id="checkCourseIsSettlementReport" resultType="int">
@@ -4378,6 +4361,7 @@
 
     <sql id="selectPage">
         <where>
+            cs.del_flag_ = '0'
             <if test="param.teacherId != null">
                 and ( cs.actual_teacher_id_ = #{param.teacherId})
             </if>
@@ -4454,7 +4438,8 @@
     </select>
 
     <update id="updateTeachingPointByClassGroupId">
-        update course_schedule set teaching_point_ = #{teachingPoint} where class_group_id_ = #{classGroupId} and status_ = 'NOT_START'
+        update course_schedule set teaching_point_ = #{teachingPoint} where class_group_id_ = #{classGroupId}
+        and status_ = 'NOT_START' AND del_flag_ = '0'
     </update>
 
     <select id="getSummaryOfCurrentSemesterCourses"
@@ -4514,8 +4499,7 @@
         select * from course_schedule
         where teacher_id_ = #{teacherId}
         and CONCAT(class_date_," ",end_class_time_) &gt;= #{startTime}
-        and CONCAT(class_date_," ",start_class_time_) &lt;= #{endTime}
-
+        and CONCAT(class_date_," ",start_class_time_) &lt;= #{endTime} AND del_flag_ = '0'
     </select>
 
     <select id="liveCourseRemind" resultMap="CourseSchedule">
@@ -4523,7 +4507,7 @@
         from course_schedule cs
         where cs.status_ = 'NOT_START'
           and cs.type_ = 'LIVE'
-        and cs.live_remind_ = 0
+        and cs.live_remind_ = 0 AND cs.del_flag_ = '0'
           and cs.class_date_ = date_format(now(),'%Y-%m-%d')
           and CONCAT(class_date_,' ',start_class_time_)  &lt;= date_format(date_add(now(),interval #{minutes} minute),'%Y-%m-%d %H:%i:%s')
           and CONCAT(class_date_,' ',start_class_time_)  &gt;= date_format(now(),'%Y-%m-%d %H:%i:%s')
@@ -4540,7 +4524,7 @@
 
     <select id="getCloseLiveCourseRoom" resultMap="CourseSchedule">
         select * from course_schedule
-        where status_ = 'OVER' and type_ = 'LIVE'  and  continuous_course_ = 0
+        where status_ = 'OVER' and type_ = 'LIVE'  and  continuous_course_ = 0 AND del_flag_ = '0'
         <if test="studentRemindTime != null" >
             and CONCAT(class_date_,' ',end_class_time_) &lt;= date_format(date_add(now(),interval -#{studentRemindTime} minute),'%Y-%m-%d %H:%i:%s')
             and live_remind_ = 1
@@ -4570,12 +4554,12 @@
     <select id="getTeacherContinuousCourse" resultMap="CourseSchedule">
         SELECT <include refid="resultSql"/> FROM course_schedule cs
         WHERE cs.class_group_id_ = #{classGroupId}
-        AND cs.actual_teacher_id_ = #{teacherId} AND cs.pre_course_flag_ != 1 AND cs.class_date_ = #{classDate}
+        AND cs.actual_teacher_id_ = #{teacherId} AND cs.pre_course_flag_ != 1 AND cs.class_date_ = #{classDate} AND cs.del_flag_ = '0'
         ORDER BY cs.class_date_ DESC,cs.end_class_time_ DESC
     </select>
 
     <select id="findByRoomUid"  resultMap="CourseSchedule">
-        select * from course_schedule where live_room_id_ = #{roomUid} and group_type_ = #{type.name}
+        select * from course_schedule where live_room_id_ = #{roomUid} and group_type_ = #{type.name} AND del_flag_ = '0'
     </select>
     <select id="exportCourseIncome" resultType="com.ym.mec.biz.dal.dto.ExportCourseIncomeDto">
         select o.name_ organName,cs.id_ courseId,SUM(cssp.actual_price_) amount from course_schedule cs
@@ -4590,7 +4574,7 @@
     <select id="getNotStartOnlineNoLive" resultMap="CourseSchedule">
         select * from course_schedule where status_ = 'NOT_START' and teach_mode_ = 'ONLINE' and group_type_ IN ('COMM','DEMO','MUSIC','PRACTICE','VIP')
         and CONCAT(class_date_,' ',start_class_time_) &lt;= date_format(date_add(now(),interval #{beforeTime} minute),'%Y-%m-%d %H:%i:%s')
-
+        AND del_flag_ = '0'
         and live_remind_ = 0
         and tenant_id_ = #{tenantInfoId}
     </select>
@@ -4598,7 +4582,7 @@
     <select id="getEndTimeBetweenYesterdayAndNow" resultMap="CourseSchedule">
         select * from course_schedule where status_ = 'OVER' and teach_mode_ = 'ONLINE' and group_type_ IN ('COMM','DEMO','MUSIC','PRACTICE','VIP')
         and CONCAT(class_date_,' ',end_class_time_) &gt;= date_format(date_add(now(),interval -1 day),'%Y-%m-%d')
-        and CONCAT(class_date_,' ',end_class_time_) &lt;= date_format(now(),'%Y-%m-%d %H:%i:%s')
+        and CONCAT(class_date_,' ',end_class_time_) &lt;= date_format(now(),'%Y-%m-%d %H:%i:%s') AND del_flag_ = '0'
     </select>
     <select id="queryTeacherCanViewClassCourseSchedule" resultType="java.lang.Long">
         select distinct csts.course_schedule_id_ from class_group_teacher_mapper cgtm