mirror of https://gitee.com/stylefeng/roses
【7.6.0】【sys】【menu】初始化获取菜单应用组接口
parent
763532402c
commit
c9180272f4
|
@ -1,6 +1,5 @@
|
|||
package cn.stylefeng.roses.kernel.sys.modular.menu.controller;
|
||||
|
||||
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
||||
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
|
||||
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
|
||||
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
|
||||
|
@ -8,6 +7,7 @@ import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
|
|||
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
|
||||
import cn.stylefeng.roses.kernel.sys.modular.menu.entity.SysMenu;
|
||||
import cn.stylefeng.roses.kernel.sys.modular.menu.pojo.request.SysMenuRequest;
|
||||
import cn.stylefeng.roses.kernel.sys.modular.menu.pojo.response.AppGroupDetail;
|
||||
import cn.stylefeng.roses.kernel.sys.modular.menu.service.SysMenuService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
@ -17,18 +17,30 @@ import javax.annotation.Resource;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统菜单控制器
|
||||
* 菜单管理界面的接口
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2023/06/10 21:28
|
||||
* @since 2023/6/14 21:29
|
||||
*/
|
||||
@RestController
|
||||
@ApiResource(name = "系统菜单")
|
||||
@ApiResource(name = "菜单管理界面的接口")
|
||||
public class SysMenuController {
|
||||
|
||||
@Resource
|
||||
private SysMenuService sysMenuService;
|
||||
|
||||
/**
|
||||
* 获取菜单管理界面的每个应用组下的菜单信息
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2023/06/10 21:28
|
||||
*/
|
||||
@GetResource(name = "获取菜单管理界面的每个应用组下的菜单信息", path = "/sysMenu/getAppMenuGroupDetail")
|
||||
public ResponseData<List<AppGroupDetail>> getAppMenuGroupDetail(SysMenuRequest sysMenuRequest) {
|
||||
List<AppGroupDetail> appGroupDetails = sysMenuService.getAppMenuGroupDetail(sysMenuRequest);
|
||||
return new SuccessResponseData<>(appGroupDetails);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
|
@ -76,26 +88,4 @@ public class SysMenuController {
|
|||
return new SuccessResponseData<>(sysMenuService.detail(sysMenuRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取列表
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2023/06/10 21:28
|
||||
*/
|
||||
@GetResource(name = "获取列表", path = "/sysMenu/list")
|
||||
public ResponseData<List<SysMenu>> list(SysMenuRequest sysMenuRequest) {
|
||||
return new SuccessResponseData<>(sysMenuService.findList(sysMenuRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取列表(带分页)
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2023/06/10 21:28
|
||||
*/
|
||||
@GetResource(name = "分页查询", path = "/sysMenu/page")
|
||||
public ResponseData<PageResult<SysMenu>> page(SysMenuRequest sysMenuRequest) {
|
||||
return new SuccessResponseData<>(sysMenuService.findPage(sysMenuRequest));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package cn.stylefeng.roses.kernel.sys.modular.menu.pojo.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用在菜单界面
|
||||
* <p>
|
||||
* 响应应用组下的应用信息,应用信息包含:应用名称、logo、应用说明、菜单列表(树形)
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @since 2023/6/14 21:34
|
||||
*/
|
||||
@Data
|
||||
public class AppGroupDetail {
|
||||
|
||||
/**
|
||||
* 应用id
|
||||
*/
|
||||
private Long appId;
|
||||
|
||||
/**
|
||||
* 应用名称
|
||||
*/
|
||||
private String appName;
|
||||
|
||||
/**
|
||||
* 应用图标的文件id
|
||||
*/
|
||||
private Long appIcon;
|
||||
|
||||
/**
|
||||
* 应用说明
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 应用下的菜单列表
|
||||
*/
|
||||
private List<MenuItemDetail> menuList;
|
||||
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
package cn.stylefeng.roses.kernel.sys.modular.menu.pojo.response;
|
||||
|
||||
import cn.stylefeng.roses.kernel.rule.tree.factory.base.AbstractTreeNode;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用在菜单列表界面,描述菜单树上的菜单详情
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @since 2023/6/14 21:37
|
||||
*/
|
||||
@Data
|
||||
public class MenuItemDetail implements AbstractTreeNode<MenuItemDetail> {
|
||||
|
||||
/**
|
||||
* 菜单id
|
||||
*/
|
||||
private Long menuId;
|
||||
|
||||
/**
|
||||
* 菜单父级id
|
||||
*/
|
||||
private Long menuParentId;
|
||||
|
||||
/**
|
||||
* 菜单名称
|
||||
*/
|
||||
private String menuName;
|
||||
|
||||
/**
|
||||
* 菜单类型:10-后台菜单,20-纯前台路由界面,30-内部链接,40-外部链接
|
||||
*/
|
||||
private Integer menuType;
|
||||
|
||||
/**
|
||||
* 菜单的子菜单
|
||||
*/
|
||||
private List<MenuItemDetail> children;
|
||||
|
||||
@Override
|
||||
public String getNodeId() {
|
||||
if (menuId != null) {
|
||||
return menuId.toString();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNodeParentId() {
|
||||
if (menuParentId != null) {
|
||||
return menuParentId.toString();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChildrenNodes(List<MenuItemDetail> childrenNodes) {
|
||||
this.children = childrenNodes;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
package cn.stylefeng.roses.kernel.sys.modular.menu.service;
|
||||
|
||||
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
||||
import cn.stylefeng.roses.kernel.sys.modular.menu.entity.SysMenu;
|
||||
import cn.stylefeng.roses.kernel.sys.modular.menu.pojo.request.SysMenuRequest;
|
||||
import cn.stylefeng.roses.kernel.sys.modular.menu.pojo.response.AppGroupDetail;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -53,24 +53,12 @@ public interface SysMenuService extends IService<SysMenu> {
|
|||
SysMenu detail(SysMenuRequest sysMenuRequest);
|
||||
|
||||
/**
|
||||
* 获取列表
|
||||
* 获取菜单管理界面的每个应用组下的菜单信息
|
||||
*
|
||||
* @param sysMenuRequest 请求参数
|
||||
* @return List<SysMenu> 返回结果
|
||||
* @author fengshuonan
|
||||
* @date 2023/06/10 21:28
|
||||
*/
|
||||
List<SysMenu> findList(SysMenuRequest sysMenuRequest);
|
||||
|
||||
/**
|
||||
* 获取列表(带分页)
|
||||
*
|
||||
* @param sysMenuRequest 请求参数
|
||||
* @return PageResult<SysMenu> 返回结果
|
||||
* @author fengshuonan
|
||||
* @date 2023/06/10 21:28
|
||||
*/
|
||||
PageResult<SysMenu> findPage(SysMenuRequest sysMenuRequest);
|
||||
List<AppGroupDetail> getAppMenuGroupDetail(SysMenuRequest sysMenuRequest);
|
||||
|
||||
/**
|
||||
* 校验菜单是否绑定到某个app下
|
||||
|
|
|
@ -2,21 +2,19 @@ package cn.stylefeng.roses.kernel.sys.modular.menu.service.impl;
|
|||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.stylefeng.roses.kernel.db.api.factory.PageFactory;
|
||||
import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory;
|
||||
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
||||
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
|
||||
import cn.stylefeng.roses.kernel.sys.modular.menu.entity.SysMenu;
|
||||
import cn.stylefeng.roses.kernel.sys.modular.menu.enums.SysMenuExceptionEnum;
|
||||
import cn.stylefeng.roses.kernel.sys.modular.menu.mapper.SysMenuMapper;
|
||||
import cn.stylefeng.roses.kernel.sys.modular.menu.pojo.request.SysMenuRequest;
|
||||
import cn.stylefeng.roses.kernel.sys.modular.menu.pojo.response.AppGroupDetail;
|
||||
import cn.stylefeng.roses.kernel.sys.modular.menu.service.SysMenuService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -54,13 +52,6 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
return this.querySysMenu(sysMenuRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<SysMenu> findPage(SysMenuRequest sysMenuRequest) {
|
||||
LambdaQueryWrapper<SysMenu> wrapper = createWrapper(sysMenuRequest);
|
||||
Page<SysMenu> sysRolePage = this.page(PageFactory.defaultPage(), wrapper);
|
||||
return PageResultFactory.createPageResult(sysRolePage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validateMenuBindApp(Set<Long> appIdList) {
|
||||
|
||||
|
@ -86,9 +77,9 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<SysMenu> findList(SysMenuRequest sysMenuRequest) {
|
||||
public List<AppGroupDetail> getAppMenuGroupDetail(SysMenuRequest sysMenuRequest) {
|
||||
LambdaQueryWrapper<SysMenu> wrapper = this.createWrapper(sysMenuRequest);
|
||||
return this.list(wrapper);
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue