feat:(REQ-2298) 优化角色分组的删除、增加菜单的新字段
This commit is contained in:
parent
9514ac4b90
commit
42672615a9
@ -23,6 +23,8 @@ public enum FeatureResourceType {
|
||||
PAGE(2, "页面"),
|
||||
APP_ENTRY(3, "应用入口"),
|
||||
COMPONENT(4, "组件"),
|
||||
ROOT(5, "ROOT"),
|
||||
GROUP(6, "分组"),
|
||||
;
|
||||
|
||||
private static final Map<Integer, FeatureResourceType> MAPPING = new HashMap<>();
|
||||
|
||||
@ -22,7 +22,7 @@ public class FeatureResourceTreeSaveReq extends BaseFeatureResourceDO {
|
||||
/** 路由地址 **/
|
||||
private String linkUrl;
|
||||
|
||||
/** 路由类型 1-PC 2-小程序 3-原生 **/
|
||||
/** 路由类型 1-PC 2-小程序 3-原生 4-h5**/
|
||||
private Integer linkType;
|
||||
|
||||
/** APP适配参数 **/
|
||||
@ -34,6 +34,16 @@ public class FeatureResourceTreeSaveReq extends BaseFeatureResourceDO {
|
||||
/** 授权类型 0-全部角色 1-指定角色 **/
|
||||
private Integer authType;
|
||||
|
||||
/**
|
||||
* 应用范围(租户类型):1:企业工作台 2;项目工作台
|
||||
*/
|
||||
private Long workspaceType;
|
||||
|
||||
/**
|
||||
* 最低版本序列,主要支持版本灰度策略
|
||||
*/
|
||||
private Integer version;
|
||||
|
||||
/** 页面组件对象 **/
|
||||
private List<FeatureComponentSaveReq> componentSaveReqList;
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@ import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@ -46,4 +47,6 @@ public class QuerySaasRoleGroupReq {
|
||||
private List<Long> roleIds;
|
||||
|
||||
private Long parentId;
|
||||
|
||||
private Set<Long> parentIds;
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ public class FeatureResourceDTO implements Serializable {
|
||||
private String featureName;
|
||||
|
||||
/**
|
||||
* 资源类型1-菜单 2-页面 3-应用入口 4-组件
|
||||
* 资源类型1-菜单 2-页面 3-应用入口 4-组件 5-root 6-分组
|
||||
*/
|
||||
private Integer featureType;
|
||||
|
||||
@ -88,7 +88,7 @@ public class FeatureResourceDTO implements Serializable {
|
||||
private String linkUrl;
|
||||
|
||||
/**
|
||||
* 路由类型1-PC 2-小程序 3-原生
|
||||
* 路由类型1-PC 2-小程序 3-原生 4-h5
|
||||
*/
|
||||
private Integer linkType;
|
||||
|
||||
@ -136,4 +136,14 @@ public class FeatureResourceDTO implements Serializable {
|
||||
* 更新人
|
||||
*/
|
||||
private Long updateBy;
|
||||
|
||||
/**
|
||||
* 应用范围(租户类型):1:企业工作台 2;项目工作台
|
||||
*/
|
||||
private Long workspaceType;
|
||||
|
||||
/**
|
||||
* 最低版本序列,主要支持版本灰度策略
|
||||
*/
|
||||
private Integer version;
|
||||
}
|
||||
|
||||
@ -122,6 +122,11 @@
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.axzo.foundation</groupId>
|
||||
<artifactId>common-lib</artifactId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
package cn.axzo.tyr.server.config.exception;
|
||||
|
||||
import cn.axzo.foundation.result.IResultCode;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum BizResultCode implements IResultCode {
|
||||
|
||||
CANT_DELETE_ROLE_GROUP("100001", "不能删除角色分组,当前角色分组下有子角色分组");
|
||||
|
||||
private String errorCode;
|
||||
private String errorMessage;
|
||||
}
|
||||
@ -1,7 +1,8 @@
|
||||
package cn.axzo.tyr.server.config.exception;
|
||||
|
||||
import cn.axzo.basics.common.exception.ServiceException;
|
||||
import cn.axzo.foundation.exception.BusinessException;
|
||||
import cn.axzo.framework.domain.web.result.ApiResult;
|
||||
import cn.azxo.framework.common.model.CommonResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
@ -48,4 +49,9 @@ public class ExceptionAdviceHandler {
|
||||
return ApiResult.err(objectErrorDefaultMessage);
|
||||
}
|
||||
|
||||
@ExceptionHandler(BusinessException.class)
|
||||
public CommonResponse<Void> businessExceptionHandler(BusinessException e) {
|
||||
log.warn("参数错误", e);
|
||||
return CommonResponse.error(Integer.valueOf(e.getErrorCode()), e.getErrorMsg());
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,6 +39,7 @@ public class SaasRoleGroupDao extends ServiceImpl<SaasRoleGroupMapper, SaasRoleG
|
||||
.in(CollectionUtils.isNotEmpty(req.getWorkspaceIds()), SaasRoleGroup::getWorkspaceId, req.getWorkspaceIds())
|
||||
.in(CollectionUtils.isNotEmpty(req.getOuIds()), SaasRoleGroup::getOuId, req.getOuIds())
|
||||
.eq(Objects.nonNull(req.getParentId()), SaasRoleGroup::getParentId, req.getParentId())
|
||||
.in(CollectionUtils.isNotEmpty(req.getParentIds()), SaasRoleGroup::getParentId, req.getParentIds())
|
||||
.eq(BaseEntity::getIsDelete, TableIsDeleteEnum.NORMAL.value);
|
||||
if(CollectionUtils.isNotEmpty(req.getOuTypeCode())){
|
||||
eq.last(" AND (" + condition.substring(0, condition.length() - 2) + ")");
|
||||
|
||||
@ -133,6 +133,16 @@ public class SaasFeatureResource extends BaseEntity<SaasFeature> {
|
||||
*/
|
||||
private Long updateBy;
|
||||
|
||||
/**
|
||||
* 应用范围(租户类型):1:企业工作台 2;项目工作台
|
||||
*/
|
||||
private Long workspaceType;
|
||||
|
||||
/**
|
||||
* 最低版本序列,主要支持版本灰度策略
|
||||
*/
|
||||
private Integer version;
|
||||
|
||||
public List<Long> splitPath() {
|
||||
if (StrUtil.isBlank(this.path)) {
|
||||
return Collections.emptyList();
|
||||
|
||||
@ -2,6 +2,7 @@ package cn.axzo.tyr.server.service.impl;
|
||||
|
||||
import cn.axzo.basics.common.constant.enums.TableIsDeleteEnum;
|
||||
import cn.axzo.basics.common.exception.ServiceException;
|
||||
import cn.axzo.foundation.exception.Axssert;
|
||||
import cn.axzo.tyr.client.model.req.QuerySaasRoleGroupReq;
|
||||
import cn.axzo.tyr.client.model.vo.SaasRoleGroupVO;
|
||||
import cn.axzo.tyr.server.repository.dao.SaasRoleGroupDao;
|
||||
@ -23,12 +24,15 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.axzo.tyr.server.config.exception.BizResultCode.CANT_DELETE_ROLE_GROUP;
|
||||
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
@ -111,7 +115,7 @@ public class SaasRoleGroupServiceImpl extends ServiceImpl<SaasRoleGroupMapper, S
|
||||
}
|
||||
|
||||
/**
|
||||
* 只有当分组下面角色为空时才能删除
|
||||
* 只有当分组下面角色为空合分组下没有其他分组时才能删除
|
||||
* @param ids
|
||||
*/
|
||||
@Override
|
||||
@ -126,6 +130,13 @@ public class SaasRoleGroupServiceImpl extends ServiceImpl<SaasRoleGroupMapper, S
|
||||
if (relationCount > 0) {
|
||||
throw new ServiceException("该角色分组有关联角色,不能进行删除!");
|
||||
}
|
||||
|
||||
QuerySaasRoleGroupReq querySaasRoleGroupReq = QuerySaasRoleGroupReq.builder()
|
||||
.parentIds(new HashSet<>(ids))
|
||||
.build();
|
||||
List<SaasRoleGroup> childrenRoleGroups = saasRoleGroupDao.query(querySaasRoleGroupReq);
|
||||
Axssert.check(CollectionUtils.isEmpty(childrenRoleGroups), CANT_DELETE_ROLE_GROUP);
|
||||
|
||||
saasRoleGroupDao.delete(ids);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user