【menu】整理菜单的几个实体名称

pull/3/head
fengshuonan 2020-12-27 18:35:19 +08:00
parent c3e1a6e698
commit 94801e4b4f
6 changed files with 36 additions and 88 deletions

View File

@ -9,7 +9,7 @@ import lombok.Data;
* @date 2020/4/17 17:35
*/
@Data
public class LoginMenuTreeNode {
public class AntdIndexMenuTreeNode {
/**
* id

View File

@ -1,52 +0,0 @@
package cn.stylefeng.roses.kernel.system.pojo.menu.tree;
import cn.stylefeng.roses.kernel.rule.abstracts.AbstractTreeNode;
import lombok.Data;
import java.util.List;
/**
*
*
* @author fengshuonan
* @date 2020/3/26 14:29
*/
@Data
public class CommonBaseTreeNode implements AbstractTreeNode {
/**
* id
*/
private Long id;
/**
* id
*/
private Long pid;
/**
*
*/
private String nodeName;
/**
*
*/
private List children;
@Override
public String getNodeId() {
return this.id.toString();
}
@Override
public String getNodeParentId() {
return this.pid.toString();
}
@Override
public void setChildrenNodes(List childrenNodes) {
this.children = childrenNodes;
}
}

View File

@ -7,13 +7,13 @@ import java.math.BigDecimal;
import java.util.List;
/**
*
*
*
* @author fengshuonan
* @date 2020/4/5 12:03
*/
@Data
public class MenuBaseTreeNode implements AbstractTreeNode {
public class MenuSelectTreeNode implements AbstractTreeNode {
/**
*

View File

@ -4,8 +4,8 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.stylefeng.roses.kernel.menu.modular.entity.SysMenu;
import cn.stylefeng.roses.kernel.rule.enums.YesOrNotEnum;
import cn.stylefeng.roses.kernel.system.enums.LinkOpenTypeEnum;
import cn.stylefeng.roses.kernel.system.pojo.menu.tree.LoginMenuTreeNode;
import cn.stylefeng.roses.kernel.system.pojo.menu.tree.MenuBaseTreeNode;
import cn.stylefeng.roses.kernel.system.pojo.menu.tree.AntdIndexMenuTreeNode;
import cn.stylefeng.roses.kernel.system.pojo.menu.tree.MenuSelectTreeNode;
import java.util.List;
@ -23,8 +23,8 @@ public class MenuFactory {
* @author fengshuonan
* @date 2020/11/23 21:54
*/
public static MenuBaseTreeNode parseMenuBaseTreeNode(SysMenu sysMenu) {
MenuBaseTreeNode menuTreeNode = new MenuBaseTreeNode();
public static MenuSelectTreeNode parseMenuBaseTreeNode(SysMenu sysMenu) {
MenuSelectTreeNode menuTreeNode = new MenuSelectTreeNode();
menuTreeNode.setId(sysMenu.getMenuId());
menuTreeNode.setParentId(sysMenu.getMenuParentId());
menuTreeNode.setValue(String.valueOf(sysMenu.getMenuId()));
@ -39,16 +39,16 @@ public class MenuFactory {
* @author fengshuonan
* @date 2020/4/17 17:53
*/
public static List<LoginMenuTreeNode> convertSysMenuToLoginMenu(List<SysMenu> sysMenuList) {
List<LoginMenuTreeNode> antDesignMenuTreeNodeList = CollectionUtil.newArrayList();
public static List<AntdIndexMenuTreeNode> convertSysMenuToLoginMenu(List<SysMenu> sysMenuList) {
List<AntdIndexMenuTreeNode> antDesignMenuTreeNodeList = CollectionUtil.newArrayList();
sysMenuList.forEach(sysMenu -> {
LoginMenuTreeNode loginMenuTreeNode = new LoginMenuTreeNode();
loginMenuTreeNode.setComponent(sysMenu.getComponent());
loginMenuTreeNode.setId(sysMenu.getMenuId());
loginMenuTreeNode.setName(sysMenu.getMenuCode());
loginMenuTreeNode.setPath(sysMenu.getRouter());
loginMenuTreeNode.setPid(sysMenu.getMenuParentId());
LoginMenuTreeNode.Meta mateItem = new LoginMenuTreeNode().new Meta();
AntdIndexMenuTreeNode antdIndexMenuTreeNode = new AntdIndexMenuTreeNode();
antdIndexMenuTreeNode.setComponent(sysMenu.getComponent());
antdIndexMenuTreeNode.setId(sysMenu.getMenuId());
antdIndexMenuTreeNode.setName(sysMenu.getMenuCode());
antdIndexMenuTreeNode.setPath(sysMenu.getRouter());
antdIndexMenuTreeNode.setPid(sysMenu.getMenuParentId());
AntdIndexMenuTreeNode.Meta mateItem = new AntdIndexMenuTreeNode().new Meta();
mateItem.setIcon(sysMenu.getIcon());
mateItem.setTitle(sysMenu.getMenuName());
mateItem.setLink(sysMenu.getLinkUrl());
@ -61,12 +61,12 @@ public class MenuFactory {
// 打开外链
mateItem.setTarget("_blank");
loginMenuTreeNode.setPath(sysMenu.getLinkUrl());
loginMenuTreeNode.setRedirect(sysMenu.getLinkUrl());
antdIndexMenuTreeNode.setPath(sysMenu.getLinkUrl());
antdIndexMenuTreeNode.setRedirect(sysMenu.getLinkUrl());
}
loginMenuTreeNode.setMeta(mateItem);
antDesignMenuTreeNodeList.add(loginMenuTreeNode);
antdIndexMenuTreeNode.setMeta(mateItem);
antDesignMenuTreeNodeList.add(antdIndexMenuTreeNode);
});
return antDesignMenuTreeNodeList;
}

View File

@ -26,8 +26,8 @@ package cn.stylefeng.roses.kernel.menu.modular.service;
import cn.stylefeng.roses.kernel.menu.modular.entity.SysMenu;
import cn.stylefeng.roses.kernel.system.pojo.menu.SysMenuRequest;
import cn.stylefeng.roses.kernel.system.pojo.menu.tree.LoginMenuTreeNode;
import cn.stylefeng.roses.kernel.system.pojo.menu.tree.MenuBaseTreeNode;
import cn.stylefeng.roses.kernel.system.pojo.menu.tree.AntdIndexMenuTreeNode;
import cn.stylefeng.roses.kernel.system.pojo.menu.tree.MenuSelectTreeNode;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
@ -112,7 +112,7 @@ public interface SysMenuService extends IService<SysMenu> {
* @author fengshuonan
* @date 2020/4/17 17:48
*/
List<LoginMenuTreeNode> getAppMenusAntDesign(String appCode);
List<AntdIndexMenuTreeNode> getAppMenusAntDesign(String appCode);
/**
*
@ -122,7 +122,7 @@ public interface SysMenuService extends IService<SysMenu> {
* @author fengshuonan
* @date 2020/3/27 15:56
*/
List<MenuBaseTreeNode> tree(SysMenuRequest sysMenuRequest);
List<MenuSelectTreeNode> tree(SysMenuRequest sysMenuRequest);
/**
*
@ -132,6 +132,6 @@ public interface SysMenuService extends IService<SysMenu> {
* @author fengshuonan
* @date 2020/4/5 15:01
*/
List<MenuBaseTreeNode> treeForGrant(SysMenuRequest sysMenuRequest);
List<MenuSelectTreeNode> treeForGrant(SysMenuRequest sysMenuRequest);
}

View File

@ -48,8 +48,8 @@ import cn.stylefeng.roses.kernel.system.exception.SystemModularException;
import cn.stylefeng.roses.kernel.system.exception.enums.SysMenuExceptionEnum;
import cn.stylefeng.roses.kernel.system.exception.enums.SysUserExceptionEnum;
import cn.stylefeng.roses.kernel.system.pojo.menu.SysMenuRequest;
import cn.stylefeng.roses.kernel.system.pojo.menu.tree.LoginMenuTreeNode;
import cn.stylefeng.roses.kernel.system.pojo.menu.tree.MenuBaseTreeNode;
import cn.stylefeng.roses.kernel.system.pojo.menu.tree.AntdIndexMenuTreeNode;
import cn.stylefeng.roses.kernel.system.pojo.menu.tree.MenuSelectTreeNode;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -180,7 +180,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
}
@Override
public List<LoginMenuTreeNode> getAppMenusAntDesign(String appCode) {
public List<AntdIndexMenuTreeNode> getAppMenusAntDesign(String appCode) {
// 获取当前用户的所有菜单
List<SysMenu> currentUserMenus = this.getCurrentUserMenus(appCode);
@ -190,21 +190,21 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
}
@Override
public List<MenuBaseTreeNode> tree(SysMenuRequest sysMenuRequest) {
List<MenuBaseTreeNode> menuTreeNodeList = CollectionUtil.newArrayList();
public List<MenuSelectTreeNode> tree(SysMenuRequest sysMenuRequest) {
List<MenuSelectTreeNode> menuTreeNodeList = CollectionUtil.newArrayList();
LambdaQueryWrapper<SysMenu> wrapper = createWrapper(sysMenuRequest);
this.list(wrapper).forEach(sysMenu -> {
MenuBaseTreeNode menuTreeNode = MenuFactory.parseMenuBaseTreeNode(sysMenu);
MenuSelectTreeNode menuTreeNode = MenuFactory.parseMenuBaseTreeNode(sysMenu);
menuTreeNodeList.add(menuTreeNode);
});
return new DefaultTreeBuildFactory<MenuBaseTreeNode>().doTreeBuild(menuTreeNodeList);
return new DefaultTreeBuildFactory<MenuSelectTreeNode>().doTreeBuild(menuTreeNodeList);
}
@Override
public List<MenuBaseTreeNode> treeForGrant(SysMenuRequest sysMenuRequest) {
List<MenuBaseTreeNode> menuTreeNodeList = CollectionUtil.newArrayList();
public List<MenuSelectTreeNode> treeForGrant(SysMenuRequest sysMenuRequest) {
List<MenuSelectTreeNode> menuTreeNodeList = CollectionUtil.newArrayList();
LambdaQueryWrapper<SysMenu> wrapper = createWrapper(sysMenuRequest);
wrapper.eq(SysMenu::getStatusFlag, StatusEnum.ENABLE.getCode());
@ -218,11 +218,11 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
}
this.list(wrapper).forEach(sysMenu -> {
MenuBaseTreeNode menuTreeNode = MenuFactory.parseMenuBaseTreeNode(sysMenu);
MenuSelectTreeNode menuTreeNode = MenuFactory.parseMenuBaseTreeNode(sysMenu);
menuTreeNodeList.add(menuTreeNode);
});
return new DefaultTreeBuildFactory<MenuBaseTreeNode>().doTreeBuild(menuTreeNodeList);
return new DefaultTreeBuildFactory<MenuSelectTreeNode>().doTreeBuild(menuTreeNodeList);
}
@Override