| | |
| | | package com.consum.base.service; |
| | | |
| | | import com.consum.base.Constants; |
| | | import com.consum.base.core.utils.IdUtil; |
| | | import com.consum.base.pojo.BaseCategoryParam; |
| | | import com.consum.base.pojo.ProjectTreeResult; |
| | | import com.consum.base.core.utils.IdUtil; |
| | | import com.consum.model.po.BaseCategory; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.db.page.GenericPager; |
| | |
| | | //1级分类 |
| | | List<ProjectTreeResult> menus = all.stream().filter(entity -> entity.getLevels() == 1).map(entity -> { |
| | | ProjectTreeResult projectTreeResult = new ProjectTreeResult(entity); |
| | | projectTreeResult.setChildren(getChildren(projectTreeResult, all)); |
| | | if (getChildren(projectTreeResult, all).isEmpty()) { |
| | | projectTreeResult.setChildren(null); |
| | | } else { |
| | | projectTreeResult.setChildren(getChildren(projectTreeResult, all)); |
| | | } |
| | | return projectTreeResult; |
| | | }).sorted(Comparator.comparingInt(menu -> (menu.getSort() == null ? 0 : menu.getSort()))).collect(Collectors.toList()); |
| | | return menus; |
| | |
| | | |
| | | ProjectTreeResult projectTreeResult = new ProjectTreeResult(entity); |
| | | //通过递归找到子分类 |
| | | projectTreeResult.setChildren(getChildren(projectTreeResult, all)); |
| | | if (getChildren(projectTreeResult, all).isEmpty()) { |
| | | projectTreeResult.setChildren(null); |
| | | } else { |
| | | projectTreeResult.setChildren(getChildren(projectTreeResult, all)); |
| | | } |
| | | return projectTreeResult; |
| | | }).sorted(Comparator.comparingInt(menu -> (menu.getSort() == null ? 0 : menu.getSort()))).collect(Collectors.toList()); |
| | | return children; |