From a07ae49b632b81af3e8b1a4af12ea937ea8a1968 Mon Sep 17 00:00:00 2001 From: rays <1615175118@qq.com> Date: Fri, 18 Jun 2021 18:36:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=86=E7=BB=84=E6=A0=91?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resource/mapper/ApiResourceMapper.java | 13 ++++++++++ .../mapper/mapping/ApiResourceMapper.xml | 24 +++++++++++++++++++ .../resource/service/ApiResourceService.java | 11 +++++++++ .../service/impl/ApiGroupServiceImpl.java | 7 +++--- .../service/impl/ApiResourceServiceImpl.java | 7 +++++- .../service/impl/SysResourceServiceImpl.java | 3 +-- 6 files changed, 59 insertions(+), 6 deletions(-) diff --git a/kernel-s-system/system-business-resource/src/main/java/cn/stylefeng/roses/kernel/system/modular/resource/mapper/ApiResourceMapper.java b/kernel-s-system/system-business-resource/src/main/java/cn/stylefeng/roses/kernel/system/modular/resource/mapper/ApiResourceMapper.java index 4feb46a47..bc4525930 100644 --- a/kernel-s-system/system-business-resource/src/main/java/cn/stylefeng/roses/kernel/system/modular/resource/mapper/ApiResourceMapper.java +++ b/kernel-s-system/system-business-resource/src/main/java/cn/stylefeng/roses/kernel/system/modular/resource/mapper/ApiResourceMapper.java @@ -1,7 +1,11 @@ package cn.stylefeng.roses.kernel.system.modular.resource.mapper; +import cn.stylefeng.roses.kernel.system.api.pojo.resource.ApiGroupRequest; import cn.stylefeng.roses.kernel.system.modular.resource.entity.ApiResource; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 接口信息 Mapper 接口 @@ -11,4 +15,13 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; */ public interface ApiResourceMapper extends BaseMapper { + /** + * 数据列表 + * + * @param apiGroupRequest 分组请求数据 + * @return {@link java.util.List} + * @author majianguo + * @date 2021/6/18 下午6:30 + **/ + List dataList(@Param("paramCondition") ApiGroupRequest apiGroupRequest); } \ No newline at end of file diff --git a/kernel-s-system/system-business-resource/src/main/java/cn/stylefeng/roses/kernel/system/modular/resource/mapper/mapping/ApiResourceMapper.xml b/kernel-s-system/system-business-resource/src/main/java/cn/stylefeng/roses/kernel/system/modular/resource/mapper/mapping/ApiResourceMapper.xml index 9bef93389..c1ea0f7e2 100644 --- a/kernel-s-system/system-business-resource/src/main/java/cn/stylefeng/roses/kernel/system/modular/resource/mapper/mapping/ApiResourceMapper.xml +++ b/kernel-s-system/system-business-resource/src/main/java/cn/stylefeng/roses/kernel/system/modular/resource/mapper/mapping/ApiResourceMapper.xml @@ -2,4 +2,28 @@ + \ No newline at end of file diff --git a/kernel-s-system/system-business-resource/src/main/java/cn/stylefeng/roses/kernel/system/modular/resource/service/ApiResourceService.java b/kernel-s-system/system-business-resource/src/main/java/cn/stylefeng/roses/kernel/system/modular/resource/service/ApiResourceService.java index 627266993..f2f8eee00 100644 --- a/kernel-s-system/system-business-resource/src/main/java/cn/stylefeng/roses/kernel/system/modular/resource/service/ApiResourceService.java +++ b/kernel-s-system/system-business-resource/src/main/java/cn/stylefeng/roses/kernel/system/modular/resource/service/ApiResourceService.java @@ -1,6 +1,7 @@ package cn.stylefeng.roses.kernel.system.modular.resource.service; import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult; +import cn.stylefeng.roses.kernel.system.api.pojo.resource.ApiGroupRequest; import cn.stylefeng.roses.kernel.system.api.pojo.resource.ApiResourceRequest; import cn.stylefeng.roses.kernel.system.modular.resource.entity.ApiResource; import cn.stylefeng.roses.kernel.system.modular.resource.entity.ApiResourceField; @@ -95,4 +96,14 @@ public interface ApiResourceService extends IService { * @date 2021/5/27 下午3:34 **/ ApiResource reset(ApiResourceRequest apiResourceRequest); + + /** + * 数据列表 + * + * @param apiGroupRequest 分组请求数据 + * @return {@link java.util.List} + * @author majianguo + * @date 2021/6/18 下午6:28 + **/ + List dataList(ApiGroupRequest apiGroupRequest); } \ No newline at end of file diff --git a/kernel-s-system/system-business-resource/src/main/java/cn/stylefeng/roses/kernel/system/modular/resource/service/impl/ApiGroupServiceImpl.java b/kernel-s-system/system-business-resource/src/main/java/cn/stylefeng/roses/kernel/system/modular/resource/service/impl/ApiGroupServiceImpl.java index abb73f357..ce01df657 100644 --- a/kernel-s-system/system-business-resource/src/main/java/cn/stylefeng/roses/kernel/system/modular/resource/service/impl/ApiGroupServiceImpl.java +++ b/kernel-s-system/system-business-resource/src/main/java/cn/stylefeng/roses/kernel/system/modular/resource/service/impl/ApiGroupServiceImpl.java @@ -176,6 +176,7 @@ public class ApiGroupServiceImpl extends ServiceImpl i Map stringSysResourceMap = new HashMap<>(); LambdaQueryWrapper sysResourceLambdaQueryWrapper = new LambdaQueryWrapper<>(); sysResourceLambdaQueryWrapper.eq(SysResource::getViewFlag, YesOrNotEnum.N.getCode()); + List sysResources = this.sysResourceService.list(sysResourceLambdaQueryWrapper); for (SysResource sysResource : sysResources) { stringSysResourceMap.put(sysResource.getResourceCode(), sysResource); @@ -204,8 +205,8 @@ public class ApiGroupServiceImpl extends ServiceImpl i } } - // 查询所有资源 - List apiResourceList = this.apiResourceService.list(); + // 查询资源 + List apiResourceList = this.apiResourceService.dataList(apiGroupRequest); if (ObjectUtil.isNotEmpty(apiResourceList)) { for (ApiResource apiResource : apiResourceList) { ApiGroupTreeWrapper item = new ApiGroupTreeWrapper(); @@ -219,8 +220,8 @@ public class ApiGroupServiceImpl extends ServiceImpl i SysResource sysResource = stringSysResourceMap.get(apiResource.getResourceCode()); if (ObjectUtil.isNotEmpty(sysResource)) { item.setUrl(sysResource.getUrl()); + allApiGroupTreeWrapperList.add(item); } - allApiGroupTreeWrapperList.add(item); } } return allApiGroupTreeWrapperList; diff --git a/kernel-s-system/system-business-resource/src/main/java/cn/stylefeng/roses/kernel/system/modular/resource/service/impl/ApiResourceServiceImpl.java b/kernel-s-system/system-business-resource/src/main/java/cn/stylefeng/roses/kernel/system/modular/resource/service/impl/ApiResourceServiceImpl.java index 7f6539cb4..f9ad7f7f6 100644 --- a/kernel-s-system/system-business-resource/src/main/java/cn/stylefeng/roses/kernel/system/modular/resource/service/impl/ApiResourceServiceImpl.java +++ b/kernel-s-system/system-business-resource/src/main/java/cn/stylefeng/roses/kernel/system/modular/resource/service/impl/ApiResourceServiceImpl.java @@ -13,6 +13,7 @@ import cn.stylefeng.roses.kernel.scanner.api.pojo.resource.FieldMetadata; import cn.stylefeng.roses.kernel.scanner.api.pojo.resource.ResourceDefinition; import cn.stylefeng.roses.kernel.system.api.exception.SystemModularException; import cn.stylefeng.roses.kernel.system.api.exception.enums.resource.ApiResourceExceptionEnum; +import cn.stylefeng.roses.kernel.system.api.pojo.resource.ApiGroupRequest; import cn.stylefeng.roses.kernel.system.api.pojo.resource.ApiResourceFieldRequest; import cn.stylefeng.roses.kernel.system.api.pojo.resource.ApiResourceRequest; import cn.stylefeng.roses.kernel.system.modular.resource.entity.ApiGroup; @@ -318,7 +319,6 @@ public class ApiResourceServiceImpl extends ServiceImpl dataList(ApiGroupRequest apiGroupRequest) { + return this.baseMapper.dataList(apiGroupRequest); + } + @Override public List findList(ApiResourceRequest apiResourceRequest) { LambdaQueryWrapper wrapper = this.createWrapper(apiResourceRequest); diff --git a/kernel-s-system/system-business-resource/src/main/java/cn/stylefeng/roses/kernel/system/modular/resource/service/impl/SysResourceServiceImpl.java b/kernel-s-system/system-business-resource/src/main/java/cn/stylefeng/roses/kernel/system/modular/resource/service/impl/SysResourceServiceImpl.java index 86f05f025..a503cc0de 100644 --- a/kernel-s-system/system-business-resource/src/main/java/cn/stylefeng/roses/kernel/system/modular/resource/service/impl/SysResourceServiceImpl.java +++ b/kernel-s-system/system-business-resource/src/main/java/cn/stylefeng/roses/kernel/system/modular/resource/service/impl/SysResourceServiceImpl.java @@ -205,8 +205,7 @@ public class SysResourceServiceImpl extends ServiceImpl allResource = this.list(sysResourceLambdaQueryWrapper);