当前位置: 首页 > news >正文

扬州建网站网站建设项目费用报价

扬州建网站,网站建设项目费用报价,如何做好网站建设前期网站规划,个人网站做百度竞价通用树形数据工具库 hierarchy-utils链接地址使用示例数据结构 - 菜单数据源1.通过原数据结构返回树形数据2.通过转换数据结构#xff08;Map / JSONObject#xff09;返回树形数据3.返回源数据列表中id为rootId的元素或pid为rootId且id能整除2的全部子元素的数据列表 #… 通用树形数据工具库 hierarchy-utils链接地址使用示例数据结构 - 菜单数据源1.通过原数据结构返回树形数据2.通过转换数据结构Map / JSONObject返回树形数据3.返回源数据列表中id为rootId的元素或pid为rootId且id能整除2的全部子元素的数据列表 支持将树形数据打平及过滤4.怎样对指定的返回结果列表进行排序的方法 hierarchy-utils 用于构建/查找具有层级关系树形数据的工具库,以解决业务中常见的树形数据处理需求 支持自定义过滤数据、排序及转换数据等 链接地址 https://github.com/joker-pper/hierarchy-utils 使用示例 数据结构 - 菜单 Data public class Menu {private Integer id;private String name;private Integer pid;private Integer sort;private ListMenu children; }数据源 //查询当前用户的菜单列表ListMenu menuList menuService.findAllByUserId();//通过json转换ListMenu menuList JSONObject.parseArray(menuText, Menu.class);;1.通过原数据结构返回树形数据 //默认根元素为-1 (当前所有一级菜单的pid为-1,可根据实际定义根元素使用)Integer rootId -1;//排序(需注意业务属性值是否为空),可选ComparatorMenu comparator Comparator.comparingInt(Menu::getSort);HierarchyUtils.HierarchyFunctionsMenu, Integer, Menu defaultFunctions new HierarchyUtils.HierarchyFunctions();//获取piddefaultFunctions.setGetPidFunction(data - data.getPid());//获取iddefaultFunctions.setGetIdFunction(data - data.getId());//验证是否为rootdefaultFunctions.setIsRootFunction(id - Objects.equals(rootId, id));//设置childrendefaultFunctions.setSetChildrenFunction((parent, children) - {parent.setChildren(children);});//是否返回root元素(未设置时默认false,开启时root元素必须存在)defaultFunctions.setIsWithRoot(() - false);//过滤条件(可选,用来筛选数据)defaultFunctions.setFilterPredicate(menu - true);ListMenu hierarchyResult HierarchyUtils.getHierarchyResult(menuList,defaultFunctions,comparator);System.out.println(JSONObject.toJSONString(hierarchyResult)); 2.通过转换数据结构Map / JSONObject返回树形数据 //默认根元素为-1 (当前所有一级菜单的pid为-1,可根据实际定义根元素使用)Integer rootId -1;//排序(需注意业务属性值是否为空),可选ComparatorMenu comparator Comparator.comparingInt(Menu::getSort);HierarchyUtils.HierarchyFunctionsMenu, Integer, JSONObject transferFunctions new HierarchyUtils.HierarchyFunctions();//获取pidtransferFunctions.setGetPidFunction(data - data.getPid());//获取idtransferFunctions.setGetIdFunction(data - data.getId());//验证是否为roottransferFunctions.setIsRootFunction(id - Objects.equals(rootId, id));//设置转换函数transferFunctions.setTransferFunction(menu - {//转换数据JSONObject result (JSONObject) JSON.toJSON(menu);//可定义或移除属性result.put(title, menu.getName());result.put(order, menu.getSort());result.put(newName, menu.getName());result.remove(name);return result;});//设置childrentransferFunctions.setSetChildrenFunction((parent, children) - {parent.put(children, children);});//是否返回root元素(未设置时默认false,开启时root元素必须存在)transferFunctions.setIsWithRoot(() - false);//过滤条件(可选,用来筛选数据)transferFunctions.setFilterPredicate(menu - true);ListJSONObject transferResults HierarchyUtils.getHierarchyResult(menuList,transferFunctions,comparator);System.out.println(JSONObject.toJSONString(transferResults)); 3.返回源数据列表中id为rootId的元素或pid为rootId且id能整除2的全部子元素的数据列表 支持将树形数据打平及过滤 Integer rootId 1;HierarchyFlatUtils.HierarchyFlatFunctionsMenu, Integer, Menu functions new HierarchyFlatUtils.HierarchyFlatFunctions();//获取pidfunctions.setGetPidFunction(data - data.getPid());//获取idfunctions.setGetIdFunction(data - data.getId());//验证是否为rootfunctions.setIsRootFunction(id - Objects.equals(rootId, id));//是否返回root元素(未设置时默认false,开启时root元素必须存在)functions.setIsWithRoot(() - true);//是否返回全部的子元素(未设置时默认false,即默认只返回root元素的直接子元素)functions.setIsWithAllChildren(() - true);//过滤条件(可选,用来筛选数据)functions.setFilterPredicate(menu - menu.getId() % 2 0 || Objects.equals(rootId, menu.getId()));//排序(需注意业务属性值是否为空),可选ComparatorMenu comparator Comparator.comparingInt(Menu::getSort);ListMenu matchResults HierarchyFlatUtils.getHierarchyFlatResult(menuList,functions,comparator);//对返回结果排序(需注意业务属性值是否为空),可选HierarchySortUtils.sort(matchResults, comparator);System.out.println(JSONObject.toJSONString(matchResults)); 4.怎样对指定的返回结果列表进行排序的方法 //对返回结果排序 只排序当前列表不会递归排序子元素HierarchySortUtils.sort(list, comparator); //对返回结果及子元素排序递归排序HierarchySortUtils.sortWithChildren(list, childrenFunction, comparator);
http://www.zqtcl.cn/news/191388/

相关文章:

  • 麻涌做网站个人证书查询网全国联网
  • 做毕业设计网站的步骤那家做网站比较好
  • 网站开发学习网wordpress 数据库 插件
  • 企业公司官网网站做网站怎样做
  • 网站建设 今网科技电商网站建设布局
  • 最优惠的网站优化管理培训机构
  • p2p网站建设广州深圳网站设计公司哪家好
  • 福州网站设计哪里好泰安网站建设入门推荐
  • 北京网站软件制作外卖网站开发
  • 个人网站建设与实现建立个公司网站
  • 南昌招商网站建设临沂兰山建设局网站
  • 母婴网站建设怎么样可以做网站
  • 二手车 网站开发wordpress 定时 检查
  • 淮南官网济南seo优化外包
  • 沈阳网站建设莫道网络网站建设常用六大布局
  • 网站建设外文版要求网站关键字优化销售
  • 马来西亚做公路投标网站设计网页多少钱
  • 织梦网站多少钱广告多的网站
  • 济南网站建站模板深圳南园网站建设
  • 国家免费技能培训官网白杨seo博客
  • 福州seo网站建设微服务网站
  • 网站宽度 像素长沙电商运营培训
  • 备案上个人网站和企业网站的区别app开发多少钱一个
  • 有限公司网站建设 中企动力佛山培训机构招生方案
  • 扫黄打非网站建设专业的高端网站制作公司
  • 做自媒体发视频用哪些网站江西网站建设哪家好
  • wordpress用户列表南宁百度seo排名优化
  • 做网站时如何写接口文档上海网站设计建设公司
  • 网站小图标怎么制作平面设计素材网站推荐
  • 多元网络兰州网站建设惠州网页建站模板