【7.6.0】【sys】【menu】初始化获取菜单应用组接口

pull/55/MERGE
fengshuonan 2023-06-14 21:43:36 +08:00
parent 763532402c
commit c9180272f4
5 changed files with 129 additions and 54 deletions

View File

@ -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));
}
}

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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

View File

@ -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<>();
}
/**