Example #1
0
 public static TreeJson getMenuTree() {
   @SuppressWarnings("unchecked")
   List<TreeJson> tList = (List<TreeJson>) getCache(CACHE_MENU_TREE);
   if (tList == null) {
     SysUser sysUser = getUser();
     List<SysMenu> mList = sysMenuMapper.findSysMenuTree(sysUser);
     tList = new ArrayList<TreeJson>();
     for (int i = 0; i < mList.size(); i++) {
       TreeJson tj = new TreeJson();
       tj.setId(mList.get(i).getId());
       tj.setPid(mList.get(i).getParentid());
       tj.setText(mList.get(i).getName());
       Attributes attributes = new Attributes();
       attributes.setUrl(mList.get(i).getUrl());
       attributes.setIcon(mList.get(i).getIcon());
       tj.setAttributes(attributes);
       tList.add(tj);
     }
   }
   TreeJson root = new TreeJson();
   root.setText("导航菜单");
   root.setId(StringConstant.ROOT_ID_32);
   TreeJson.getTree(tList, root);
   tList.clear();
   tList.add(root);
   putCache(CACHE_MENU_TREE, root);
   return root;
 }
Example #2
0
 /**
  * 获取当前用户授权菜单
  *
  * @return
  */
 public static List<SysMenu> getMenuList() {
   @SuppressWarnings("unchecked")
   List<SysMenu> menuList = (List<SysMenu>) getCache(CACHE_MENU_LIST);
   if (menuList == null) {
     SysUser sysUser = getUser();
     menuList = sysMenuMapper.findSysMenuTree(sysUser);
     putCache(CACHE_MENU_LIST, menuList);
   }
   return menuList;
 }