当前位置:网站首页>Get tree menu list

Get tree menu list

2020-11-07 21:03:12 Maiyuweng

Get tree menu list

/**
 *  Get area tree list 
 * @return
 */
public List<MapAreaTreeVo> getAreaTreeList(){
	List<MapAreaTreeVo> arealist = areaDao.getAreaTreeList(0);
	for(MapAreaTreeVo vo :arealist){
	// Recursive loop acquisition 
		vo.setChildren(getAreaTreePidList(vo.getId()));
	}
	return arealist;
}

/**
 *  Get the tree list under the parent menu 
 * @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;
}

Entity class

public class MapAreaTreeVo {
    private Integer id;
    private Integer pid;
    private String title;
    private List<MapAreaTreeVo> children;
}

版权声明
本文为[Maiyuweng]所创,转载请带上原文链接,感谢