// 学生换班,管理员修改名称,删除该家长的缓存信息 private void deleteRedis(List<MFamilyRelation> frList) { List<String> keyList = new ArrayList<>(); for (MFamilyRelation fr : frList) { keyList.add(MessageFormat.format(CacheConstants.KEY_KID_OF_PARENT, fr.getUserId())); keyList.add(MessageFormat.format(CacheConstants.KEY_FAMILY_RELATION, fr.getUserId())); keyList.add(MessageFormat.format(CacheConstants.KEY_KID_NAME_OF_PARENT, fr.getUserId())); } if (CollectionUtils.isNotEmpty(keyList)) { cacheService.delete(keyList); } }
/** 修改学生信息 */ @Override public StudentManagerDTO updateStudentInfo(String userId, String realName, String classId) { String schoolId = userService.getSchoolId(userId); // 更换用户名称 usersMapper.updateUserName(userId, realName, schoolId); // 更换班级 MClass mClass = classMapper.selectByPrimaryKey(classId, schoolId); studentMapper.updateStudentMessage(userId, mClass); // 修改家庭关系表中用户名称 familyRelationService.updateName(userId, realName); MStudentManager studentManager = studentMapper.selectStudentByUserId(userId, schoolId); StudentManagerDTO studentManagerDTO = new StudentManagerDTO(); BeanUtils.copyProperties(studentManager, studentManagerDTO); studentManagerDTO.setClassAliasName( getGrade(mClass.getYears()) + studentManagerDTO.getClassAliasName()); // 修改孩子名称,班级信息,删除缓存数据 deleteRedisOfParent(userId, schoolId); cacheService.delete(MessageFormat.format(CacheConstants.KEY_USER, userId)); return studentManagerDTO; }