| | |
| | | @ManagerAuth |
| | | public R query(String condition) { |
| | | EntityWrapper<Tag> wrapper = new EntityWrapper<>(); |
| | | wrapper.like("id", condition); |
| | | wrapper.like("uuid", condition).or().like("name", condition); |
| | | Page<Tag> page = tagService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (Tag tag : page.getRecords()){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", tag.getId()); |
| | | map.put("value", tag.getId()); |
| | | map.put("value", tag.getName()); |
| | | result.add(map); |
| | | } |
| | | return R.ok(result); |
| | |
| | | @PostMapping(value = "/tag/tree/auth") |
| | | @ManagerAuth |
| | | public R tree(@RequestParam(required = false, defaultValue = "") String condition) throws IOException, ClassNotFoundException { |
| | | ArrayList<Map> tree = treeUtils.getTree("1"); |
| | | ArrayList<Map> tree = treeUtils.getTree(String.valueOf(getOriginTag().getId())); |
| | | // 深拷贝 |
| | | List<Map> result = ListUtils.deepCopy(tree); |
| | | if (!Cools.isEmpty(condition)) { |
| | | treeUtils.remove(condition, result); |
| | | treeUtils.remove(condition, result); |
| | | } |
| | | return R.ok(tree); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | } |