| | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | public class SystemMenuBizImpl implements SystemMenuBiz { |
| | |
| | | public List<SystemMenuListVO> findTreeByType(Integer type) { |
| | | List<SystemMenuListVO> menus = systemMenuService.findList(type); |
| | | List<SystemMenuListVO> rootMenus = new ArrayList<>(); |
| | | if(type.equals(Constants.ONE)){ |
| | | menus = menus.stream().filter(m->!m.getDisabled()).collect(Collectors.toList()); |
| | | } |
| | | // 添加根菜单 |
| | | for (SystemMenu menu : menus) { |
| | | |
| | | if (menu.getParentId() == null) { |
| | | SystemMenuListVO rootMenu = new SystemMenuListVO(); |
| | | BeanUtils.copyProperties(menu, rootMenu, "children"); |
| | |
| | | SystemMenu systemMenu = new SystemMenu(); |
| | | systemMenu.setType(type); |
| | | systemMenu.setDeleted(Boolean.FALSE); |
| | | systemMenu.setDisabled(Boolean.FALSE); |
| | | menus = systemMenuService.findList(systemMenu); |
| | | } |
| | | } |