|  |  | 
 |  |  |  | 
 |  |  |     const columns = [ | 
 |  |  |         { | 
 |  |  |             title: 'No', | 
 |  |  |             dataIndex: 'index', | 
 |  |  |             valueType: 'indexBorder', | 
 |  |  |             width: 48, | 
 |  |  |         }, | 
 |  |  |         { | 
 |  |  |             title: '部门名称', | 
 |  |  |             dataIndex: 'name', | 
 |  |  |             valueType: 'text', | 
 |  |  |             hidden: false, | 
 |  |  |             width: 140, | 
 |  |  |             copyable: true, | 
 |  |  |             width: 240, | 
 |  |  |             filterDropdown: (props) => <TextFilter | 
 |  |  |                 name='name' | 
 |  |  |                 {...props} | 
 |  |  | 
 |  |  |             />, | 
 |  |  |         }, | 
 |  |  |         { | 
 |  |  |             title: '上级部门名', | 
 |  |  |             title: '上级部门', | 
 |  |  |             dataIndex: 'parentName', | 
 |  |  |             valueType: 'text', | 
 |  |  |             hidden: true, | 
 
 |  |  | 
 |  |  | import java.util.ArrayList; | 
 |  |  | import java.util.List; | 
 |  |  | import java.util.Map; | 
 |  |  | import java.util.function.Consumer; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Created by vincent on 2/13/2024 | 
 |  |  | 
 |  |  |         return this.buildWrapper(false); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @SuppressWarnings("all") | 
 |  |  |     public QueryWrapper<T> buildWrapper(Consumer<QueryWrapper<T>> consumer) { | 
 |  |  |         return this.buildWrapper(false, consumer); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public QueryWrapper<T> buildWrapper(boolean like) { | 
 |  |  |         return this.buildWrapper(like, null); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @SuppressWarnings("all") | 
 |  |  |     public QueryWrapper<T> buildWrapper(boolean like, Consumer<QueryWrapper<T>> consumer) { | 
 |  |  |         QueryWrapper<T> queryWrapper = new QueryWrapper<>(); | 
 |  |  |         Map<String, Object> map = where.getMap(); | 
 |  |  |         for (String key : map.keySet()) { | 
 |  |  | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         if (null != consumer) { | 
 |  |  |             consumer.accept(queryWrapper); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         Field[] fields = null; | 
 |  |  |         if (!Cools.isEmpty(cls)) { | 
 |  |  |             fields = Cools.getAllFields(cls); | 
 
 |  |  | 
 |  |  | 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; | 
 |  |  | 
 |  |  |     @PostMapping("/dept/tree") | 
 |  |  |     public R tree(@RequestBody Map<String, Object> map) { | 
 |  |  |         PageParam<Dept, BaseParam> param = new PageParam<>(buildParam(map, BaseParam.class), Dept.class); | 
 |  |  |         List<Dept> deptList = deptService.list(param.buildWrapper(true)); | 
 |  |  |         QueryWrapper<Dept> wrapper = param.buildWrapper(true, queryWrapper -> queryWrapper.orderByAsc("sort")); | 
 |  |  |         List<Dept> deptList = deptService.list(wrapper); | 
 |  |  |         return R.ok().add(Utils.toTreeData(deptList, 0L, Dept::getParentId, Dept::getId, Dept::setChildren)); | 
 |  |  |     } | 
 |  |  |  | 
 
 |  |  | 
 |  |  | 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; | 
 |  |  | 
 |  |  |     @PostMapping("/menu/tree") | 
 |  |  |     public R tree(@RequestBody Map<String, Object> map) { | 
 |  |  |         PageParam<Menu, BaseParam> param = new PageParam<>(buildParam(map, BaseParam.class), Menu.class); | 
 |  |  |         List<Menu> menus = menuService.list(param.buildWrapper(true)); | 
 |  |  |         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)); | 
 |  |  |     } | 
 |  |  |  |