|
@@ -199,7 +199,10 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
|
|
|
throw new BizException("开课2个小时之前才可以请假");
|
|
|
}
|
|
|
|
|
|
- StudentAttendance studentAttendance = new StudentAttendance();
|
|
|
+ StudentAttendance studentAttendance = studentAttendanceDao.findByStatusAndCourseScheduleId(userId,courseScheduleId.intValue());
|
|
|
+ if(Objects.isNull(studentAttendance)){
|
|
|
+ studentAttendance=new StudentAttendance();
|
|
|
+ }
|
|
|
studentAttendance.setClassGroupId(courseSchedule.getClassGroupId());
|
|
|
studentAttendance.setCourseScheduleId(courseScheduleId);
|
|
|
studentAttendance.setCreateTime(date);
|
|
@@ -207,8 +210,12 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
|
|
|
studentAttendance.setRemark(remark);
|
|
|
studentAttendance.setStatus(StudentAttendanceStatusEnum.LEAVE);
|
|
|
studentAttendance.setUserId(userId);
|
|
|
-
|
|
|
- studentAttendanceDao.insert(studentAttendance);
|
|
|
+
|
|
|
+ if(Objects.nonNull(studentAttendance.getId())){
|
|
|
+ studentAttendanceDao.update(studentAttendance);
|
|
|
+ }else{
|
|
|
+ studentAttendanceDao.insert(studentAttendance);
|
|
|
+ }
|
|
|
|
|
|
ClassGroupStudentMapper classGroupStudentMapper = classGroupStudentMapperDao.query(courseSchedule.getClassGroupId(), userId);
|
|
|
if(Objects.isNull(classGroupStudentMapper)){
|