use of com.hb0730.commons.lang.constants.PathConst.ROOT_PATH 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;
}
Aggregations