Search in sources :

Example 1 with MenuMetaVO

use of com.hb0730.boot.admin.project.system.menu.model.vo.MenuMetaVO in project boot-admin by hb0730.

the class MenuServiceImpl method buildVueMenus.

@Override
public List<VueMenuVO> buildVueMenus(List<TreeMenuDTO> treeMenu) {
    List<VueMenuVO> list = new LinkedList<>();
    treeMenu.forEach(menu -> {
        if (null != menu) {
            VueMenuVO menuVO = new VueMenuVO();
            // 组件名称
            menuVO.setName(menu.getEnname());
            // 地址
            menuVO.setPath(menu.getPath());
            // 判断外链
            if (menu.isExternal()) {
                menuVO.setName(menu.getPath());
                menuVO.setPath(ROOT_PATH + menu.getEnname());
            }
            // 判断组件
            if (StrUtil.isNotBlank(menu.getComponent())) {
                menuVO.setComponent(menu.getComponent());
            } else if (!menu.isExternal()) {
                menuVO.setComponent("Layout");
            }
            // meta
            MenuMetaVO metaVO = new MenuMetaVO();
            metaVO.setTitle(menu.getTitle());
            metaVO.setIcon(menu.getIcon());
            metaVO.setShowLink(menu.isShowLink());
            metaVO.setI18n(menu.isI18n());
            metaVO.setKeepAlive(menu.isCache());
            metaVO.setRank(menu.getSort());
            metaVO.setShowParent(menu.isShowParent());
            metaVO.setAuthority(menu.getAuthority());
            // iframe
            if (menu.isIframe()) {
                metaVO.setFrameSrc(menu.getPath());
            }
            menuVO.setMeta(metaVO);
            List<TreeMenuDTO> children = menu.getChildren();
            if (CollectionUtil.isNotEmpty(children)) {
                menuVO.setRedirect(children.get(0).getPath());
                menuVO.setChildren(buildVueMenus(children));
            }
            list.add(menuVO);
        }
    });
    return list;
}
Also used : TreeMenuDTO(com.hb0730.boot.admin.project.system.menu.model.dto.TreeMenuDTO) MenuMetaVO(com.hb0730.boot.admin.project.system.menu.model.vo.MenuMetaVO) VueMenuVO(com.hb0730.boot.admin.project.system.menu.model.vo.VueMenuVO) LinkedList(java.util.LinkedList)

Aggregations

TreeMenuDTO (com.hb0730.boot.admin.project.system.menu.model.dto.TreeMenuDTO)1 MenuMetaVO (com.hb0730.boot.admin.project.system.menu.model.vo.MenuMetaVO)1 VueMenuVO (com.hb0730.boot.admin.project.system.menu.model.vo.VueMenuVO)1 LinkedList (java.util.LinkedList)1