Merge remote-tracking branch 'origin/feature/REQ-1102' into feature/REQ-1102
# Conflicts: # tyr-server/src/main/java/cn/axzo/tyr/server/repository/SaasBasicDictDao.java
This commit is contained in:
commit
750dc72a7c
@ -42,9 +42,9 @@ public interface PermissionPointApi {
|
||||
@PostMapping(value = "/api/v1/permissionPoint/save")
|
||||
ApiResult<PermissionPointDTO> savePermissionPoint(@RequestBody PermissionPointDTO dto);
|
||||
|
||||
/** 删除权限点 - 直接删除 **/
|
||||
/** 删除权限点 **/
|
||||
@PostMapping(value = "/api/v1/permissionPoint/delete/{permissionId}")
|
||||
ApiResult<Void> deletePermissionPoint(@PathVariable Long permissionId);
|
||||
ApiResult<List<String>> deletePermissionPoint(@PathVariable Long permissionId);
|
||||
|
||||
|
||||
/** 位置移动 **/
|
||||
|
||||
@ -18,6 +18,12 @@ public class PermissionPointListQueryRequest {
|
||||
* **/
|
||||
private Integer featureType;
|
||||
|
||||
/**
|
||||
* 授权策略类型,允许为空 1-平台授权型 2-客户授权型 3-免授权型
|
||||
* 参考DelegatedType
|
||||
**/
|
||||
private Integer delegatedType;
|
||||
|
||||
/**
|
||||
* 权限点所属工作台
|
||||
* **/
|
||||
|
||||
@ -54,9 +54,8 @@ public class PermissionPointController implements PermissionPointApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiResult<Void> deletePermissionPoint(Long permissionId) {
|
||||
permissionPointService.delete(permissionId);
|
||||
return ApiResult.ok();
|
||||
public ApiResult<List<String>> deletePermissionPoint(Long permissionId) {
|
||||
return ApiResult.ok(permissionPointService.delete(permissionId));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -58,4 +58,11 @@ public class SaasBasicDictDao extends ServiceImpl<SaasBasicDictMapper, SaasBasic
|
||||
.set(SaasBasicDict::getName, req.getName())
|
||||
.update();
|
||||
}
|
||||
|
||||
public BasicDictNodeResp getWorkspaceType(String workspaceType) {
|
||||
SaasBasicDict dict = this.getOne(new LambdaQueryWrapper<SaasBasicDict>()
|
||||
.eq(SaasBasicDict::getType, DictTypeFiledEnum.WORKSPACE.getValue())
|
||||
.eq(SaasBasicDict::getWorkspaceType, workspaceType));
|
||||
return BeanMapper.copyBean(dict, BasicDictNodeResp.class);
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,8 +36,8 @@ public interface PermissionPointService {
|
||||
/** 保存权限点 **/
|
||||
PermissionPointDTO save(PermissionPointDTO dto);
|
||||
|
||||
/** 删除权限点 **/
|
||||
void delete(Long permissionId);
|
||||
/** 删除权限点 返回business_no **/
|
||||
List<String> delete(Long permissionId);
|
||||
|
||||
/** 位置移动-父级和排序 **/
|
||||
void move(PermissionPointMoveRequest request);
|
||||
|
||||
@ -209,14 +209,12 @@ public class PermissionPointServiceImpl implements PermissionPointService {
|
||||
terminalReq.setCode(feature.getTerminal());
|
||||
terminalReq.setType(DictTypeFiledEnum.TERMINAL);
|
||||
BasicDictNodeResp terminal = saasBasicDictDao.getBasicDictNode(terminalReq);
|
||||
terminalReq.setType(DictTypeFiledEnum.WORKSPACE);
|
||||
terminalReq.setCode(terminal.getWorkspaceType());
|
||||
BasicDictNodeResp workspace = saasBasicDictDao.getBasicDictNode(terminalReq);
|
||||
BasicDictNodeResp workspace = saasBasicDictDao.getWorkspaceType(terminal.getWorkspaceType());
|
||||
List<String> pathName = new ArrayList<>();
|
||||
pathName.add(workspace.getName());
|
||||
pathName.add(terminal.getName());
|
||||
|
||||
if (vo.getParentId() == null || vo.getParentId() == 0) {
|
||||
if (vo.getParentId() == null || vo.getParentId() < 1) {
|
||||
//没有parent直接挂在工作台下
|
||||
vo.setParentName(terminal.getName());
|
||||
vo.setPathName(pathName);
|
||||
@ -302,20 +300,31 @@ public class PermissionPointServiceImpl implements PermissionPointService {
|
||||
|
||||
@Transactional(rollbackFor = Throwable.class)
|
||||
@Override
|
||||
public void delete(Long permissionPointId) {
|
||||
public List<String> delete(Long permissionPointId) {
|
||||
List<Long> delIds = new ArrayList<>();
|
||||
List<String> bizNoList = new ArrayList<>();
|
||||
SaasFeature feature = getAndCheck(permissionPointId);
|
||||
//删除自己
|
||||
this.saasFeatureDao.removeById(permissionPointId);
|
||||
delIds.add(feature.getId());
|
||||
if (feature.getFeatureType().equals(FeatureType.BUTTON.getCode())) {
|
||||
//bizNo返回用于删除路由
|
||||
bizNoList.add(feature.getBusinessNo());
|
||||
}
|
||||
//删除所有子节点
|
||||
List<SaasFeature> children = this.saasFeatureDao.listLikePath(feature.getPath() + feature.getId() + FEATURE_PATH_DELIMITER);
|
||||
if (CollectionUtil.isNotEmpty(children)) {
|
||||
List<Long> childrenIds = children.stream().map(SaasFeature::getId).collect(Collectors.toList());
|
||||
this.saasFeatureDao.removeByIds(childrenIds);
|
||||
delIds.addAll(childrenIds);
|
||||
List<String> buttonBizNoList = children.stream()
|
||||
.filter(x -> x.getFeatureType().equals(FeatureType.BUTTON.getCode()))
|
||||
.map(SaasFeature::getBusinessNo)
|
||||
.collect(Collectors.toList());
|
||||
bizNoList.addAll(buttonBizNoList);
|
||||
}
|
||||
this.saasPgroupPermissionRelationDao.removeByPermissionPointIds(delIds);
|
||||
return bizNoList;
|
||||
}
|
||||
|
||||
|
||||
@ -333,6 +342,7 @@ public class PermissionPointServiceImpl implements PermissionPointService {
|
||||
.eq(Objects.nonNull(request.getTerminal()), SaasFeature::getTerminal, request.getTerminal())
|
||||
.eq(Objects.nonNull(request.getFeatureType()), SaasFeature::getFeatureType, request.getFeatureType())
|
||||
.eq(Objects.nonNull(request.getParentId()), SaasFeature::getParentId, request.getParentId())
|
||||
.eq(Objects.nonNull(request.getDelegatedType()), SaasFeature::getDelegatedType, request.getDelegatedType())
|
||||
.likeRight(Objects.nonNull(request.getLikePath()), SaasFeature::getPath, request.getLikePath());
|
||||
|
||||
return this.saasFeatureDao.list(wrapper)
|
||||
@ -383,7 +393,7 @@ public class PermissionPointServiceImpl implements PermissionPointService {
|
||||
return;
|
||||
}
|
||||
SaasFeature parent = null;
|
||||
if (parentId != 0) {
|
||||
if (parentId > 0) {
|
||||
parent = this.saasFeatureDao.getById(parentId);
|
||||
if (!StrUtil.equals(feature.getTerminal(), parent.getTerminal())) {
|
||||
throw new BizException(BaseCode.BAD_REQUEST, "不允许跨工作台");
|
||||
|
||||
@ -116,6 +116,17 @@ public class RoleServiceImpl implements RoleService {
|
||||
*/
|
||||
@Override
|
||||
public List<SaasRoleVO> query(QuerySaasRoleReq req) {
|
||||
// 如果没有传则默认查询通用维度默认值是 -1,-1+传入的参数含义是查询通用和自定义
|
||||
if (CollectionUtils.isEmpty(req.getWorkspaceId())) {
|
||||
req.setWorkspaceId(Arrays.asList(-1l));
|
||||
} else if(!req.getWorkspaceId().contains(-1l)){
|
||||
req.getWorkspaceId().add(-1l);
|
||||
}
|
||||
if (CollectionUtils.isEmpty(req.getOuId())) {
|
||||
req.setOuId(Arrays.asList(-1l));
|
||||
} else if (!req.getOuId().contains(-1l)) {
|
||||
req.getOuId().add(-1l);
|
||||
}
|
||||
// 根据工作台类型和单位类型查询角色分组
|
||||
List<SaasRoleGroup> roleGroup = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(req.getWorkspaceTypeCode()) || CollectionUtils.isNotEmpty(req.getOuTypeCode())) {
|
||||
@ -143,6 +154,8 @@ public class RoleServiceImpl implements RoleService {
|
||||
.in(CollectionUtils.isNotEmpty(req.getIds()), BaseEntity::getId, req.getIds())
|
||||
.in(CollectionUtils.isNotEmpty(groupRelation), BaseEntity::getId, groupRelation.stream().map(SaasRoleGroupRelation::getRoleId).collect(Collectors.toList()))
|
||||
.eq(StringUtils.isNotBlank(req.getRoleType()), SaasRole::getRoleType, req.getRoleType())
|
||||
.in(CollectionUtils.isNotEmpty(req.getWorkspaceId()),SaasRole::getWorkspaceId,req.getWorkspaceId())
|
||||
.in(CollectionUtils.isNotEmpty(req.getOuId()),SaasRole::getOwnerOuId,req.getOuId())
|
||||
.orderByDesc(BaseEntity::getId)
|
||||
.list();
|
||||
return getByIds(list.stream().map(BaseEntity::getId).collect(Collectors.toList()), req.getIsCommon(),req.getWorkspaceId(),req.getOuId());
|
||||
|
||||
Loading…
Reference in New Issue
Block a user