部门树结构下拉框 java_下拉列表树形结构

@RequestMapping("/combolist")public voidcombolist(HttpServletRequest request,HttpServletResponse response){

List list = null;

Map params = new HashMap();

HashMap dataMap = new HashMap();//查询列表

list = this.sysMenuService.list(params);

List menuList= new ArrayList();//根菜单

HashMap menuRootMap = new HashMap<>();

ArrayList> modalArray = new ArrayList>();for(SysMenu menuParent : list){if(menuParent.getParentid() == null || menuParent.getParentid() == 0){

menuRootMap.put("id", menuParent.getId());

menuRootMap.put("text", menuParent.getName());

}//二级模块

if(menuParent.getParentid() == 13){

HashMap menuParentMap = new HashMap();

ArrayList> childrenList = new ArrayList>() ;

menuParentMap.put("id", menuParent.getId());

menuParentMap.put("text", menuParent.getName());//菜单

for(SysMenu menuChildren : list){if(menuChildren.getParentid().intValue() ==menuParent.getId().intValue()){

HashMap menuChildrenMap = new HashMap<>();

menuChildrenMap.put("id", menuChildren.getId());

menuChildrenMap.put("text", menuChildren.getName());

childrenList.add(menuChildrenMap);

}

}

menuParentMap.put("children", childrenList);

modalArray.add(menuParentMap);

}

}

menuRootMap.put("children", modalArray);

menuList.add(menuRootMap);//HashMap messageMap = new HashMap();//messageMap.put("rows", list);//this.out(response, messageMap);

this.webOut(response, menuList);return;

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值