Пример #1
0
  /**
   * 获取指定角色的可用菜单
   *
   * @param f_role_code
   * @return
   */
  public MenuEntity getMenuTree(String f_role_code) {
    MapEntity params = new MapEntity();
    params.put("f_role_code", f_role_code);
    params.put("f_is_show", 1);
    params.setPageSizeWithMax().setOrderBy("f_parent_ids, f_order");

    List<MenuEntity> nodeTree = TreeUtil.listToTree(roleMenuMapper.selectRoleMenuListPage(params));

    return HelpUtil.isEmptyCollection(nodeTree) ? null : nodeTree.get(0);
  }
Пример #2
0
  /**
   * 获取指定用户的可用菜单
   *
   * @param f_user_id
   * @return
   */
  public MenuEntity getMenuTree(Integer f_user_id) {
    MapEntity params = new MapEntity();
    params.put("f_user_id", f_user_id);
    params.put("f_is_show", 1);
    params.setPageSizeWithMax().setOrderBy("f_parent_ids, f_order");

    List<MenuEntity> nodeTree =
        TreeUtil.listToTree(userMenuMapper.selectUserAndRoleMenuListPage(params));

    return HelpUtil.isEmptyCollection(nodeTree) ? null : nodeTree.get(0);
  }
Пример #3
0
  /**
   * 获取所有的可用菜单
   *
   * @return
   */
  public MenuEntity getMenuTree() {
    MenuEntity rootMenu = menuMapper.selectEntity(MenuEntity.MENU_ROOT);

    MapEntity params = new MapEntity();
    params.put(
        "f_parent_ids",
        (HelpUtil.isEmptyString(rootMenu.getF_parent_ids()) ? "" : rootMenu.getF_parent_ids() + "/")
            + rootMenu.getF_id());
    params.put("f_is_show", 1);
    params.setPageSizeWithMax().setOrderBy("f_parent_ids, f_order");

    rootMenu.setChildren(TreeUtil.listToTree(menuMapper.selectEntityListPage(params)));

    return rootMenu;
  }