美高梅平台下载-美高梅娱乐平台登录

热门关键词: 美高梅平台下载,美高梅娱乐平台登录

将json格式多级菜单保存到数据库

日期:2019-10-07编辑作者:美高梅平台下载
 /** * 将json菜单保存到数据库 * * @return */ @RequestMapping("save/menu") @ResponseBody public Map<String, Object> menu() { String jsonStr = "{n" + " "data": {n" + " "list": [{n" + " "id": 1,n" + " "url": "gzt",n" + " "name": "工作台",n" + " "iconfont": "",n" + " "sub": [{n" + " "id":11,n" + " "url": "kfsh",n" + " "name": "客服售后",n" + " "iconfont": "",n" + " "sub": [{n" + " "id": 1101,n" + " "url": "kfsh/ddgl",n" + " "name": "订单管理",n" + " "iconfont": ""n" + " },n" + " {n" + " "id": 1102,n" + " "url": "kfsh/pjgl",n" + " "name": "评价管理",n" + " "iconfont": ""n" + " },n" + " {n" + " "id": 1103,n" + " "url": "kfsh/tscl",n" + " "name": "投诉处理",n" + " "iconfont": ""n" + " },n" + " {n" + " "id": 1104,n" + " "url": "kfsh/tkgl",n" + " "name": "退款管理",n" + " "iconfont": ""n" + " }n" + " ]n" + " },n" + " {n" + " "id": 12,n" + " "url": "yggl",n" + " "name": "员工管理",n" + " "iconfont": "",n" + " "sub": [{n" + " "id": 1201,n" + " "url": "yggl/yglb",n" + " "name": "员工列表",n" + " "iconfont": ""n" + " },n" + " {n" + " "id": 1203,n" + " "url": "yggl/yggl",n" + " "name": "员工管理",n" + " "iconfont": ""n" + " }n" + " ]n" + " },n" + " {n" + " "id": 13,n" + " "url": "gzgl",n" + " "name": "工作管理",n" + " "iconfont": "",n" + " "sub": [{n" + " "id": 1301,n" + " "url": "gzgl/kjgl",n" + " "name": "卡卷管理",n" + " "iconfont": ""n" + " },n" + " {n" + " "id": 1302,n" + " "url": "gzgl/xtgg",n" + " "name": "系统公告",n" + " "iconfont": ""n" + " },n" + " {n" + " "id": 1303,n" + " "url": "gzgl/xtgug",n" + " "name": "系统广告",n" + " "iconfont": ""n" + " }n" + " ]n" + " },n" + " {n" + " "id": 14,n" + " "url": "cwgl",n" + " "name": "财务管理",n" + " "iconfont": "",n" + " "sub": [{n" + " "id": 1401,n" + " "url": "cwgl/jsgl",n" + " "name": "结算管理",n" + " "iconfont": ""n" + " },n" + " {n" + " "id": 1402,n" + " "url": "cwgl/mdzw",n" + " "name": "门店账务",n" + " "iconfont": ""n" + " },n" + " {n" + " "id": 1403,n" + " "url": "cwgl/lszw",n" + " "name": "历史账务",n" + " "iconfont": ""n" + " },n" + " {n" + " "id": 1404,n" + " "url": "cwgl/cwfx",n" + " "name": "财务分析",n" + " "iconfont": ""n" + " },n" + " {n" + " "id": 1405,n" + " "url": "cwgl/ywfx",n" + " "name": "业务分析",n" + " "iconfont": ""n" + " },n" + " {n" + " "id": 1406,n" + " "url": "cwgl/pjfx",n" + " "name": "评价分析",n" + " "iconfont": ""n" + " },n" + " {n" + " "id": 1407,n" + " "url": "cwgl/yyfx",n" + " "name": "营业分析",n" + " "iconfont": ""n" + " }n" + " ]n" + " },n" + " {n" + " "id": 15,n" + " "url": "qygl",n" + " "name": "区域管理",n" + " "iconfont": "",n" + " "sub": [{n" + " "id": 1501,n" + " "url": "qygl/mdgl",n" + " "name": "门店管理",n" + " "iconfont": ""n" + " },n" + " {n" + " "id": 1502,n" + " "url": "qygl/ddgl",n" + " "name": "订单管理",n" + " "iconfont": ""n" + " },n" + " {n" + " "id": 1503,n" + " "url": "qygl/cwgl",n" + " "name": "财务管理",n" + " "iconfont": ""n" + " },n" + " {n" + " "id": 1504,n" + " "url": "qygl/pjck",n" + " "name": "评价查看",n" + " "iconfont": ""n" + " }n" + " ]n" + " }]n" + " },n" + " {n" + " "id": 2,n" + " "url": "mdgl",n" + " "name": "门店管理",n" + " "iconfont": "",n" + " "sub": [{n" + " "id": 21,n" + " "url": "mdgl/mdlb",n" + " "name": "门店列表",n" + " "iconfont": ""n" + " },n" + " {n" + " "id": 22,n" + " "url": "mdgl/ywgl",n" + " "name": "业务管理",n" + " "iconfont": ""n" + " },n" + " {n" + " "id": 23,n" + " "url": "mdgl/tcgl",n" + " "name": "套餐管理",n" + " "iconfont": ""n" + "n" + " },n" + " {n" + " "id": 24,n" + " "url": "mdgl/mdzk",n" + " "name": "门店折扣",n" + " "iconfont": ""n" + " },n" + " {n" + " "id": 25,n" + " "url": "mdgl/czsz",n" + " "name": "充值设置",n" + " "iconfont": ""n" + " },n" + " {n" + " "id": 26,n" + " "url": "mdgl/spgl",n" + " "name": "商品管理",n" + " "iconfont": ""n" + "n" + " },n" + " {n" + " "id": 27,n" + " "url": "mdgl/qygl",n" + " "name": "区域管理",n" + " "iconfont": ""n" + "n" + " }n" + " ]n" + " },n" + " {n" + " "id": 3,n" + " "url": "hygl",n" + " "name": "会员管理",n" + " "iconfont": "",n" + " "sub": [{n" + " "id": 31,n" + " "url": "hygl/hylb",n" + " "name": "会员列表",n" + " "iconfont": ""n" + " },n" + " {n" + " "id": 32,n" + " "url": "hygl/hydj",n" + " "name": "会员等级",n" + " "iconfont": ""n" + " },n" + " {n" + " "id": 33,n" + " "url": "hygl/hytj",n" + " "name": "会员统计",n" + " "iconfont": ""n" + " }]n" + " },n" + " {n" + " "id": 4,n" + " "url": "xtgl",n" + " "name": "系统管理",n" + " "iconfont": "",n" + " "sub": [{n" + " "id": 41,n" + " "url": "xtgl/xtgl",n" + " "name": "系统管理",n" + " "iconfont": "",n" + " "sub": [n" + " {n" + " "id": 4102,n" + " "url": "xtgl/xtrz",n" + " "name": "系统日志",n" + " "iconfont": ""n" + " },n" + " {n" + " "id": 4103,n" + " "url": "xtgl/cdgl",n" + " "name": "菜单管理",n" + " "iconfont": ""n" + " },n" + " {n" + " "id": 4104,n" + " "url": "xtgl/pbc",n" + " "name": "屏蔽词",n" + " "iconfont": ""n" + " }n" + " ]n" + " },n" + " {n" + " "id": 42,n" + " "url": "qxgl",n" + " "name": "权限管理",n" + " "iconfont": "",n" + " "sub": [{n" + " "id": 4201,n" + " "url": "qxgl/jsgl",n" + " "name": "角色管理",n" + " "iconfont": ""n" + " },n" + " {n" + " "id": 4202,n" + " "url": "qxgl/qxsz",n" + " "name": "权限设置",n" + " "iconfont": ""n" + " },n" + " {n" + " "id": 4203,n" + " "url": "qxgl/gly",n" + " "name": "管理员",n" + " "iconfont": ""n" + " }n" + " ]n" + " },n" + " {n" + " "id": 43,n" + " "url": "xtsj",n" + " "name": "系统数据",n" + " "iconfont": "",n" + " "sub": [{n" + " "id": 4301,n" + " "url": "xtsj/xtyw",n" + " "name": "系统业务",n" + " "iconfont": ""n" + " },n" + " {n" + " "id": 4302,n" + " "url": "xtsj/ywfl",n" + " "name": "业务分类",n" + " "iconfont": ""n" + " },n" + " {n" + " "id": 4303,n" + " "url": "xtsj/cxcx",n" + " "name": "车型车系",n" + " "iconfont": ""n" + " },n" + " {n" + " "id": 4101,n" + " "url": "xtgl/dictionary",n" + " "name": "数据字典",n" + " "iconfont": ""n" + " }n" + " n" + " ]n" + " }n" + " ]n" + " }n" + " ]n" + " },n" + " "status": 200n" + "}"; JSONObject jsStr = JSONObject.parseObject; Map<String, Object> map = (Map<String, Object>) jsStr.get; List<Object> list = (List<Object>) map.get; try { for (Object menu1 : list) { SysMenu menu = new SysMenu(); JSONObject jsonObject = JSONObject.parseObject(menu1.toString; System.out.println("" + jsonObject.get.toString; menu.setMenuUrl(jsonObject.get.toString; menu.setMenuIcon(jsonObject.get("iconfont").toString; menu.setMenuName(jsonObject.get.toString; menu.setParentId; //保存 SysMenu sysMenu = sysMenuService.saveEntity;//保存save List<Object> list1 = (List<Object>) jsonObject.get; if (list1.size { for (Object menu2 : list1) { JSONObject jsonObject1 = JSONObject.parseObject(menu2.toString; System.out.println(" " + jsonObject1.get.toString; SysMenu m1 = new SysMenu(); m1.setMenuUrl(jsonObject1.get.toString; m1.setMenuIcon(jsonObject1.get("iconfont").toString; m1.setMenuName(jsonObject1.get.toString; m1.setParentId(sysMenu.getMenuId; //保存 SysMenu sysMenu1 = sysMenuService.saveEntity;//保存save List<Object> list3 = (List<Object>) jsonObject1.get; if (list3 != null) { for (Object menu3 : list3) { JSONObject jsonObject2 = JSONObject.parseObject(menu3.toString; System.out.println(" " + jsonObject2.get.toString; SysMenu m2 = new SysMenu(); m2.setMenuUrl(jsonObject2.get.toString; m2.setMenuIcon(jsonObject2.get("iconfont").toString; m2.setMenuName(jsonObject2.get.toString; m2.setParentId(sysMenu1.getMenuId; sysMenuService.saveEntity; } } } } } } catch (Exception e) { e.printStackTrace(); } return null; }

本文由美高梅平台下载发布于美高梅平台下载,转载请注明出处:将json格式多级菜单保存到数据库

关键词:

【美高梅娱乐平台登录】开发出来的项目需要部

7.运行结果访问 从上面可以看出来,jar包运行的时候会404错误,因为默认jsp不会被拷贝进来,而war包里面有包含了j...

详细>>

因为需要使用到这方面内容,starters可以简化Sp

本项目旨在把SpringBoot的特性展示出来,都是开发中经常用到的,可以留作SpringBoot使用备忘录,持续更新中。 原创作...

详细>>

这个是基于Redis缓存的Session共享,让我们开始吧

适用场景 为了使Web能适应大规模的访问,需要实现应用程序的集群部署 实现集群部署首先要解决session的统一,即需要...

详细>>

)中介绍的服务的消费者和提供者都需要在注册

spring-boot-start-dubbo,让你可以使用spring-boot的方式开发dubbo程序。使dubbo开发变得如此简单。 一、注册中心Zookeeper的安...

详细>>