|
@@ -1071,14 +1071,22 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
|
|
|
throw new BizException("报名失败,请重试");
|
|
|
}
|
|
|
//2、插入关联关系
|
|
|
- ClassGroupStudentMapper classGroupStudentMapper = new ClassGroupStudentMapper();
|
|
|
- classGroupStudentMapper.setMusicGroupId(classGroup.getMusicGroupId());
|
|
|
- classGroupStudentMapper.setClassGroupId(classGroup.getId());
|
|
|
- classGroupStudentMapper.setUserId(userId);
|
|
|
- classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
|
|
|
- classGroupStudentMapper.setGroupType(groupType);
|
|
|
- classGroupStudentMapper.setCreateTime(date);
|
|
|
- classGroupStudentMapperDao.insert(classGroupStudentMapper);
|
|
|
+ ClassGroupStudentMapper classGroupStudent = classGroupStudentMapperDao.findClassGroupStudent(classGroup.getId(), userId);
|
|
|
+ if(Objects.nonNull(classGroupStudent)){
|
|
|
+ classGroupStudent.setStatus(ClassGroupStudentStatusEnum.NORMAL);
|
|
|
+ classGroupStudent.setUpdateTime(date);
|
|
|
+ classGroupStudentMapperDao.update(classGroupStudent);
|
|
|
+ }else{
|
|
|
+ classGroupStudent = new ClassGroupStudentMapper();
|
|
|
+ classGroupStudent.setMusicGroupId(classGroup.getMusicGroupId());
|
|
|
+ classGroupStudent.setClassGroupId(classGroup.getId());
|
|
|
+ classGroupStudent.setUserId(userId);
|
|
|
+ classGroupStudent.setStatus(ClassGroupStudentStatusEnum.NORMAL);
|
|
|
+ classGroupStudent.setGroupType(groupType);
|
|
|
+ classGroupStudent.setCreateTime(date);
|
|
|
+ classGroupStudentMapperDao.insert(classGroupStudent);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
//3、学生加入级未开始课程
|
|
|
List<CourseSchedule> courseScheduleList = courseScheduleService.findNoStartCoursesByClassGroupId(classGroup.getId());
|