feat:(REQ-2545) 增加刷产品权限点的权限点类型接口
This commit is contained in:
parent
93dcbda32d
commit
c13110a46f
@ -0,0 +1,33 @@
|
|||||||
|
package cn.axzo.tyr.client.model.req;
|
||||||
|
|
||||||
|
import cn.axzo.foundation.dao.support.wrapper.CriteriaField;
|
||||||
|
import cn.axzo.foundation.dao.support.wrapper.Operator;
|
||||||
|
import cn.axzo.foundation.page.IPageReq;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class PageProductFeatureRelationReq implements IPageReq {
|
||||||
|
|
||||||
|
@CriteriaField(ignore = true)
|
||||||
|
Integer page;
|
||||||
|
|
||||||
|
@CriteriaField(ignore = true)
|
||||||
|
Integer pageSize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序:使用示例,createTime__DESC
|
||||||
|
*/
|
||||||
|
@CriteriaField(ignore = true)
|
||||||
|
List<String> sort;
|
||||||
|
|
||||||
|
@CriteriaField(field = "id", operator = Operator.IN)
|
||||||
|
private List<Long> ids;
|
||||||
|
}
|
||||||
@ -3,12 +3,13 @@ package cn.axzo.tyr.server.controller;
|
|||||||
import cn.axzo.basics.common.constant.enums.DeleteEnum;
|
import cn.axzo.basics.common.constant.enums.DeleteEnum;
|
||||||
import cn.axzo.basics.common.constant.enums.TableIsDeleteEnum;
|
import cn.axzo.basics.common.constant.enums.TableIsDeleteEnum;
|
||||||
import cn.axzo.basics.common.util.TreeUtil;
|
import cn.axzo.basics.common.util.TreeUtil;
|
||||||
|
import cn.axzo.foundation.page.PageResp;
|
||||||
import cn.axzo.framework.domain.web.result.ApiResult;
|
import cn.axzo.framework.domain.web.result.ApiResult;
|
||||||
import cn.axzo.pokonyan.config.mybatisplus.BaseEntity;
|
import cn.axzo.pokonyan.config.mybatisplus.BaseEntity;
|
||||||
import cn.axzo.foundation.page.PageResp;
|
|
||||||
import cn.axzo.tyr.client.model.req.CommonDictQueryReq;
|
import cn.axzo.tyr.client.model.req.CommonDictQueryReq;
|
||||||
import cn.axzo.tyr.client.model.req.GetFeatureResourceTreeReq;
|
import cn.axzo.tyr.client.model.req.GetFeatureResourceTreeReq;
|
||||||
import cn.axzo.tyr.client.model.req.PagePgroupPermissionRelationReq;
|
import cn.axzo.tyr.client.model.req.PagePgroupPermissionRelationReq;
|
||||||
|
import cn.axzo.tyr.client.model.req.PageProductFeatureRelationReq;
|
||||||
import cn.axzo.tyr.client.model.req.PermissionCheckReq;
|
import cn.axzo.tyr.client.model.req.PermissionCheckReq;
|
||||||
import cn.axzo.tyr.client.model.req.QuerySaasRoleGroupReq;
|
import cn.axzo.tyr.client.model.req.QuerySaasRoleGroupReq;
|
||||||
import cn.axzo.tyr.client.model.res.CommonDictResp;
|
import cn.axzo.tyr.client.model.res.CommonDictResp;
|
||||||
@ -18,15 +19,19 @@ import cn.axzo.tyr.client.model.res.SaasRoleRes;
|
|||||||
import cn.axzo.tyr.client.model.vo.SaasRoleGroupVO;
|
import cn.axzo.tyr.client.model.vo.SaasRoleGroupVO;
|
||||||
import cn.axzo.tyr.server.repository.dao.SaasFeatureDao;
|
import cn.axzo.tyr.server.repository.dao.SaasFeatureDao;
|
||||||
import cn.axzo.tyr.server.repository.dao.SaasFeatureResourceDao;
|
import cn.axzo.tyr.server.repository.dao.SaasFeatureResourceDao;
|
||||||
|
import cn.axzo.tyr.server.repository.dao.SaasPgroupPermissionRelationDao;
|
||||||
|
import cn.axzo.tyr.server.repository.dao.SaasPgroupRoleRelationDao;
|
||||||
|
import cn.axzo.tyr.server.repository.dao.SaasRoleDao;
|
||||||
import cn.axzo.tyr.server.repository.dao.SaasRoleGroupRelationDao;
|
import cn.axzo.tyr.server.repository.dao.SaasRoleGroupRelationDao;
|
||||||
import cn.axzo.tyr.server.repository.entity.SaasFeature;
|
import cn.axzo.tyr.server.repository.entity.SaasFeature;
|
||||||
import cn.axzo.tyr.server.repository.entity.SaasFeatureResource;
|
import cn.axzo.tyr.server.repository.entity.SaasFeatureResource;
|
||||||
import cn.axzo.tyr.server.repository.entity.SaasPgroupPermissionRelation;
|
import cn.axzo.tyr.server.repository.entity.SaasPgroupPermissionRelation;
|
||||||
|
import cn.axzo.tyr.server.repository.entity.SaasPgroupRoleRelation;
|
||||||
|
import cn.axzo.tyr.server.repository.entity.SaasProductModuleFeatureRelation;
|
||||||
import cn.axzo.tyr.server.repository.entity.SaasRole;
|
import cn.axzo.tyr.server.repository.entity.SaasRole;
|
||||||
import cn.axzo.tyr.server.repository.entity.SaasRoleGroup;
|
import cn.axzo.tyr.server.repository.entity.SaasRoleGroup;
|
||||||
import cn.axzo.tyr.server.repository.entity.SaasRoleGroupRelation;
|
import cn.axzo.tyr.server.repository.entity.SaasRoleGroupRelation;
|
||||||
import cn.axzo.tyr.server.repository.dao.*;
|
import cn.axzo.tyr.server.service.ProductFeatureRelationService;
|
||||||
import cn.axzo.tyr.server.repository.entity.*;
|
|
||||||
import cn.axzo.tyr.server.service.ProductPermissionCacheService;
|
import cn.axzo.tyr.server.service.ProductPermissionCacheService;
|
||||||
import cn.axzo.tyr.server.service.RolePermissionCacheService;
|
import cn.axzo.tyr.server.service.RolePermissionCacheService;
|
||||||
import cn.axzo.tyr.server.service.RoleService;
|
import cn.axzo.tyr.server.service.RoleService;
|
||||||
@ -101,7 +106,8 @@ public class PrivateController {
|
|||||||
private SaasPgroupRoleRelationDao saasPgroupRoleRelationDao;
|
private SaasPgroupRoleRelationDao saasPgroupRoleRelationDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SaasPgroupPermissionRelationDao saasPgroupPermissionRelationDao;
|
private SaasPgroupPermissionRelationDao saasPgroupPermissionRelationDao;
|
||||||
|
@Autowired
|
||||||
|
private ProductFeatureRelationService productFeatureRelationService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -371,9 +377,9 @@ public class PrivateController {
|
|||||||
|
|
||||||
PageResp<SaasPgroupPermissionRelation> page = saasPgroupPermissionRelationService.page(req);
|
PageResp<SaasPgroupPermissionRelation> page = saasPgroupPermissionRelationService.page(req);
|
||||||
if (CollectionUtils.isNotEmpty(page.getData())) {
|
if (CollectionUtils.isNotEmpty(page.getData())) {
|
||||||
updateOldFeature(page.getData());
|
updateOldRoleFeature(page.getData());
|
||||||
|
|
||||||
updateNewFeature(page.getData());
|
updateNewRoleFeature(page.getData());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!page.hasNext()) {
|
if (!page.hasNext()) {
|
||||||
@ -383,7 +389,7 @@ public class PrivateController {
|
|||||||
return "ok";
|
return "ok";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateNewFeature(List<SaasPgroupPermissionRelation> saasPgroupPermissionRelations) {
|
private void updateNewRoleFeature(List<SaasPgroupPermissionRelation> saasPgroupPermissionRelations) {
|
||||||
List<SaasPgroupPermissionRelation> newFeatureRelations = saasPgroupPermissionRelations.stream()
|
List<SaasPgroupPermissionRelation> newFeatureRelations = saasPgroupPermissionRelations.stream()
|
||||||
.filter(e -> Objects.equals(e.getFeatureType(), NEW_FEATURE))
|
.filter(e -> Objects.equals(e.getFeatureType(), NEW_FEATURE))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
@ -417,7 +423,7 @@ public class PrivateController {
|
|||||||
saasPgroupPermissionRelationService.updateBatchById(update);
|
saasPgroupPermissionRelationService.updateBatchById(update);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateOldFeature(List<SaasPgroupPermissionRelation> saasPgroupPermissionRelations) {
|
private void updateOldRoleFeature(List<SaasPgroupPermissionRelation> saasPgroupPermissionRelations) {
|
||||||
List<SaasPgroupPermissionRelation> oldFeatureRelations = saasPgroupPermissionRelations.stream()
|
List<SaasPgroupPermissionRelation> oldFeatureRelations = saasPgroupPermissionRelations.stream()
|
||||||
.filter(e -> Objects.equals(e.getFeatureType(), OLD_FEATURE))
|
.filter(e -> Objects.equals(e.getFeatureType(), OLD_FEATURE))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
@ -451,6 +457,107 @@ public class PrivateController {
|
|||||||
saasPgroupPermissionRelationService.updateBatchById(update);
|
saasPgroupPermissionRelationService.updateBatchById(update);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新saas_product_module_feature_relation表的featureType
|
||||||
|
* 1、type = 0的数据从saas_feature中查询
|
||||||
|
* 2、type = 1的数据从saas_feature_resource中查询
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/api/private/ProductPermissionRelation/featureResource/refresh")
|
||||||
|
public Object reFreshProductFeature(@Validated @RequestBody RefreshProductPermissionFeatureParam request) {
|
||||||
|
|
||||||
|
final Integer DEFAULT_PAGE_SIZE = 100;
|
||||||
|
Integer pageNumber = 1;
|
||||||
|
while (true) {
|
||||||
|
PageProductFeatureRelationReq req = PageProductFeatureRelationReq.builder()
|
||||||
|
.ids(request.getIds())
|
||||||
|
.page(pageNumber++)
|
||||||
|
.pageSize(DEFAULT_PAGE_SIZE)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
PageResp<SaasProductModuleFeatureRelation> page = productFeatureRelationService.page(req);
|
||||||
|
if (CollectionUtils.isNotEmpty(page.getData())) {
|
||||||
|
updateOldProductFeature(page.getData());
|
||||||
|
|
||||||
|
updateNewProductFeature(page.getData());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!page.hasNext()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "ok";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateNewProductFeature(List<SaasProductModuleFeatureRelation> saasProductModuleFeatureRelations) {
|
||||||
|
List<SaasProductModuleFeatureRelation> newFeatureRelations = saasProductModuleFeatureRelations.stream()
|
||||||
|
.filter(e -> Objects.equals(e.getFeatureType(), NEW_FEATURE))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (CollectionUtils.isEmpty(newFeatureRelations)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<Long, SaasFeatureResource> saasFeatureResourceMap = saasFeatureResourceDao.listByIds(Lists.transform(newFeatureRelations, SaasProductModuleFeatureRelation::getFeatureId))
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.toMap(SaasFeatureResource::getId, Function.identity()));
|
||||||
|
|
||||||
|
List<SaasProductModuleFeatureRelation> update = saasProductModuleFeatureRelations.stream()
|
||||||
|
.map(e -> {
|
||||||
|
SaasFeatureResource saasFeatureResource = saasFeatureResourceMap.get(e.getFeatureId());
|
||||||
|
if (saasFeatureResource == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
SaasProductModuleFeatureRelation saasProductModuleFeatureRelation = new SaasProductModuleFeatureRelation();
|
||||||
|
saasProductModuleFeatureRelation.setId(e.getId());
|
||||||
|
saasProductModuleFeatureRelation.setFeatureType(saasFeatureResource.getFeatureType());
|
||||||
|
return saasProductModuleFeatureRelation;
|
||||||
|
})
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isEmpty(update)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
productFeatureRelationService.updateBatchById(update);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateOldProductFeature(List<SaasProductModuleFeatureRelation> saasProductModuleFeatureRelations) {
|
||||||
|
List<SaasProductModuleFeatureRelation> oldFeatureRelations = saasProductModuleFeatureRelations.stream()
|
||||||
|
.filter(e -> Objects.equals(e.getFeatureType(), OLD_FEATURE))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (CollectionUtils.isEmpty(oldFeatureRelations)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<Long, SaasFeature> saasFeatureMap = saasFeatureDao.listByIds(Lists.transform(oldFeatureRelations, SaasProductModuleFeatureRelation::getFeatureId))
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.toMap(SaasFeature::getId, Function.identity()));
|
||||||
|
|
||||||
|
List<SaasProductModuleFeatureRelation> update = saasProductModuleFeatureRelations.stream()
|
||||||
|
.map(e -> {
|
||||||
|
SaasFeature saasFeature = saasFeatureMap.get(e.getFeatureId());
|
||||||
|
if (saasFeature == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
SaasProductModuleFeatureRelation saasProductModuleFeatureRelation = new SaasProductModuleFeatureRelation();
|
||||||
|
saasProductModuleFeatureRelation.setId(e.getId());
|
||||||
|
saasProductModuleFeatureRelation.setFeatureType(saasFeature.getFeatureType());
|
||||||
|
return saasProductModuleFeatureRelation;
|
||||||
|
})
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isEmpty(update)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
productFeatureRelationService.updateBatchById(update);
|
||||||
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Builder
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@ -483,4 +590,13 @@ public class PrivateController {
|
|||||||
|
|
||||||
private List<Long> ids;
|
private List<Long> ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class RefreshProductPermissionFeatureParam {
|
||||||
|
|
||||||
|
private List<Long> ids;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,14 @@
|
|||||||
package cn.axzo.tyr.server.service;
|
package cn.axzo.tyr.server.service;
|
||||||
|
|
||||||
|
import cn.axzo.foundation.page.PageResp;
|
||||||
import cn.axzo.framework.domain.web.result.ApiResult;
|
import cn.axzo.framework.domain.web.result.ApiResult;
|
||||||
import cn.axzo.tyr.client.model.product.ProductFeatureRelationSearchReq;
|
import cn.axzo.tyr.client.model.product.ProductFeatureRelationSearchReq;
|
||||||
import cn.axzo.tyr.client.model.product.ProductFeatureRelationUpdateReq;
|
import cn.axzo.tyr.client.model.product.ProductFeatureRelationUpdateReq;
|
||||||
import cn.axzo.tyr.client.model.product.ProductFeatureRelationVO;
|
import cn.axzo.tyr.client.model.product.ProductFeatureRelationVO;
|
||||||
|
import cn.axzo.tyr.client.model.req.PageProductFeatureRelationReq;
|
||||||
import cn.axzo.tyr.server.repository.entity.ProductFeatureQuery;
|
import cn.axzo.tyr.server.repository.entity.ProductFeatureQuery;
|
||||||
import cn.axzo.tyr.server.repository.entity.SaasProductModuleFeatureRelation;
|
import cn.axzo.tyr.server.repository.entity.SaasProductModuleFeatureRelation;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -17,7 +20,7 @@ import java.util.Set;
|
|||||||
* @author wangli
|
* @author wangli
|
||||||
* @since 2023/9/7 14:26
|
* @since 2023/9/7 14:26
|
||||||
*/
|
*/
|
||||||
public interface ProductFeatureRelationService {
|
public interface ProductFeatureRelationService extends IService<SaasProductModuleFeatureRelation> {
|
||||||
ApiResult<List<ProductFeatureRelationVO>> featureList(ProductFeatureRelationSearchReq req);
|
ApiResult<List<ProductFeatureRelationVO>> featureList(ProductFeatureRelationSearchReq req);
|
||||||
|
|
||||||
ApiResult<Boolean> updateFeatureRelation(List<ProductFeatureRelationUpdateReq> req);
|
ApiResult<Boolean> updateFeatureRelation(List<ProductFeatureRelationUpdateReq> req);
|
||||||
@ -52,4 +55,8 @@ public interface ProductFeatureRelationService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
SaasProductModuleFeatureRelation getOneByProductId(Long productId);
|
SaasProductModuleFeatureRelation getOneByProductId(Long productId);
|
||||||
|
|
||||||
|
PageResp<SaasProductModuleFeatureRelation> page(PageProductFeatureRelationReq param);
|
||||||
|
|
||||||
|
List<SaasProductModuleFeatureRelation> list(PageProductFeatureRelationReq param);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -611,7 +611,7 @@ public class PermissionQueryServiceImpl implements PermissionQueryService {
|
|||||||
.featureIds(featureIds)
|
.featureIds(featureIds)
|
||||||
.build();
|
.build();
|
||||||
return saasRoleUserRelationService.listV2(listRoleUserRelationParam).stream()
|
return saasRoleUserRelationService.listV2(listRoleUserRelationParam).stream()
|
||||||
.filter(e -> e.getSaasRole() != null && CollectionUtils.isNotEmpty(e.getSaasRole().getPermissionRelations()))
|
.filter(e -> e.getSaasRole() != null)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
package cn.axzo.tyr.server.service.impl;
|
package cn.axzo.tyr.server.service.impl;
|
||||||
|
|
||||||
import cn.axzo.basics.common.BeanMapper;
|
import cn.axzo.basics.common.BeanMapper;
|
||||||
|
import cn.axzo.foundation.dao.support.converter.PageConverter;
|
||||||
|
import cn.axzo.foundation.dao.support.mysql.QueryWrapperHelper;
|
||||||
|
import cn.axzo.foundation.page.PageResp;
|
||||||
import cn.axzo.framework.domain.web.result.ApiResult;
|
import cn.axzo.framework.domain.web.result.ApiResult;
|
||||||
import cn.axzo.pokonyan.config.mybatisplus.BaseEntity;
|
import cn.axzo.pokonyan.config.mybatisplus.BaseEntity;
|
||||||
import cn.axzo.thrones.client.saas.ServicePkgClient;
|
import cn.axzo.thrones.client.saas.ServicePkgClient;
|
||||||
@ -11,6 +14,7 @@ import cn.axzo.tyr.client.model.product.ProductFeatureRelationSearchReq;
|
|||||||
import cn.axzo.tyr.client.model.product.ProductFeatureRelationUpdateReq;
|
import cn.axzo.tyr.client.model.product.ProductFeatureRelationUpdateReq;
|
||||||
import cn.axzo.tyr.client.model.product.ProductFeatureRelationVO;
|
import cn.axzo.tyr.client.model.product.ProductFeatureRelationVO;
|
||||||
import cn.axzo.tyr.client.model.req.FeatureIdPair;
|
import cn.axzo.tyr.client.model.req.FeatureIdPair;
|
||||||
|
import cn.axzo.tyr.client.model.req.PageProductFeatureRelationReq;
|
||||||
import cn.axzo.tyr.server.repository.dao.ProductModuleDao;
|
import cn.axzo.tyr.server.repository.dao.ProductModuleDao;
|
||||||
import cn.axzo.tyr.server.repository.dao.SaasFeatureDao;
|
import cn.axzo.tyr.server.repository.dao.SaasFeatureDao;
|
||||||
import cn.axzo.tyr.server.repository.dao.SaasFeatureResourceDao;
|
import cn.axzo.tyr.server.repository.dao.SaasFeatureResourceDao;
|
||||||
@ -19,11 +23,15 @@ import cn.axzo.tyr.server.repository.entity.ProductFeatureQuery;
|
|||||||
import cn.axzo.tyr.server.repository.entity.SaasFeature;
|
import cn.axzo.tyr.server.repository.entity.SaasFeature;
|
||||||
import cn.axzo.tyr.server.repository.entity.SaasFeatureResource;
|
import cn.axzo.tyr.server.repository.entity.SaasFeatureResource;
|
||||||
import cn.axzo.tyr.server.repository.entity.SaasProductModuleFeatureRelation;
|
import cn.axzo.tyr.server.repository.entity.SaasProductModuleFeatureRelation;
|
||||||
|
import cn.axzo.tyr.server.repository.mapper.SaasProductModuleFeatureRelationMapper;
|
||||||
import cn.axzo.tyr.server.service.ProductFeatureRelationService;
|
import cn.axzo.tyr.server.service.ProductFeatureRelationService;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.StopWatch;
|
import cn.hutool.core.date.StopWatch;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -53,7 +61,8 @@ import static cn.axzo.tyr.server.util.RpcInternalUtil.checkAndGetData;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Service
|
@Service
|
||||||
public class ProductFeatureRelationServiceImpl implements ProductFeatureRelationService {
|
public class ProductFeatureRelationServiceImpl extends ServiceImpl<SaasProductModuleFeatureRelationMapper, SaasProductModuleFeatureRelation>
|
||||||
|
implements ProductFeatureRelationService {
|
||||||
private final SaasProductModuleFeatureRelationDao saasProductModuleFeatureRelationDao;
|
private final SaasProductModuleFeatureRelationDao saasProductModuleFeatureRelationDao;
|
||||||
private final ServicePkgClient servicePkgClient;
|
private final ServicePkgClient servicePkgClient;
|
||||||
private final SaasFeatureDao saasFeatureDao;
|
private final SaasFeatureDao saasFeatureDao;
|
||||||
@ -295,4 +304,23 @@ public class ProductFeatureRelationServiceImpl implements ProductFeatureRelation
|
|||||||
.list();
|
.list();
|
||||||
return org.apache.commons.collections4.CollectionUtils.isEmpty(list) ? null : list.get(0);
|
return org.apache.commons.collections4.CollectionUtils.isEmpty(list) ? null : list.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResp<SaasProductModuleFeatureRelation> page(PageProductFeatureRelationReq param) {
|
||||||
|
QueryWrapper<SaasProductModuleFeatureRelation> wrapper = QueryWrapperHelper.fromBean(param, SaasProductModuleFeatureRelation.class);
|
||||||
|
wrapper.eq("is_delete", 0);
|
||||||
|
|
||||||
|
IPage<SaasProductModuleFeatureRelation> page = this.page(PageConverter.toMybatis(param, SaasProductModuleFeatureRelation.class), wrapper);
|
||||||
|
|
||||||
|
return PageConverter.toResp(page, Function.identity());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SaasProductModuleFeatureRelation> list(PageProductFeatureRelationReq param) {
|
||||||
|
return PageConverter.drainAll(pageNumber -> {
|
||||||
|
param.setPage(pageNumber);
|
||||||
|
param.setPageSize(500);
|
||||||
|
return page(param);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,6 +43,7 @@ import cn.axzo.tyr.client.model.vo.SaasPermissionGroupVO;
|
|||||||
import cn.axzo.tyr.client.model.vo.SaasRoleVO;
|
import cn.axzo.tyr.client.model.vo.SaasRoleVO;
|
||||||
import cn.axzo.tyr.server.model.FilterRoleAuth;
|
import cn.axzo.tyr.server.model.FilterRoleAuth;
|
||||||
import cn.axzo.tyr.server.model.PermissionCacheKey;
|
import cn.axzo.tyr.server.model.PermissionCacheKey;
|
||||||
|
import cn.axzo.tyr.server.repository.dao.ProductModuleDao;
|
||||||
import cn.axzo.tyr.server.repository.dao.SaasFeatureDao;
|
import cn.axzo.tyr.server.repository.dao.SaasFeatureDao;
|
||||||
import cn.axzo.tyr.server.repository.dao.SaasProductModuleFeatureRelationDao;
|
import cn.axzo.tyr.server.repository.dao.SaasProductModuleFeatureRelationDao;
|
||||||
import cn.axzo.tyr.server.repository.entity.ProductFeatureInfo;
|
import cn.axzo.tyr.server.repository.entity.ProductFeatureInfo;
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
package cn.axzo.tyr.base;
|
package cn.axzo.tyr.base;
|
||||||
|
|
||||||
|
import cn.axzo.thrones.client.saas.ServicePkgClient;
|
||||||
import cn.axzo.tyr.base.MysqlDataLoader;
|
import cn.axzo.tyr.base.MysqlDataLoader;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.boot.test.context.TestConfiguration;
|
import org.springframework.boot.test.context.TestConfiguration;
|
||||||
|
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import redis.embedded.RedisServer;
|
import redis.embedded.RedisServer;
|
||||||
|
|
||||||
@ -33,4 +35,7 @@ public class TestConfig {
|
|||||||
public MysqlDataLoader mysqlDataLoader() {
|
public MysqlDataLoader mysqlDataLoader() {
|
||||||
return new MysqlDataLoader();
|
return new MysqlDataLoader();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@MockBean
|
||||||
|
private ServicePkgClient servicePkgClient;
|
||||||
}
|
}
|
||||||
@ -0,0 +1,127 @@
|
|||||||
|
package cn.axzo.tyr.server.service.impl;
|
||||||
|
|
||||||
|
import cn.axzo.thrones.client.saas.ServicePkgClient;
|
||||||
|
import cn.axzo.thrones.client.saas.entity.serivicepgkproduct.ServicePkgProduct;
|
||||||
|
import cn.axzo.thrones.client.saas.entity.servicepkg.ServicePkgDetailRes;
|
||||||
|
import cn.axzo.tyr.base.BaseTest;
|
||||||
|
import cn.axzo.tyr.base.MysqlDataLoader;
|
||||||
|
import cn.axzo.tyr.client.model.req.IdentityAuthReq;
|
||||||
|
import cn.axzo.tyr.client.model.req.PermissionCheckReq;
|
||||||
|
import cn.axzo.tyr.client.model.res.IdentityAuthRes;
|
||||||
|
import cn.axzo.tyr.server.repository.dao.ProductModuleDao;
|
||||||
|
import cn.axzo.tyr.server.repository.dao.SaasFeatureDao;
|
||||||
|
import cn.axzo.tyr.server.repository.entity.ProductModule;
|
||||||
|
import cn.axzo.tyr.server.service.PermissionQueryService;
|
||||||
|
import cn.axzo.tyr.server.service.TyrSaasAuthService;
|
||||||
|
import cn.azxo.framework.common.model.CommonResponse;
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.assertj.core.util.Lists;
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.mockito.Mockito;
|
||||||
|
import org.mockito.MockitoAnnotations;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
class PermissionQueryServiceImplTest extends BaseTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PermissionQueryService permissionQueryService;
|
||||||
|
@Autowired
|
||||||
|
private MysqlDataLoader mysqlDataLoader;
|
||||||
|
@Autowired
|
||||||
|
private TyrSaasAuthService tyrSaasAuthService;
|
||||||
|
@Autowired
|
||||||
|
private SaasFeatureDao saasFeatureDao;
|
||||||
|
@Autowired
|
||||||
|
private ServicePkgClient servicePkgClient;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ProductModuleDao productModuleDao;
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
@Override
|
||||||
|
public void setup() {
|
||||||
|
super.setup();
|
||||||
|
mysqlDataLoader.loadFromClassName(getClass().getSimpleName());
|
||||||
|
MockitoAnnotations.initMocks(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void hasPermissionNew() {
|
||||||
|
ServicePkgDetailRes servicePkgDetailRes = new ServicePkgDetailRes();
|
||||||
|
ServicePkgProduct servicePkgProduct = new ServicePkgProduct();
|
||||||
|
servicePkgProduct.setProductId(1L);
|
||||||
|
|
||||||
|
ServicePkgProduct servicePkgProduct2 = new ServicePkgProduct();
|
||||||
|
servicePkgProduct2.setProductId(6L);
|
||||||
|
servicePkgDetailRes.setProducts(Lists.newArrayList(
|
||||||
|
servicePkgProduct,
|
||||||
|
servicePkgProduct2
|
||||||
|
));
|
||||||
|
Mockito.when(servicePkgClient.getServicePkgDetailBySpaceId(Mockito.any()))
|
||||||
|
.thenReturn(CommonResponse.success(Lists.newArrayList(servicePkgDetailRes)));
|
||||||
|
// 普通角色和产品有旧权限码权限:begin
|
||||||
|
PermissionCheckReq permissionCheckReq = PermissionCheckReq.builder()
|
||||||
|
.personId(80792L)
|
||||||
|
.featureCodes(Lists.newArrayList("cms:ent_contact", "cms:ent_contact_new"))
|
||||||
|
.ouId(5154L)
|
||||||
|
.workspaceId(205L)
|
||||||
|
.build();
|
||||||
|
List<ProductModule> list = productModuleDao.list();
|
||||||
|
log.info("size:{}", list.size());
|
||||||
|
System.out.println("size+" + list.size());
|
||||||
|
|
||||||
|
new Thread(() -> {
|
||||||
|
synchronized (this) {
|
||||||
|
List<ProductModule> productModules = productModuleDao.list();
|
||||||
|
log.info("inner size:{}", productModules.size());
|
||||||
|
System.out.println("inner size+" + list.size());
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
|
||||||
|
boolean result = authPermission(permissionCheckReq);
|
||||||
|
boolean resultOld = authPermissionOld(permissionCheckReq);
|
||||||
|
Assertions.assertTrue(result);
|
||||||
|
Assertions.assertTrue(resultOld);
|
||||||
|
// 普通角色和产品有旧权限码权限:end
|
||||||
|
|
||||||
|
// 管理员角色和产品有旧权限码权限:begin
|
||||||
|
permissionCheckReq = PermissionCheckReq.builder()
|
||||||
|
.personId(80792L)
|
||||||
|
.featureCodes(Lists.newArrayList("cms:ent_contact", "cms:ent_contact_new"))
|
||||||
|
.ouId(5154L)
|
||||||
|
.workspaceId(290L)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
result = authPermission(permissionCheckReq);
|
||||||
|
resultOld = authPermissionOld(permissionCheckReq);
|
||||||
|
Assertions.assertTrue(result);
|
||||||
|
Assertions.assertTrue(resultOld);
|
||||||
|
// 管理员角色和产品有旧权限码权限:end
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean authPermission(PermissionCheckReq permissionCheckReq) {
|
||||||
|
return tyrSaasAuthService.authPermission(permissionCheckReq) || tyrSaasAuthService.authNewPermission(permissionCheckReq);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean authPermissionOld(PermissionCheckReq req) {
|
||||||
|
IdentityAuthReq authReq = IdentityAuthReq.builder()
|
||||||
|
.personId(req.getPersonId())
|
||||||
|
.workspaceOusPairs(Collections.singletonList(IdentityAuthReq.WorkspaceOuPair.builder()
|
||||||
|
.workspaceId(req.getWorkspaceId())
|
||||||
|
.ouId(req.getOuId()).build()))
|
||||||
|
.featureCode(new HashSet<>(req.getFeatureCodes()))
|
||||||
|
.terminal(StringUtils.isBlank(req.getTerminal()) ? null : Collections.singletonList(req.getTerminal()))
|
||||||
|
.build();
|
||||||
|
IdentityAuthRes.WorkspacePermission permissions = tyrSaasAuthService.findIdentityAuthMix(authReq).getPermissions().get(0);
|
||||||
|
return CollectionUtil.isNotEmpty(permissions.getPermissionPoint());
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
#-->DEFAULT
|
||||||
|
|
||||||
|
INSERT INTO saas_feature (id, feature_name, feature_code, icon, parent_id, parent_module_id, link_url, link_type, link_ext, micro_app_item_id, path, description, sort, terminal, feature_type, is_delete, create_by, create_at, update_at, update_by, legacy_layout, operate_type, old_id, fit_ou_type_bit, fit_ou_node_type_bit, app_name, feature_url, need_cert, need_auth, business_no, parent_business_no, delegated_type)
|
||||||
|
VALUES (965, '总包视角-合同外派工—编辑任务相关字段', 'cms:ent_contact', '', 357, 0, '', 1, '', '', '/0/354/357/', '', 27, 'NT_CMS_WEB_PROJ', 3, 0, 0, '2022-07-22 16:18:34', '2023-12-26 18:40:56', 0, '', null, null, 1, 1, 'apollo', '/webApi/cms/preOrder/batchSaveOrUpdate', 1, 1, '965', '357', 2);
|
||||||
|
INSERT INTO saas_feature (id, feature_name, feature_code, icon, parent_id, parent_module_id, link_url, link_type, link_ext, micro_app_item_id, path, description, sort, terminal, feature_type, is_delete, create_by, create_at, update_at, update_by, legacy_layout, operate_type, old_id, fit_ou_type_bit, fit_ou_node_type_bit, app_name, feature_url, need_cert, need_auth, business_no, parent_business_no, delegated_type)
|
||||||
|
VALUES (966, '总包视角-合同外派工—编辑量价相关字段', 'CMS_WEB_PROJ_0326', '', 357, 0, '', 1, '', '', '/0/354/357/', '', 28, 'NT_CMS_WEB_PROJ', 3, 0, 0, '2022-07-22 16:18:48', '2023-12-26 18:41:05', 0, '', null, null, 1, 1, 'apollo', '/webApi/cms/preOrder/batchSaveOrUpdate', 1, 1, '966', '357', 2);
|
||||||
|
|
||||||
|
INSERT INTO saas_pgroup_role_relation (id, role_id, group_id, is_delete, create_at, update_at, create_by, update_by)
|
||||||
|
VALUES (2290532, 25349, 912, 0, '2023-10-23 17:50:06', '2023-10-23 17:50:06', -1, -1);
|
||||||
|
INSERT INTO saas_pgroup_role_relation (id, role_id, group_id, is_delete, create_at, update_at, create_by, update_by)
|
||||||
|
VALUES (2290576, 25397, 956, 0, '2023-10-23 17:50:17', '2023-10-23 17:50:17', -1, -1);
|
||||||
|
|
||||||
|
INSERT INTO saas_pgroup_permission_relation (id, group_id, feature_id, is_delete, create_at, update_at, create_by, update_by, type, feature_type, terminal)
|
||||||
|
VALUES (28543, 912, 965, 0, '2023-10-23 17:50:06', '2023-10-23 17:50:06', -1, -1, 0, 0, '');
|
||||||
|
INSERT INTO saas_pgroup_permission_relation (id, group_id, feature_id, is_delete, create_at, update_at, create_by, update_by, type, feature_type, terminal)
|
||||||
|
VALUES (28550, 912, 966, 0, '2023-10-23 17:50:06', '2023-10-23 17:50:06', -1, -1, 0, 0, '');
|
||||||
|
INSERT INTO saas_pgroup_permission_relation (id, group_id, feature_id, is_delete, create_at, update_at, create_by, update_by, type, feature_type, terminal)
|
||||||
|
VALUES (28551, 956, 966, 0, '2023-10-23 17:50:06', '2023-10-23 17:50:06', -1, -1, 0, 0, '');
|
||||||
|
|
||||||
|
INSERT INTO saas_role (id, NAME, description, role_type, role_code, workspace_id, owner_ou_id, product_unit_type, workspace_type, is_delete, create_at, update_at, create_by, update_by, fit_ou_type_bit, fit_ou_node_type_bit, position_template_id, project_team_manage_role_resource_id, from_pre_role_id, job_code, is_display, enabled, sort)
|
||||||
|
VALUES (25349, '安全总监', '', 'init', '25349', -1, -1, 1, 2, 0, '2023-10-23 17:50:06', '2024-05-29 10:06:36', -1, 2003028, 1, 65535, 0, null, 0, '', 1, 1, 6);
|
||||||
|
INSERT INTO saas_role (id, NAME, description, role_type, role_code, workspace_id, owner_ou_id, product_unit_type, workspace_type, is_delete, create_at, update_at, create_by, update_by, fit_ou_type_bit, fit_ou_node_type_bit, position_template_id, project_team_manage_role_resource_id, from_pre_role_id, job_code, is_display, enabled, sort)
|
||||||
|
VALUES (25397, '法务部部长', '', 'init', '25397', -1, -1, 7, 1, 0, '2023-10-23 17:50:17', '2024-04-17 11:02:19', -1, 2003041, 1, 65535, 0, null, 0, '', 1, 1, 9);
|
||||||
|
INSERT INTO saas_role (id, NAME, description, role_type, role_code, workspace_id, owner_ou_id, product_unit_type, workspace_type, is_delete, create_at, update_at, create_by, update_by, fit_ou_type_bit, fit_ou_node_type_bit, position_template_id, project_team_manage_role_resource_id, from_pre_role_id, job_code, is_display, enabled, sort)
|
||||||
|
VALUES (6450, '超级管理员', '', 'super_admin', '6450', 141, 4, 1, 2, 0, '2022-10-19 15:52:33', '2024-04-17 11:02:19', 0, 0, 65535, 65535, 0, 0, 0, '', 1, 1, 1);
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO saas_role_user_relation (id, identity_id, role_id, identity_type, natural_person_id, workspace_id, ou_id, resource_type, resource_id, is_delete, create_at, update_at, create_by, update_by, job_type)
|
||||||
|
VALUES (179539, 2000028, 25349, 3, 80792, 205, 5154, 0, 0, 0, '2023-06-01 11:04:20', '2023-10-23 17:50:05', 0, 0, 2);
|
||||||
|
INSERT INTO saas_role_user_relation (id, identity_id, role_id, identity_type, natural_person_id, workspace_id, ou_id, resource_type, resource_id, is_delete, create_at, update_at, create_by, update_by, job_type)
|
||||||
|
VALUES (206831, 2000028, 6450, 3, 80792, 290, 5154, 0, 0, 0, '2024-02-26 16:30:04', '2024-02-26 16:30:04', 0, 0, 2);
|
||||||
|
INSERT INTO saas_role_user_relation (id, identity_id, role_id, identity_type, natural_person_id, workspace_id, ou_id, resource_type, resource_id, is_delete, create_at, update_at, create_by, update_by, job_type)
|
||||||
|
VALUES (212953, 2000028, 25397, 3, 80792, 205, 5154, 0, 0, 0, '2024-03-20 14:41:13', '2024-03-20 14:41:12', 0, 0, 2);
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO product_module (id, icon, product_type, product_name, dict_workspace_type_id, dict_workspace_type_code, status, common_product, remark, auth_type, ou_type, is_delete, create_by, create_at, update_at, update_by, category, version, max_person_count, max_workspace_count, price, skus, material)
|
||||||
|
VALUES (1, 'https://axzo-public.oss-cn-chengdu.aliyuncs.com/oms/test/1695189976949-Snipaste_09-15 16-36.png', 1, '企业基础-自动授权', 1, '1', 0, 1, '', 1, null, 0, 0, '2022-08-17 19:46:11', '2024-06-14 10:51:19', 0, '', 1, 0, 0, 0, null, null);
|
||||||
|
INSERT INTO product_module (id, icon, product_type, product_name, dict_workspace_type_id, dict_workspace_type_code, status, common_product, remark, auth_type, ou_type, is_delete, create_by, create_at, update_at, update_by, category, version, max_person_count, max_workspace_count, price, skus, material)
|
||||||
|
VALUES (6, '', 1, '招投标平台-企业总包', 1, '1', 1, 1, '', null, null, 0, 0, '2022-09-04 14:43:18', '2023-09-18 19:54:40', 0, '', 0, 0, 0, 0, null, null);
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO saas_product_module_feature_relation (product_module_id, dict_code_id, dict_code, feature_id, is_delete, create_at, update_at, create_by, update_by, type, feature_type, terminal)
|
||||||
|
VALUES (1, 1, '1', 965, 0, '2024-05-29 15:28:39', '2024-05-29 15:28:38', 0, 0, 1, 7, 'NT_CMS_WEB_GENERAL');
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO saas_product_module_feature_relation (product_module_id, dict_code_id, dict_code, feature_id, is_delete, create_at, update_at, create_by, update_by, type, feature_type, terminal)
|
||||||
|
VALUES (1, 1, '1', 966, 0, '2024-05-29 15:28:39', '2024-05-29 15:28:38', 0, 0, 1, 7, 'NT_CMS_WEB_GENERAL');
|
||||||
|
|
||||||
|
|
||||||
|
#-->PermissionQueryServiceImplTest.sql
|
||||||
@ -1,2 +1,2 @@
|
|||||||
### DEFAULT
|
#-->DEFAULT
|
||||||
|
|
||||||
|
|||||||
@ -140,4 +140,116 @@ CREATE TABLE `saas_feature_resource` (
|
|||||||
alter table saas_feature_resource
|
alter table saas_feature_resource
|
||||||
add column `workspace_type` tinyint DEFAULT '0' COMMENT '1:企业工作台 2;项目工作台' after `path`;
|
add column `workspace_type` tinyint DEFAULT '0' COMMENT '1:企业工作台 2;项目工作台' after `path`;
|
||||||
alter table saas_feature_resource add column `version` int DEFAULT '0' COMMENT '最低版本序列,主要支持版本灰度策略' after `workspace_type`;
|
alter table saas_feature_resource add column `version` int DEFAULT '0' COMMENT '最低版本序列,主要支持版本灰度策略' after `workspace_type`;
|
||||||
alter table saas_feature_resource add column `uni_code` varchar(64) not null default '' comment '唯一编码,用于pre环境菜单同步' after `version`;
|
alter table saas_feature_resource add column `uni_code` varchar(64) not null default '' comment '唯一编码,用于pre环境菜单同步' after `version`;
|
||||||
|
|
||||||
|
CREATE TABLE `saas_page_element` (
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '自增主键ID',
|
||||||
|
`group_code` varchar(64) NOT NULL DEFAULT '' COMMENT '元素的父编码',
|
||||||
|
`code` varchar(64) NOT NULL COMMENT '页面元素编码',
|
||||||
|
`name` varchar(64) NOT NULL COMMENT '资源元素名称',
|
||||||
|
`type` varchar(32) NOT NULL DEFAULT '' COMMENT '页面元素类型(PAGE:页面,COMPONENT:组件)',
|
||||||
|
`link_url` varchar(255) NOT NULL DEFAULT '' COMMENT '页面路由地址',
|
||||||
|
`terminal` varchar(32) NOT NULL DEFAULT '' COMMENT '资源所属端',
|
||||||
|
`create_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
|
`update_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||||
|
`is_delete` bigint NOT NULL DEFAULT '0' COMMENT '删除标识',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_page_element_gcode` (`group_code`),
|
||||||
|
KEY `idx_page_element_code` (`code`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='页面元素表';
|
||||||
|
|
||||||
|
CREATE TABLE `saas_page_element_feature_resource_relation` (
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '自增主键ID',
|
||||||
|
`page_element_code` varchar(64) NOT NULL COMMENT '页面元素code',
|
||||||
|
`feature_resource_uni_code` varchar(64) NOT NULL COMMENT '菜单组件code',
|
||||||
|
`terminal` varchar(32) NOT NULL DEFAULT '' COMMENT '资源所属端',
|
||||||
|
`create_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
|
`update_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||||
|
`create_by` bigint DEFAULT NULL COMMENT '创建人',
|
||||||
|
`update_by` bigint DEFAULT NULL COMMENT '更新人',
|
||||||
|
`is_delete` bigint NOT NULL DEFAULT '0' COMMENT '删除标识',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_page_element_relation_pec` (`page_element_code`),
|
||||||
|
KEY `idx_page_element_relation_fruc` (`feature_resource_uni_code`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='页面元素与菜单组件关系表';
|
||||||
|
|
||||||
|
CREATE TABLE `saas_pgroup_permission_relation` (
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`group_id` bigint NOT NULL DEFAULT '0' COMMENT '权限集id',
|
||||||
|
`feature_id` bigint NOT NULL DEFAULT '0' COMMENT '功能id',
|
||||||
|
`is_delete` bigint NOT NULL DEFAULT '0' COMMENT '是否删除:0否,other是',
|
||||||
|
`create_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
|
`update_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||||
|
`create_by` bigint NOT NULL DEFAULT '0' COMMENT '创建者',
|
||||||
|
`update_by` bigint NOT NULL DEFAULT '0' COMMENT '更新者',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `IDX_permission_relation_GROUP_ID` (`group_id`,`feature_id`,`is_delete`),
|
||||||
|
KEY `IDX_permission_relation_FEATURE_ID` (`feature_id`,`group_id`,`is_delete`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=71008 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='权限集功能中间表';
|
||||||
|
|
||||||
|
alter table saas_pgroup_permission_relation add column type tinyint default 0 not null comment '关联类型(0:saas_feature,1:saas_feature_resource)';
|
||||||
|
|
||||||
|
alter table saas_pgroup_permission_relation add column feature_type tinyint not null default 0 comment '资源类型1-菜单 2-页面 3-应用入口 4-组件';
|
||||||
|
|
||||||
|
alter table saas_pgroup_permission_relation add column terminal varchar(32) not null default '' comment '资源所属端';
|
||||||
|
|
||||||
|
CREATE TABLE `product_module` (
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||||
|
`icon` varchar(255) NOT NULL COMMENT '产品 icon 图标',
|
||||||
|
`product_type` tinyint NOT NULL DEFAULT '0' COMMENT '1:总包企业产品 2:总包项目产品 3:政企产品 4:分包企业产品 5:班组产品',
|
||||||
|
`product_name` varchar(100) NOT NULL DEFAULT '' COMMENT '产品板块名字',
|
||||||
|
`dict_workspace_type_id` bigint NOT NULL DEFAULT '0' COMMENT '企业字典中的系统域ID',
|
||||||
|
`dict_workspace_type_code` varchar(64) NOT NULL DEFAULT '' COMMENT '企业字典中的系统域CODe',
|
||||||
|
`status` tinyint NOT NULL DEFAULT '1' COMMENT '产品状态 1:启用 0:未启用',
|
||||||
|
`common_product` tinyint NOT NULL DEFAULT '1' COMMENT '是否基础产品 0:是 1:不是',
|
||||||
|
`remark` varchar(100) NOT NULL DEFAULT '' COMMENT '产品板块备注',
|
||||||
|
`auth_type` tinyint DEFAULT NULL COMMENT '产品默认授权方式 1:创建工作台 2:资质认证',
|
||||||
|
`ou_type` varchar(255) DEFAULT NULL COMMENT '资质序列/单位类型(数组多选)',
|
||||||
|
`is_delete` bigint NOT NULL DEFAULT '0' COMMENT '是否删除',
|
||||||
|
`create_by` bigint DEFAULT '0' COMMENT '创建人id',
|
||||||
|
`create_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
|
`update_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||||
|
`update_by` bigint DEFAULT '0' COMMENT '修改人id',
|
||||||
|
`category` varchar(32) NOT NULL DEFAULT '' COMMENT '产品类型 PRODUCT_VERSION:产品版本类型、ADD_VALUE_SERVICE:增值服务类型、GENERAL_SERVICE:通用产品类型、HARD_WARE:硬件产品类型',
|
||||||
|
`version` int NOT NULL DEFAULT '0' COMMENT '版本升级序列(数字越小,版本越低,不能降级,只能升级) <企业、项目产品>',
|
||||||
|
`max_person_count` int NOT NULL DEFAULT '0' COMMENT '人数上限 <企业、项目产品>',
|
||||||
|
`max_workspace_count` int NOT NULL DEFAULT '0' COMMENT '最大项目数 <企业产品>',
|
||||||
|
`price` bigint NOT NULL DEFAULT '0' COMMENT '价格(单位:分)',
|
||||||
|
`skus` json DEFAULT NULL COMMENT '产品详情jsonList(skuNameSKU名称、model规格型号、count数量、unit单位)',
|
||||||
|
`material` json DEFAULT NULL COMMENT '素材<仅硬件产品支持>json类型',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='saas-产品表';
|
||||||
|
|
||||||
|
CREATE TABLE `saas_product_module_feature_relation` (
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`product_module_id` bigint NOT NULL DEFAULT '0' COMMENT '产品Id',
|
||||||
|
`dict_code_id` bigint NOT NULL DEFAULT '0' COMMENT '字典配置第三级业务数据id 第二级默认为ouType',
|
||||||
|
`dict_code` varchar(64) NOT NULL DEFAULT '' COMMENT '字典配置第三级业务数据code',
|
||||||
|
`feature_id` bigint NOT NULL DEFAULT '0' COMMENT '功能Id',
|
||||||
|
`is_delete` bigint NOT NULL DEFAULT '0' COMMENT '是否删除:0否,other是',
|
||||||
|
`create_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
|
`update_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||||
|
`create_by` bigint NOT NULL DEFAULT '0' COMMENT '创建者',
|
||||||
|
`update_by` bigint NOT NULL DEFAULT '0' COMMENT '更新者',
|
||||||
|
`type` tinyint NOT NULL DEFAULT '0' COMMENT '关联类型(0:saas_feature,1:saas_feature_resource)',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `IDX_PRODUCT_RELATION_MODULE_ID` (`product_module_id`,`is_delete`) USING BTREE,
|
||||||
|
KEY `IDX_PRODUCT_RELATION_FEATURE` (`feature_id`,`product_module_id`,`is_delete`) USING BTREE
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=315417 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='saas-产品-功能关联表';
|
||||||
|
|
||||||
|
alter table saas_product_module_feature_relation add column feature_type tinyint not null default 0 comment '资源类型1-菜单 2-页面 3-应用入口 4-组件';
|
||||||
|
alter table saas_product_module_feature_relation add column `terminal` varchar(32) not null default '' COMMENT '端';
|
||||||
|
|
||||||
|
CREATE TABLE `saas_pgroup_role_relation` (
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
|
`role_id` bigint NOT NULL DEFAULT '0' COMMENT '角色id',
|
||||||
|
`group_id` bigint NOT NULL DEFAULT '0' COMMENT '权限集id',
|
||||||
|
`is_delete` bigint NOT NULL DEFAULT '0' COMMENT '是否删除:0否,other是',
|
||||||
|
`create_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
|
`update_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||||
|
`create_by` bigint NOT NULL DEFAULT '0' COMMENT '创建者',
|
||||||
|
`update_by` bigint NOT NULL DEFAULT '0' COMMENT '更新者',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_pgroup_relation_role_id` (`role_id`,`is_delete`) USING BTREE,
|
||||||
|
KEY `idx_group_relation_group_id` (`group_id`,`is_delete`) USING BTREE
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=5794664 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='角色权限集中间表';
|
||||||
Loading…
Reference in New Issue
Block a user