Esempio n. 1
0
 /**
  * 菜单管理入口。
  *
  * @param map ModelMap
  * @return String
  */
 @RequestMapping("menuManage.do")
 public String init(ModelMap map) {
   List<Menu> menuList = this.menuService.list(Order.ASC("sortNo"), Order.ASC("name"));
   List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
   HashMap<String, Object> mtop = new HashMap<String, Object>();
   mtop.put("name", "菜单树");
   mtop.put("id", "0");
   mtop.put("pId", "");
   mtop.put("sortNo", 1);
   mtop.put("open", true);
   list.add(mtop);
   String rootCode = this.getUser().getOrgId();
   String userCode = this.getUser().getLoginId();
   for (Menu menu : menuList) {
     if (rootCode.equals(menu.getSjssjgDm())
         || StringUtil.isEmpty(menu.getSjssjgDm())
         || "1".equals(menu.getSjssjgDm())
         || "supadmin".equals(userCode)
         || "244000000".equals(rootCode)) {
       HashMap<String, Object> m = new HashMap<String, Object>();
       m.put("name", menu.getName());
       m.put("id", menu.getId());
       if ((menu.getParentId() != null) && (!"".equals(menu.getParentId()))) {
         m.put("pId", menu.getParentId());
       } else {
         m.put("pId", "0");
       }
       m.put("sortNo", menu.getSortNo());
       list.add(m);
     }
   }
   map.put("treeList", list);
   map.put("rootCode", rootCode);
   map.put("userCode", userCode);
   map.put("menu", new Menu());
   return "admin/menuManage";
 }
Esempio n. 2
0
 /**
  * 获取菜单详细信息。
  *
  * @param id String
  * @return Menu
  */
 @RequestMapping(value = "menuManage.do", params = "getMenuDetail", produces = "application/json")
 @ResponseBody
 public Menu getMenuDetile(@RequestParam String id) {
   if (!"0".equals(id)) {
     Menu menu = this.menuService.find(id);
     if (!"0".equals(menu.getParentId()) && menu.getParentId() != null) {
       Menu parent = this.menuService.find(menu.getParentId());
       if (parent != null) {
         menu.setParentName(parent.getName());
         menu.setParentSjssjgDm(parent.getSjssjgDm());
       }
     } else {
       menu.setParentName("菜单树");
     }
     return menu;
   }
   return null;
 }