|
|
@@ -59,23 +59,13 @@ public class RoleServiceImpl implements RoleService {
|
|
|
|
|
|
@Override
|
|
|
public List<Role> findByEnterprise(long enUU) {
|
|
|
- List<Role> roles = roleDao.findByEnUU(enUU);
|
|
|
- if (CollectionUtils.isEmpty(roles)) {
|
|
|
- // 角色为空,说明资料未初始化或初始化失败,需重新init
|
|
|
+ // 默认角色个数
|
|
|
+ Integer defaultRoleCount = roleDao.findIsDefaultCountByEnUU(enUU);
|
|
|
+ if (defaultRoleCount < ALL_DEFAULT_ROLE) {
|
|
|
+ // 如果默认角色个数小于设定的值,进行初始化角色数据
|
|
|
enterpriseDao.callInitProcedure(enUU);
|
|
|
- roles = roleDao.findByEnUU(enUU);
|
|
|
- } else {
|
|
|
- int count = 0;
|
|
|
- for (Role role : roles) {
|
|
|
- if (role.getIsdefault().intValue() == DEFAULT_ROLE) {
|
|
|
- count++;
|
|
|
- }
|
|
|
- }
|
|
|
- if (count < ALL_DEFAULT_ROLE) {
|
|
|
- enterpriseDao.callInitProcedure(enUU);
|
|
|
- roles = roleDao.findByEnUU(enUU);
|
|
|
- }
|
|
|
}
|
|
|
+ List<Role> roles = roleDao.findByEnUU(enUU);
|
|
|
return roles;
|
|
|
}
|
|
|
|