Browse Source

优化用户重复提示

test
smallchill 5 years ago
parent
commit
5831b95ba0
  1. 4
      blade-service/blade-user/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java

4
blade-service/blade-user/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java

@ -81,7 +81,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
} }
Integer userCount = baseMapper.selectCount(Wrappers.<User>query().lambda().eq(User::getTenantId, tenantId).eq(User::getAccount, user.getAccount())); Integer userCount = baseMapper.selectCount(Wrappers.<User>query().lambda().eq(User::getTenantId, tenantId).eq(User::getAccount, user.getAccount()));
if (userCount > 0 && Func.isEmpty(user.getId())) { if (userCount > 0 && Func.isEmpty(user.getId())) {
throw new ServiceException("当前用户已存在!"); throw new ServiceException(StringUtil.format("当前用户 [{}] 已存在!", user.getAccount()));
} }
return save(user) && submitUserDept(user); return save(user) && submitUserDept(user);
} }
@ -97,7 +97,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
.notIn(User::getId, user.getId()) .notIn(User::getId, user.getId())
); );
if (userCount > 0) { if (userCount > 0) {
throw new ServiceException("当前用户已存在!"); throw new ServiceException(StringUtil.format("当前用户 [{}] 已存在!", user.getAccount()));
} }
return updateUserInfo(user) && submitUserDept(user); return updateUserInfo(user) && submitUserDept(user);
} }

Loading…
Cancel
Save