|
|
@@ -408,6 +408,17 @@ public class CourseServiceImpl implements CourseService {
|
|
|
if (code == 0) {
|
|
|
throw MyException.create(HttpStatus.INTERNAL_SERVER_ERROR, "退课失败");
|
|
|
}
|
|
|
+ ClassStudent classStudent = classStudentMapper.findClassStudentByStudentAndCourse(studentId, courseId);
|
|
|
+ if (classStudent != null) {
|
|
|
+ int csDeleted = classStudentMapper.deleteById(classStudent.getId());
|
|
|
+ if (csDeleted > 0) {
|
|
|
+ classMapper.decreaseStuNumber(classStudent.getClassId(), 1);
|
|
|
+ } else {
|
|
|
+ log.warn("退课时删除班级学生记录失败: studentId={}, courseId={}", studentId, courseId);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ log.warn("退课时未找到学生在班级中的记录: studentId={}, courseId={}", studentId, courseId);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|