浏览代码

Merge remote-tracking branch 'remotes/origin/dev_1.0.0' into release_1.0.0

xiatian 2 年之前
父节点
当前提交
e44ff5cb9e
共有 1 个文件被更改,包括 5 次插入4 次删除
  1. 5 4
      src/main/java/cn/com/qmth/mps/service/impl/UserServiceImpl.java

+ 5 - 4
src/main/java/cn/com/qmth/mps/service/impl/UserServiceImpl.java

@@ -104,15 +104,16 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
 				throw new StatusException("不能编辑超管");
 			}
 		} else {
-			if (getByLoginName(domain.getLoginName()) != null) {
-				throw new StatusException("登录名已存在");
-			}
 			ue = new UserEntity();
 			ue.setPassword(ByteUtil.toHexAscii(SHA256.encode(domain.getPasswd())));
 			ue.setSchoolId(domain.getSchoolId());
 			ue.setEnable(true);
-			ue.setLoginName(domain.getLoginName());
 		}
+		UserEntity lg=getByLoginName(domain.getLoginName());
+		if (lg!= null&&(domain.getId()==null||!lg.getId().equals(domain.getId()))) {
+			throw new StatusException("登录名已存在");
+		}
+		ue.setLoginName(domain.getLoginName());
 		ue.setName(domain.getName());
 		ue.setRoleId(domain.getRole().getId());
 		this.saveOrUpdate(ue);