|  |  | 
 |  |  | import com.zy.asrs.wcs.system.service.MenuService; | 
 |  |  | import com.zy.asrs.wcs.utils.ExcelUtil; | 
 |  |  | import com.zy.asrs.wcs.utils.NodeUtils; | 
 |  |  | import com.zy.asrs.wcs.utils.Utils; | 
 |  |  | import com.zy.asrs.wcs.utils.CommonUtils; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.security.access.prepost.PreAuthorize; | 
 |  |  | import org.springframework.web.bind.annotation.*; | 
 |  |  | 
 |  |  |     @PreAuthorize("hasAuthority('system:menu:list')") | 
 |  |  |     @PostMapping("/menu/tree") | 
 |  |  |     public R tree(@RequestBody Map<String, Object> map) { | 
 |  |  |         List<Menu> menus = menuService.list(); | 
 |  |  |         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 = CommonUtils.toTreeData(menuList, 0L, Menu::getParentId, Menu::getId, Menu::setChildren); | 
 |  |  |         if (!Cools.isEmpty(map.get("condition"))) { | 
 |  |  |             CommonUtils.treeRemove(treeData, String.valueOf(map.get("condition")), Menu::getName, Menu::getChildren); | 
 |  |  |             CommonUtils.treeRemove(treeData, String.valueOf(map.get("condition")), Menu::getName, Menu::getChildren); | 
 |  |  |         } | 
 |  |  |         return R.ok().add(treeData); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PreAuthorize("hasAuthority('system:menu:list')") |