| | |
| | | import com.doumee.biz.system.SystemMenuBiz; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.dao.system.dto.UpdateSystemMenuSortDTO; |
| | | import com.doumee.dao.system.model.SystemMenu; |
| | | import com.doumee.dao.system.vo.SystemMenuListVO; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<SystemMenuListVO> findTree() { |
| | | List<SystemMenuListVO> menus = systemMenuService.findList(); |
| | | public List<SystemMenu> findTopList() { |
| | | SystemMenu param =new SystemMenu(); |
| | | param.setDeleted(Boolean.FALSE); |
| | | param.setType(Constants.ONE); |
| | | List<SystemMenu> menus = systemMenuService.findList(param); |
| | | return menus; |
| | | } |
| | | @Override |
| | | public List<SystemMenuListVO> findTree(SystemMenu param) { |
| | | List<SystemMenuListVO> menus = systemMenuService.findManageList(param); |
| | | List<SystemMenuListVO> rootMenus = new ArrayList<>(); |
| | | // 添加根菜单 |
| | | for (SystemMenu menu : menus) { |
| | | for (SystemMenuListVO menu : menus) { |
| | | if (menu.getParentId() == null) { |
| | | SystemMenuListVO rootMenu = new SystemMenuListVO(); |
| | | BeanUtils.copyProperties(menu, rootMenu, "children"); |
| | |
| | | nodeVO.setLabel(menu.getName()); |
| | | nodeVO.setUrl(menu.getPath()); |
| | | nodeVO.setParams(menu.getParams()); |
| | | nodeVO.setType(menu.getType()); |
| | | nodeVO.setLinkType(menu.getLinkType()); |
| | | nodeVO.setIcon(menu.getIcon()); |
| | | // nodeVO.setHomeUrl("/index");//默认工作台 |
| | | nodeVO.setChildren(new ArrayList<>()); |
| | | rootNodes.add(nodeVO); |
| | | } |
| | |
| | | menus.removeIf(menu -> menu.getParentId() == null); |
| | | for (SystemMenuNodeVO child : rootNodes) { |
| | | this.fillChildren(child, menus); |
| | | SystemMenuNodeVO homeMenus = getHomeUrlByChild(child); |
| | | if(homeMenus!=null && homeMenus.getUrl() != null){ |
| | | child.setHomeUrl(homeMenus.getUrl()); |
| | | } |
| | | } |
| | | return rootNodes; |
| | | } |
| | | |
| | | private SystemMenuNodeVO getHomeUrlByChild( SystemMenuNodeVO child) { |
| | | if(child.getChildren()==null || child.getChildren().size() ==0){ |
| | | return null; |
| | | } |
| | | for(SystemMenuNodeVO tt : child.getChildren()){ |
| | | if(tt.getChildren()==null || tt.getChildren().size() ==0){ |
| | | return tt; |
| | | }else{ |
| | | SystemMenuNodeVO ttt = getHomeUrlByChild(tt); |
| | | return ttt; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | List<Integer> handledIds = new ArrayList<>(); |
| | | for (SystemMenu menu : menus) { |
| | | if(!Constants.equalsInteger(menu.getType(),Constants.ZERO)){ |
| | | continue; |
| | | } |
| | | if (parent.getId().equals(menu.getParentId())) { |
| | | SystemMenuListVO child = new SystemMenuListVO(); |
| | | BeanUtils.copyProperties(menu, child, "children"); |
| | |
| | | } |
| | | List<Integer> handledIds = new ArrayList<>(); |
| | | for (SystemMenu menu : menus) { |
| | | if(!Constants.equalsInteger(menu.getType(),Constants.ZERO)){ |
| | | continue; |
| | | } |
| | | if (parent.getId().equals(menu.getParentId())) { |
| | | SystemMenuNodeVO child = new SystemMenuNodeVO(); |
| | | child.setId(menu.getId()); |
| | |
| | | child.setUrl(menu.getPath()); |
| | | child.setParams(menu.getParams()); |
| | | child.setIcon(menu.getIcon()); |
| | | child.setType(menu.getType()); |
| | | child.setLinkType(menu.getLinkType()); |
| | | child.setIndex("menu_" + menu.getId()); |
| | | child.setChildren(new ArrayList<>()); |
| | | parent.getChildren().add(child); |