Przeglądaj źródła

删除单技班,适合所有班级类型

周箭河 5 lat temu
rodzic
commit
10d56bc2c0

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

@@ -695,11 +695,19 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void delSingle(Integer classGroupId) {
+        ClassGroup classGroup = classGroupDao.get(classGroupId);
+
         //删除学员班级关联关系
         classGroupStudentMapperDao.deleteByClassId(classGroupId);
         studentRegistrationDao.deleteClassGroup(classGroupId);
+
         //删除班级跟合奏班关系
-        classGroupRelationDao.deleteBySubClassId(classGroupId);
+        if (classGroup.getType().equals(ClassGroupTypeEnum.MIX)) { //合奏班
+            classGroupRelationDao.deleteByClassId(classGroupId);
+        } else {
+            classGroupRelationDao.deleteBySubClassId(classGroupId);
+        }
+
         //删除班级未开始课程
         List<CourseSchedule> courseScheduleList = courseScheduleService.findNoStartCoursesByClassGroupId(classGroupId);
         if (courseScheduleList.size() > 0) {
@@ -987,7 +995,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         String subjectIds = subjectList.stream().map(subject -> subject.getId().toString()).collect(Collectors.joining(","));
         String subjectNames = subjectList.stream().map(subject -> subject.getName()).collect(Collectors.joining("/"));
 
-        if(classGroup4MixDto.getType() == null){
+        if (classGroup4MixDto.getType() == null) {
             classGroup4MixDto.setType(ClassGroupTypeEnum.NORMAL);
         }
         //1、新建班级