|  |  | 
 |  |  | package com.zy.asrs.wcs.system.controller; | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
 |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
 |  |  | import com.zy.asrs.framework.common.Cools; | 
 |  |  | import com.zy.asrs.framework.common.R; | 
 |  |  | 
 |  |  |     @PreAuthorize("hasAuthority('system:menu:list')") | 
 |  |  |     @PostMapping("/menu/tree") | 
 |  |  |     public R tree(@RequestBody Map<String, Object> map) { | 
 |  |  |         PageParam<Menu, BaseParam> param = new PageParam<>(buildParam(map, BaseParam.class), Menu.class); | 
 |  |  |         QueryWrapper<Menu> wrapper = param.buildWrapper(true, queryWrapper -> queryWrapper.orderByAsc("sort")); | 
 |  |  |         List<Menu> menus = menuService.list(wrapper); | 
 |  |  |         return R.ok().add(Utils.toTreeData(menus, 0L, Menu::getParentId, Menu::getId, Menu::setChildren)); | 
 |  |  | //        PageParam<Menu, BaseParam> param = new PageParam<>(buildParam(map, BaseParam.class), Menu.class); | 
 |  |  | //        QueryWrapper<Menu> wrapper = param.buildWrapper(true, queryWrapper -> queryWrapper.orderByAsc("sort")); | 
 |  |  | //        List<Menu> menus = menuService.list(wrapper); | 
 |  |  | //        return R.ok().add(Utils.toTreeData(menus, 0L, Menu::getParentId, Menu::getId, Menu::setChildren)); | 
 |  |  |         List<Menu> menuList = menuService.list(new LambdaQueryWrapper<Menu>().orderByAsc(Menu::getSort)); | 
 |  |  |         List<Menu> treeData = Utils.toTreeData(menuList, 0L, Menu::getParentId, Menu::getId, Menu::setChildren); | 
 |  |  |         if (!Cools.isEmpty(map.get("condition"))) { | 
 |  |  |             Utils.treeRemove(treeData, String.valueOf(map.get("condition")), Menu::getName, Menu::getChildren); | 
 |  |  |             Utils.treeRemove(treeData, String.valueOf(map.get("condition")), Menu::getName, Menu::getChildren); | 
 |  |  |         } | 
 |  |  |         return R.ok().add(treeData); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PreAuthorize("hasAuthority('system:menu:list')") |