@At("/editMenu/?")
@Ok("beetl:/platform/sys/role/editMenu.html")
@RequiresAuthentication
public Object editMenu(String roleId, HttpServletRequest req) {
System.out.println(roleId);
List<Sys_menu> list = menuService.query(Cnd.orderBy().asc("location").asc("path"));
List<Sys_menu> datas = roleService.getDatas(roleId);
Map<String,Sys_menu> datasMap = new HashMap<>();
Set parentSet = new HashSet<>();
for(Sys_menu sys_menu : datas)
{
datasMap.put(sys_menu.getId(), sys_menu);
}
List<NutMap> menus = new ArrayList<>();
Map selectMap = new HashMap<>();
selectMap.put("selected", true);
for (Sys_menu menu : list) {
NutMap map = new NutMap();
map.put("id", menu.getId());
map.put("text", menu.getName());
map.put("icon", Strings.sBlank(menu.getIcon()));
map.put("parent", "".equals(Strings.sNull(menu.getParentId())) ? "#" : menu.getParentId());
map.put("data", menu.getHref());
if(datasMap.containsKey(menu.getId()))
{
map.put("state" , selectMap);
}
menus.add(map);
}
req.setAttribute("menus", Json.toJson(menus));
return Strings.isBlank(roleId) ? null : roleService.fetch(roleId);
}
添加回复
请先登陆