fix(1882): 添加权限点相关接口

This commit is contained in:
TanJ 2023-11-30 18:25:15 +08:00
parent 1303dc0f8c
commit b0048071e7
7 changed files with 76 additions and 0 deletions

View File

@ -54,4 +54,19 @@ public interface PermissionPointApi {
/** 查询权限点列表 - 不组装树形结构 **/
@PostMapping(value = "/api/v1/permissionPoint/queryList")
ApiResult<List<PermissionPointTreeNode>> queryList(@RequestBody PermissionPointListQueryRequest request);
/**
* 根据权限点code查询详情
**/
@GetMapping(value = "/api/v1/permissionPoint/getDetail/{code}")
ApiResult<List<PermissionPointDTO>> getDetailByCode(@PathVariable String code);
/**
* 根据权限点Id获取子节点
**/
@GetMapping(value = "/api/v1/permissionPoint/getDetail/{id}")
ApiResult<List<PermissionPointDTO>> getChildByParentId(@PathVariable Long id);
}

View File

@ -68,4 +68,16 @@ public class PermissionPointController implements PermissionPointApi {
public ApiResult<List<PermissionPointTreeNode>> queryList(PermissionPointListQueryRequest request) {
return ApiResult.ok(permissionPointService.queryList(request));
}
@Override
public ApiResult<List<PermissionPointDTO>> getDetailByCode(String code) {
return ApiResult.ok(permissionPointService.getDetailByCode(code));
}
@Override
public ApiResult<List<PermissionPointDTO>> getChildByParentId(Long parentId) {
return ApiResult.ok(permissionPointService.getChildByParentId(parentId));
}
}

View File

@ -25,4 +25,9 @@ public interface SaasFeatureDao extends IService<SaasFeature> {
List<SaasFeature> listByParentIdAndTerminal(Long parentId, String terminal);
List<SaasFeature> listByCode(String code);
List<SaasFeature> getChildByParentId(Long parentId);
}

View File

@ -1,5 +1,7 @@
package cn.axzo.tyr.server.repository.dao.impl;
import cn.axzo.basics.common.constant.enums.TableIsDeleteEnum;
import cn.axzo.pokonyan.config.mybatisplus.BaseEntity;
import cn.axzo.tyr.server.repository.dao.SaasFeatureDao;
import cn.axzo.tyr.server.repository.entity.SaasFeature;
import cn.axzo.tyr.server.repository.mapper.SaasFeatureMapper;
@ -48,4 +50,15 @@ public class SaasFeatureDaoImpl extends ServiceImpl<SaasFeatureMapper, SaasFeatu
.eq(SaasFeature::getTerminal, terminal));
}
@Override
public List<SaasFeature> listByCode(String code) {
return this.lambdaQuery().in(SaasFeature::getFeatureCode, code)
.eq(BaseEntity::getIsDelete, TableIsDeleteEnum.NORMAL).list();
}
@Override
public List<SaasFeature> getChildByParentId(Long parentId) {
return lambdaQuery().eq(SaasFeature::getParentId,parentId)
.eq(BaseEntity::getIsDelete,TableIsDeleteEnum.NORMAL).list();
}
}

View File

@ -55,4 +55,17 @@ public interface PermissionPointService {
/** 根据code查询权限点, terminal可为空 **/
List<SaasFeature> listNodeWithChildrenByCode(String featureCode, String terminal);
/**
* 根据CODE查询详情
* @param code
* @return
*/
List<PermissionPointDTO> getDetailByCode(String code);
/**
* @param parentId
* @return
*/
List<PermissionPointDTO> getChildByParentId(Long parentId);
}

View File

@ -586,4 +586,18 @@ public class PermissionPointServiceImpl implements PermissionPointService {
currentFeatrureList.addAll(children);
return currentFeatrureList;
}
@Override
public List<PermissionPointDTO> getDetailByCode(String code) {
List<SaasFeature> feature = saasFeatureDao.listByCode(code);
return BeanMapper.copyList(feature, PermissionPointDTO.class);
}
@Override
public List<PermissionPointDTO> getChildByParentId(Long parentId) {
List<SaasFeature> feature = saasFeatureDao.getChildByParentId(parentId);
return BeanMapper.copyList(feature, PermissionPointDTO.class);
}
}

View File

@ -93,6 +93,10 @@ public class ProductFeatureRelationServiceImpl implements ProductFeatureRelation
@Override
public ApiResult<List<ProductFeatureRelationVO>> featureListByProduct(List<Long> productIds) {
List<SaasProductModuleFeatureRelation> list = saasProductModuleFeatureRelationDao.lambdaQuery()
.select(SaasProductModuleFeatureRelation::getFeatureId)
.select(SaasProductModuleFeatureRelation::getProductModuleId)
.select(SaasProductModuleFeatureRelation::getDictCode)
.select(SaasProductModuleFeatureRelation::getDictCodeId)
.in(SaasProductModuleFeatureRelation::getProductModuleId, productIds)
.list();
return ApiResult.ok(BeanMapper.copyList(list, ProductFeatureRelationVO.class));