feat(2046) 修改批量获取权限分组接口

This commit is contained in:
TanJ 2024-01-13 17:41:48 +08:00
parent fb29af7950
commit aef8a7778e
6 changed files with 10 additions and 11 deletions

View File

@ -54,12 +54,12 @@ public interface SaasRoleGroupApi {
/**
*
* 通过categoryCode查询分组
* @param categoryCode #{@link cn.axzo.tyr.client.common.enums.SaasPositionEnum}
* @param categoryCodes #{@link cn.axzo.tyr.client.common.enums.SaasPositionEnum}
*
* @return
*/
@GetMapping("/api/saasRoleGroup/listByCategoryCode")
ApiResult<List<SaasRoleGroupVO>> listByCategoryCode(@RequestParam("categoryCode") String categoryCode);
ApiResult<List<SaasRoleGroupVO>> listByCategoryCode(@RequestParam("categoryCode") List<String> categoryCodes);
}

View File

@ -52,7 +52,7 @@ public class SaasRoleGroupController implements SaasRoleGroupApi {
}
@Override
public ApiResult<List<SaasRoleGroupVO>> listByCategoryCode(String categoryCode) {
public ApiResult<List<SaasRoleGroupVO>> listByCategoryCode(List<String> categoryCode) {
return ApiResult.ok(saasRoleGroupService.listByCategoryCode(categoryCode));
}

View File

@ -51,9 +51,9 @@ public class SaasRoleGroupDao extends ServiceImpl<SaasRoleGroupMapper, SaasRoleG
.update();
}
public List<SaasRoleGroup> listByCategoryCode(String categoryCode) {
return lambdaQuery().eq(BaseEntity::getIsDelete, 0L)
.eq(StrUtil.isNotBlank(categoryCode), SaasRoleGroup::getCategoryCode, categoryCode).list();
public List<SaasRoleGroup> listByCategoryCode(List<String> categoryCode) {
return lambdaQuery().eq(BaseEntity::getIsDelete, 0L)
.in(SaasRoleGroup::getCategoryCode, categoryCode).list();
}
}

View File

@ -31,5 +31,5 @@ public interface SaasRoleGroupService {
* @param categoryCode
* @return
*/
List<SaasRoleGroupVO> listByCategoryCode(String categoryCode);
List<SaasRoleGroupVO> listByCategoryCode(List<String> categoryCode);
}

View File

@ -7,7 +7,6 @@ import cn.axzo.pokonyan.config.mybatisplus.BaseEntity;
import cn.axzo.pokonyan.util.KeysUtil;
import cn.axzo.tyr.client.common.enums.RoleResourceTypeEnum;
import cn.axzo.tyr.client.common.enums.RoleTypeEnum;
import cn.axzo.tyr.client.common.enums.SaasPositionEnum;
import cn.axzo.tyr.client.model.BaseWorkspaceModel;
import cn.axzo.tyr.client.model.enums.IdentityType;
import cn.axzo.tyr.client.model.enums.WorkerLeaderRoleEnum;
@ -359,8 +358,8 @@ public class RoleUserService implements SaasRoleUserService {
if (CollectionUtil.isEmpty(roleUserBaseInfo.getRoleUserResourceInfos())) {
throw new ServiceException("grant team manager error, not found person info");
}
if (CollectionUtil.isEmpty(saasPgroupRoleRelations)) {
log.warn("warn: grant team manager permission error, not found permissions info");
// 未指定授权哪些角色
return;
}
@ -414,7 +413,7 @@ public class RoleUserService implements SaasRoleUserService {
if (StrUtil.isBlank(categoryCode)) {
throw new ServiceException("不支持清除该人员所有角色,请指定分组");
}
List<SaasRoleGroupVO> saasRoleGroupVO = saasRoleGroupService.listByCategoryCode(categoryCode);
List<SaasRoleGroupVO> saasRoleGroupVO = saasRoleGroupService.listByCategoryCode(Lists.newArrayList(categoryCode));
List<SaasRoleGroupRelation> roleGroupRelations = saasRoleGroupRelationDao.findByGroupId(saasRoleGroupVO.stream().map(SaasRoleGroupVO::getId).collect(Collectors.toSet()));
Set<Long> roleIds = roleGroupRelations.stream().map(SaasRoleGroupRelation::getRoleId).collect(Collectors.toSet());
if (CollectionUtil.isEmpty(roleIds)) {

View File

@ -160,7 +160,7 @@ public class SaasRoleGroupServiceImpl implements SaasRoleGroupService {
}
@Override
public List<SaasRoleGroupVO> listByCategoryCode(String categoryCode) {
public List<SaasRoleGroupVO> listByCategoryCode(List<String> categoryCode) {
return BeanUtil.copyToList(saasRoleGroupDao.listByCategoryCode(categoryCode), SaasRoleGroupVO.class);
}
}