fix(system-service): allow findAll when not logged in

This commit is contained in:
sol 2026-04-17 15:53:16 +08:00
parent 5a40395754
commit 36c98c75d3
2 changed files with 8 additions and 0 deletions

View file

@ -52,6 +52,10 @@ public class DepartmentService extends BaseTreeService<DepartmentEntity, BasePag
@Override
@Transactional(readOnly = true)
public List<DepartmentEntity> findAll(boolean otherData) {
if (!StpUtil.isLogin()) {
// 未登录可能是服务远程调用直接返回全部
return super.findAll(otherData);
}
List<String> roleList = StpUtil.getRoleList();
if (roleList.contains(ADMIN_ROLE_ID)) {
return super.findAll(otherData);

View file

@ -105,6 +105,10 @@ public class RoleService extends BaseService<RoleEntity, BasePageDto<RoleEntity>
@Override
@Transactional(readOnly = true)
public List<RoleEntity> findAll(boolean otherData) {
if (!StpUtil.isLogin()) {
// 未登录可能是服务远程调用直接返回全部
return super.findAll(otherData);
}
List<String> roleList = StpUtil.getRoleList();
if (roleList.contains(ADMIN_ROLE_ID)) {
return super.findAll(otherData);