| | |
| | | |
| | | @PreAuthorize("hasAuthority('manager:matnrGroup:list')") |
| | | @PostMapping("/matnrGroup/tree") |
| | | public R tree(@RequestBody Map<String, Object> map) { |
| | | public R tree(@RequestBody(required = false) Map<String, Object> map) { |
| | | List<MatnrGroup> matnrs = new ArrayList<>(); |
| | | matnrs = matnrGroupService.list(new LambdaQueryWrapper<>()); |
| | | // if (Objects.isNull(map)) { |
| | | // } else { |
| | | // if (Objects.isNull(map.get("condition"))) { |
| | | // return R.ok("condition参数不能为空!!"); |
| | | // } |
| | | // matnrs = matnrGroupService.list(new LambdaQueryWrapper<MatnrGroup>().like(MatnrGroup::getName, map.get("condition"))); |
| | | // } |
| | | if (Objects.isNull(map)) { |
| | | matnrs = matnrGroupService.list(new LambdaQueryWrapper<>()); |
| | | } else { |
| | | if (Objects.isNull(map.get("condition"))) { |
| | | return R.ok("condition参数不能为空!!"); |
| | | } |
| | | matnrs = matnrGroupService.list(new LambdaQueryWrapper<MatnrGroup>().like(MatnrGroup::getName, map.get("condition"))); |
| | | } |
| | | List<MatnrGroup> treeData = Utils.toTreeData(matnrs, 0L, MatnrGroup::getParentId, MatnrGroup::getId, MatnrGroup::setChildren); |
| | | return R.ok().add(treeData); |
| | | } |