private void insertRoleList(UserEntity user) {
    List<MapEntity> roleList = user.getRoleList();
    if (!HelpUtil.isEmptyCollection(roleList)) {
      for (MapEntity map : roleList) {
        map.put("f_user_id", user.getF_id());
      }

      userRoleMapper.insertEntities(roleList);
    }
  }
  private void insertMenuList(UserEntity user) {
    List<MapEntity> menuList = user.getMenuList();
    if (!HelpUtil.isEmptyCollection(menuList)) {
      for (MapEntity map : menuList) {
        map.put("f_user_id", user.getF_id());
      }

      userMenuMapper.insertEntities(menuList);
    }
  }
  /**
   * 获取指定角色的可用菜单
   *
   * @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);
  }
  /**
   * 获取指定用户的可用菜单
   *
   * @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);
  }
  /**
   * 获取所有的可用菜单
   *
   * @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;
  }
 private List<MapEntity> selectMenuList(Integer f_user_id) {
   MapEntity mapEntity = new MapEntity();
   mapEntity.put("f_user_id", f_user_id);
   return userMenuMapper.selectEntityListPage(mapEntity);
 }
 private void deleteMenuList(Integer f_user_id) {
   MapEntity mapEntity = new MapEntity();
   mapEntity.put("f_user_id", f_user_id);
   userMenuMapper.deleteEntities(mapEntity);
 }