diff --git a/src/main/java/com/teaching/backend/model/entity/umsAdmin/UmsTeacher.java b/src/main/java/com/teaching/backend/model/entity/umsAdmin/UmsTeacher.java index 59d04a8..da48835 100644 --- a/src/main/java/com/teaching/backend/model/entity/umsAdmin/UmsTeacher.java +++ b/src/main/java/com/teaching/backend/model/entity/umsAdmin/UmsTeacher.java @@ -44,7 +44,7 @@ public class UmsTeacher implements Serializable { private String education; //学位 - private String degree; + private String academicDegree; //职称 private String professionalTitle; diff --git a/src/main/java/com/teaching/backend/model/vo/umsAdmin/UmsStudentVO.java b/src/main/java/com/teaching/backend/model/vo/umsAdmin/UmsStudentVO.java index 2667380..ddbcb75 100644 --- a/src/main/java/com/teaching/backend/model/vo/umsAdmin/UmsStudentVO.java +++ b/src/main/java/com/teaching/backend/model/vo/umsAdmin/UmsStudentVO.java @@ -84,7 +84,7 @@ public class UmsStudentVO implements Serializable { /** * user_id */ - private Integer userId; + private Long userId; /** * role_id diff --git a/src/main/java/com/teaching/backend/model/vo/umsAdmin/UmsTeacherVO.java b/src/main/java/com/teaching/backend/model/vo/umsAdmin/UmsTeacherVO.java index 41edbd5..f86ff51 100644 --- a/src/main/java/com/teaching/backend/model/vo/umsAdmin/UmsTeacherVO.java +++ b/src/main/java/com/teaching/backend/model/vo/umsAdmin/UmsTeacherVO.java @@ -83,7 +83,7 @@ public class UmsTeacherVO implements Serializable { /** * user_id */ - private Integer userId; + private Long userId; /** * role_id diff --git a/src/main/java/com/teaching/backend/service/umsAdmin/impl/UmsUserServiceImpl.java b/src/main/java/com/teaching/backend/service/umsAdmin/impl/UmsUserServiceImpl.java index ecef28e..410378a 100644 --- a/src/main/java/com/teaching/backend/service/umsAdmin/impl/UmsUserServiceImpl.java +++ b/src/main/java/com/teaching/backend/service/umsAdmin/impl/UmsUserServiceImpl.java @@ -205,10 +205,20 @@ public class UmsUserServiceImpl extends ServiceImpl impl @Override public boolean updateUms(UmsUser umsUser) { - List adminList = lambdaQuery().eq(UmsUser::getUsername, umsUser.getUsername()) + List userList = lambdaQuery().eq(UmsUser::getUsername, umsUser.getUsername()) .list(); - if (adminList.size() > 0){ - throw new BusinessException(400,"用户名已存在"); + if (userList.size() == 0){ + UmsUser user = lambdaQuery().eq(UmsUser::getId, umsUser.getId()) + .one(); + if (user == null){ + throw new BusinessException(400,"用户不存在"); + } + return umsUserMapper.updateUserInformation(umsUser); + } + for (UmsUser user : userList) { + if (user.getId() != umsUser.getId()){ + throw new BusinessException(400,"用户名已存在"); + } } if (!StrUtil.isEmpty(umsUser.getPassword())){ throw new BusinessException(400,"修改操作错误1"); diff --git a/src/main/resources/mapper/UmsUserMapper.xml b/src/main/resources/mapper/UmsUserMapper.xml index aaeedc9..3b5dd71 100644 --- a/src/main/resources/mapper/UmsUserMapper.xml +++ b/src/main/resources/mapper/UmsUserMapper.xml @@ -46,11 +46,12 @@ t.nationality nationality, t.profession profession, t.education education, - t.degree degree, + t.academic_degree academicDegree, t.professional_title professionalTitle, t.emergency_contact emergencyContact, t.join_work_time joinWorkTime, - t.political_status politicalStatus + t.political_status politicalStatus, + t.user_id userId FROM ums_teacher t WHERE @@ -68,7 +69,8 @@ s.faculty faculty, s.major major, s.year_age yearAge, - s.class_name className + s.class_name className, + S.user_id userId FROM ums_student s WHERE