|
@@ -384,15 +384,22 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
|
|
|
addStudentIds = allStudentIds.stream().filter(id -> !repeatStudentIds.contains(id)).collect(Collectors.toSet());
|
|
|
removeStudentIds = oldNormalStudentIds.stream().filter(id -> !repeatStudentIds.contains(id)).collect(Collectors.toSet());
|
|
|
|
|
|
+ List<ClassGroupStudentMapper> needUpdateClassGroupStudents = new ArrayList<>();
|
|
|
+
|
|
|
for (ClassGroupStudentMapper classGroupStudent : classGroupStudents) {
|
|
|
- if(addStudentIds.contains(classGroupStudent.getUserId())){
|
|
|
+ if(addStudentIds.contains(classGroupStudent.getUserId())&&!classGroupStudent.getStatus().equals(ClassGroupStudentStatusEnum.NORMAL)){
|
|
|
classGroupStudent.setStatus(ClassGroupStudentStatusEnum.NORMAL);
|
|
|
- }else if(removeStudentIds.contains(classGroupStudent.getUserId())){
|
|
|
+ }else if(removeStudentIds.contains(classGroupStudent.getUserId())&&!classGroupStudent.getStatus().equals(ClassGroupStudentStatusEnum.QUIT)){
|
|
|
classGroupStudent.setStatus(ClassGroupStudentStatusEnum.QUIT);
|
|
|
+ }else{
|
|
|
+ continue;
|
|
|
}
|
|
|
+ needUpdateClassGroupStudents.add(classGroupStudent);
|
|
|
}
|
|
|
|
|
|
- classGroupStudentMapperDao.batchUpdate(classGroupStudents);
|
|
|
+ if(!CollectionUtils.isEmpty(needUpdateClassGroupStudents)){
|
|
|
+ classGroupStudentMapperDao.batchUpdate(needUpdateClassGroupStudents);
|
|
|
+ }
|
|
|
|
|
|
Date now = new Date();
|
|
|
List<ClassGroupStudentMapper> classGroupStudentMappers = new ArrayList<>();
|