查询角色信息通用接口默认不返回角色下的权限集信息,提高接口处理速度

This commit is contained in:
陈维伟 2023-10-20 14:08:17 +08:00
parent 886a1a10a0
commit 7d0e7d68fd
4 changed files with 7 additions and 8 deletions

View File

@ -57,7 +57,7 @@ public interface TyrSaasRoleApi {
ApiResult delete(@RequestBody List<Long> id);
/**
* 根据身份id身份类型查询权限列表批量
* 根据身份id身份类型查询权限列表只返回角色信息
* @param identityType 身份类型 1:工人 2:班组长 3:从业人员 4:监管人员 5:运营人员
* @return
*/
@ -65,7 +65,7 @@ public interface TyrSaasRoleApi {
ApiResult<List<SaasRoleVO>> queryByIdentityIdType(@RequestParam(required = true) Long identityId,@RequestParam(required = true) Integer identityType,@RequestParam(required = true) Long workspaceId,@RequestParam(required = true) Long ouId);
/**
* 根据身份id身份类型查询权限列表批量
* 根据身份id身份类型查询权限列表批量,只返回角色信息
* @return
*/
@PostMapping("/api/saasRole/queryBatchByIdentityIdType")

View File

@ -66,7 +66,7 @@ public class SaasRoleController implements TyrSaasRoleApi {
@Override
public ApiResult<List<SaasRoleVO>> queryByIdentityIdType(Long identityId, Integer identityType,Long workspaceId,Long ouId) {
return ApiResult.ok(roleService.queryByIdentityIdType(identityId, identityType,workspaceId,ouId));
return ApiResult.ok(roleService.queryByIdentityIdType(identityId, identityType,workspaceId,ouId, false));
}
@Override

View File

@ -25,7 +25,7 @@ import java.util.Set;
public interface RoleService {
List<SaasRoleVO> queryByIdentityIdType(Long identityId, Integer identityType,Long workspaceId,Long ouId);
List<SaasRoleVO> queryByIdentityIdType(Long identityId, Integer identityType,Long workspaceId,Long ouId, Boolean includePermissionGroup);
List<SaasRoleVO> query(QuerySaasRoleReq req);

View File

@ -76,13 +76,13 @@ public class RoleServiceImpl implements RoleService {
SaasRoleUserRelationDao saasRoleUserRelationDao;
@Override
public List<SaasRoleVO> queryByIdentityIdType(Long identityId, Integer identityType, Long workspaceId, Long ouId) {
public List<SaasRoleVO> queryByIdentityIdType(Long identityId, Integer identityType, Long workspaceId, Long ouId, Boolean includePermissionGroup) {
// 查询人关联的角色id
List<Long> roleIds = roleUserRelationDao.query(identityId, identityType, workspaceId, ouId).stream().map(SaasRoleUserRelation::getRoleId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(roleIds)) {
return new ArrayList<>();
}
return getByIds(roleIds, null, null,null, false);
return getByIds(roleIds, null, null,null, includePermissionGroup);
}
/**
@ -194,14 +194,13 @@ public class RoleServiceImpl implements RoleService {
@Override
public List<QueryBatchByIdentityIdTypeRes> queryBatchByIdentityIdType(List<QueryByIdentityIdTypeReq> req) {
List<QueryBatchByIdentityIdTypeRes> result = new ArrayList<>();
req.forEach(e -> {
result.add(QueryBatchByIdentityIdTypeRes.builder()
.identityId(e.getIdentityId())
.identityType(e.getIdentityType())
.workspaceId(e.getWorkspaceId())
.ouId(e.getOuId())
.role(queryByIdentityIdType(e.getIdentityId(),e.getIdentityType(),e.getWorkspaceId(),e.getOuId()))
.role(queryByIdentityIdType(e.getIdentityId(),e.getIdentityType(),e.getWorkspaceId(),e.getOuId(),false))
.build());
});
return result;