当前位置:网站首页>Create a tree structure
Create a tree structure
2022-08-03 04:41:00 【Dzooooone_】
//Create a tree structurepublic List buildTree() {List treeMenus = new ArrayList<>();for (BasicMenuInfoVo menuNode : getRootNode()) {menuNode = buildChildTree(menuNode);treeMenus.add(menuNode);}return treeMenus;}//get root nodeprivate List getRootNode() {List rootMenuLists = new ArrayList<>();for (BasicMenuInfoVo menuNode : menuList) {if (menuNode.getParentId().longValue() == 0) {menuNode.setAccess(permissionMap.get(menuNode.getPermissionId()));if (flag == 0) rootMenuLists.add(menuNode);if (flag == 1 && menuNode.getState() == 1) rootMenuLists.add(menuNode);}}return rootMenuLists;}// recursively, create a subtree structureprivate BasicMenuInfoVo buildChildTree(BasicMenuInfoVo pNode) {List childMenus = new ArrayList<>();for (BasicMenuInfoVo menuNode : menuList) {if (menuNode.getParentId().longValue() == pNode.getId().longValue()) {menuNode.setAccess(permissionMap.get(menuNode.getPermissionId()));if (flag == 0) childMenus.add(buildChildTree(menuNode));if (flag == 1 && menuNode.getState() == 1) childMenus.add(buildChildTree(menuNode));}}pNode.setRoutes(childMenus);return pNode;} 边栏推荐
猜你喜欢

Interface test practice | Detailed explanation of the difference between GET / POST requests

【软件工程之美 - 专栏笔记】35 | 版本发布:软件上线只是新的开始

传统企业如何转型社交电商,泰山众筹的玩法有哪些?

4.深度学习的几何解释与梯度的优化

GIS数据漫谈(六)— 投影坐标系统

How to use the interface management tool YApi?Beautiful, easy to manage, super easy to use

【Harmony OS】【FAQ】Hongmeng Questions Collection 1

DDL操作数据库、表、列

Record some bugs encountered - when mapstruct and lombok are used at the same time, the problem of data loss when converting entity classes

Interface Test Framework Practice | Process Encapsulation and Test Case Design Based on Encrypted Interface
随机推荐
刚上线就狂吸70W粉,新型商业模式“分享购”来了,你知道吗?
Jmeter 模拟多用户登录的两种方法
Interface Test Framework Practice (4) | Get Schema Assertion
MCM箱模型建模方法及大气O3来源解析
接口测试框架实战(四)| 搞定 Schema 断言
mysql bool blind
刚上线就狂吸70W粉,新型商业模式“分享购”来了,你知道吗?
MySQL 入门:Case 语句很好用
接口测试如何准备测试数据
DDL操作数据库、表、列
普乐蛙VR台风体验馆厂家VR防震减灾模拟VR沉浸式体验设备
「短视频+社交电商」营销模式爆发式发展,带来的好处有什么?
多肽介导PEG磷脂——靶向功能材料之DSPE-PEG-RGD/TAT/NGR/APRPG
Two ways to simulate multi-user login in Jmeter
探索性测试的概念及方法
OpenFOAM提取等职面并计算面积
深圳线下报名|StarRocks on AWS:如何对实时数仓进行极速统一分析
Harmony OS ets ArkUI 】 【 】 the development basic page layout and data connection
excerpt from compilation book
【Harmony OS】【ARK UI】Date 基本操作