当前位置:网站首页>获取树形菜单列表
获取树形菜单列表
2020-11-07 21:03:00 【麦漁翁】
获取树形菜单列表
/**
* 获取区域树形列表
* @return
*/
public List<MapAreaTreeVo> getAreaTreeList(){
List<MapAreaTreeVo> arealist = areaDao.getAreaTreeList(0);
for(MapAreaTreeVo vo :arealist){
//递归循环获取
vo.setChildren(getAreaTreePidList(vo.getId()));
}
return arealist;
}
/**
* 获取父菜单下的树形列表
* @param pid
* @return
*/
public List<MapAreaTreeVo> getAreaTreePidList(Integer pid){
List<MapAreaTreeVo> mapAreaTreeVoList = areaDao.getAreaTreeList(pid);
if(null!=mapAreaTreeVoList && mapAreaTreeVoList.size()>0){
for(MapAreaTreeVo vo:mapAreaTreeVoList){
vo.setChildren(getAreaTreePidList(vo.getId()));
}
}
return mapAreaTreeVoList;
}
实体类
public class MapAreaTreeVo {
private Integer id;
private Integer pid;
private String title;
private List<MapAreaTreeVo> children;
}
版权声明
本文为[麦漁翁]所创,转载请带上原文链接,感谢
https://my.oschina.net/u/3204029/blog/4707687
边栏推荐
- 编程界大佬教你:一行Python代码能做出哪些神奇的事情?
- Principles of websocket + probuf
- android基础-RadioButton(单选按钮)
- Exploration and practice of growingio responsive programming
- 如何以计算机的方式去思考
- 全网最硬核讲解计算机启动流程
- 计组-总线通信控制之异步串行通信的数据传输
- easyui dialog“缓存问题”
- Web API series (3) unified exception handling
- Dynamic programming -- state compression DP of set represented by binary
猜你喜欢
Using thread communication to solve the problem of cache penetrating database avalanche
bgfx编译教程
一万四千字分布式事务原理解析,全部掌握你还怕面试被问?
Reflection on a case of bus card being stolen and swiped
Three steps, one pit, five steps and one thunder, how to lead the technical team under the rapid growth?
The samesite problem of cross domain cookie of Chrome browser results in abnormal access to iframe embedded pages
android基础-RadioButton(单选按钮)
Improvement of maintenance mode of laravel8 update
How to choose a good company
年薪90万程序员不如月入3800公务员?安稳与高收入,到底如何选择?
随机推荐
Thinkphp6中where条件中字段与字段比较条件的写法
What do you think of the most controversial programming ideas?
使用 Xunit.DependencyInjection 改造测试项目
Using thread communication to solve the problem of cache penetrating database avalanche
sed之查找替换
awk实现类sql的join操作
go wire 依赖注入入门
AFO记
What kind of technical ability should a programmer who has worked for 1-3 years? How to improve?
Summary of the resumption of a 618 promotion project
如何高效的学习技术
华为HCIA笔记
在 Amazon SageMaker 管道模式下使用 Horovod 实现多 GPU 分布式训练
awk实现类sql的join操作
Advanced concurrent programming series 9 (lock interface analysis)
Using pipe() to improve code readability in pandas
The samesite problem of cross domain cookie of Chrome browser results in abnormal access to iframe embedded pages
三步一坑五步一雷,高速成长下的技术团队怎么带?
How to learn technology efficiently
手撕算法-手写单例模式