|
|
@@ -114,9 +114,12 @@ public class AccountServiceImpl implements AccountService {
|
|
|
}
|
|
|
|
|
|
Role role = accountRole.getRole();
|
|
|
- int total = userRepository.countByRole_id(role.getId());
|
|
|
- if (total > 2) {
|
|
|
- return Result.fail("admin role 最多只能有两个用户拥有");
|
|
|
+ int id = role.getId();
|
|
|
+ if (id == 1) {
|
|
|
+ int total = userRepository.countByRole_id(role.getId());
|
|
|
+ if (total >= 2) {
|
|
|
+ return Result.fail("系统最多允许 2 个用户拥有 admin role");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
userEntity.setRole(role);
|