From ab59e0069f1225ca37810bf43734d0f509bee48d Mon Sep 17 00:00:00 2001 From: wenyu441069198 <14186472+wenyu441069198@user.noreply.gitee.com> Date: Sun, 23 Jun 2024 11:11:54 +0800 Subject: [PATCH] =?UTF-8?q?=E8=82=96=E6=B5=B7=E5=8D=97=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E5=AD=97=E6=AE=B5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/entity/umsAdmin/UmsTeacher.java | 2 +- .../backend/model/vo/umsAdmin/UmsStudentVO.java | 2 +- .../backend/model/vo/umsAdmin/UmsTeacherVO.java | 2 +- .../umsAdmin/impl/UmsUserServiceImpl.java | 16 +++++++++++++--- src/main/resources/mapper/UmsUserMapper.xml | 8 +++++--- 5 files changed, 21 insertions(+), 9 deletions(-) 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