Prechádzať zdrojové kódy

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

xiatian 2 rokov pred
rodič
commit
e44ff5cb9e

+ 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("不能编辑超管");
 				throw new StatusException("不能编辑超管");
 			}
 			}
 		} else {
 		} else {
-			if (getByLoginName(domain.getLoginName()) != null) {
-				throw new StatusException("登录名已存在");
-			}
 			ue = new UserEntity();
 			ue = new UserEntity();
 			ue.setPassword(ByteUtil.toHexAscii(SHA256.encode(domain.getPasswd())));
 			ue.setPassword(ByteUtil.toHexAscii(SHA256.encode(domain.getPasswd())));
 			ue.setSchoolId(domain.getSchoolId());
 			ue.setSchoolId(domain.getSchoolId());
 			ue.setEnable(true);
 			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.setName(domain.getName());
 		ue.setRoleId(domain.getRole().getId());
 		ue.setRoleId(domain.getRole().getId());
 		this.saveOrUpdate(ue);
 		this.saveOrUpdate(ue);