| | |
| | | package com.dsh.guns.modular.system.controller.system; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.course.model.node.ZTreeNode; |
| | | import com.dsh.guns.config.UserExt; |
| | |
| | | public Object list(@RequestParam(required = false) String menuName, @RequestParam(required = false) String level) { |
| | | Integer language = UserExt.getLanguage(); |
| | | List<Map<String, Object>> menus = this.menuService.selectMenus(menuName, level); |
| | | if(language==1 || language==null){ |
| | | |
| | | }else if(language==2){ |
| | | for (Map<String, Object> menu : menus) { |
| | | menu.put("name",menu.get("ename")); |
| | | } |
| | | }else if(language==3){ |
| | | for (Map<String, Object> menu : menus) { |
| | | menu.put("name",menu.get("bname")); |
| | | } |
| | | } |
| | | for (Map<String, Object> menu : menus) { |
| | | menu.put("id",menu.get("id").toString()); |
| | | } |
| | | |
| | | |
| | | return super.warpObject(new MenuWarpper(menus)); |
| | | } |
| | |
| | | @ResponseBody |
| | | public List<ZTreeNode> menuTreeListByRoleId(@PathVariable Integer roleId) { |
| | | List<Long> menuIds = this.menuService.getMenuIdsByRoleId(roleId); |
| | | if (Objects.isNull(menuIds)) { |
| | | System.out.println("=====menuIds==========="+menuIds); |
| | | if (CollectionUtil.isEmpty(menuIds)) { |
| | | System.out.println("=====menuIds1==========="+menuIds); |
| | | |
| | | List<ZTreeNode> roleTreeList = this.menuService.menuTreeList(); |
| | | return roleTreeList; |
| | | } else { |
| | | |
| | | // List<ZTreeNode> roleTreeList = this.menuService.menuTreeList(); |
| | | List<ZTreeNode> roleTreeListByUserId = this.menuService.menuTreeListByMenuIds(menuIds); |
| | | return roleTreeListByUserId; |