From 7a868ca70a8f8cc796664ce1e08e8f4cae322fc8 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <xltys1995>
Date: 星期六, 10 四月 2021 00:09:09 +0800
Subject: [PATCH] #
---
src/main/java/zy/cloud/wms/manager/controller/NodeController.java | 37 +++++++++++++++++++++++++++++++++++--
1 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/src/main/java/zy/cloud/wms/manager/controller/NodeController.java b/src/main/java/zy/cloud/wms/manager/controller/NodeController.java
index 1a60a4a..7c4f356 100644
--- a/src/main/java/zy/cloud/wms/manager/controller/NodeController.java
+++ b/src/main/java/zy/cloud/wms/manager/controller/NodeController.java
@@ -12,11 +12,14 @@
import com.core.common.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
+import zy.cloud.wms.common.utils.ListUtils;
+import zy.cloud.wms.common.utils.TreeUtils;
import zy.cloud.wms.common.web.BaseController;
import zy.cloud.wms.manager.entity.Node;
import zy.cloud.wms.manager.service.NodeService;
import zy.cloud.wms.manager.utils.NodeUtils;
+import java.io.IOException;
import java.util.*;
@RestController
@@ -24,6 +27,8 @@
@Autowired
private NodeService nodeService;
+ @Autowired
+ private TreeUtils treeUtils;
@RequestMapping(value = "/node/{id}/auth")
@ManagerAuth
@@ -43,6 +48,20 @@
convert(param, wrapper);
if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
return R.ok(nodeService.selectPage(new Page<>(curr, limit), wrapper));
+ }
+
+ @RequestMapping(value = "/node/tree/auth")
+ @ManagerAuth
+ public R tree(@RequestParam(defaultValue = "1")Integer curr,
+ @RequestParam(defaultValue = "10")Integer limit,
+ @RequestParam(required = false)String orderByField,
+ @RequestParam(required = false)String orderByType,
+ @RequestParam Map<String, Object> param){
+ EntityWrapper<Node> wrapper = new EntityWrapper<>();
+ excludeTrash(param);
+ convert(param, wrapper);
+ if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
+ return R.parse("0-鎿嶄綔鎴愬姛").add(nodeService.selectList(wrapper));
}
private void convert(Map<String, Object> map, EntityWrapper wrapper){
@@ -139,13 +158,13 @@
@ManagerAuth
public R query(String condition) {
EntityWrapper<Node> wrapper = new EntityWrapper<>();
- wrapper.like("name", condition);
+ wrapper.like("name", condition).or().like("uuid", condition).eq("type", 3);
Page<Node> page = nodeService.selectPage(new Page<>(0, 10), wrapper);
List<Map<String, Object>> result = new ArrayList<>();
for (Node node : page.getRecords()){
Map<String, Object> map = new HashMap<>();
map.put("id", node.getId());
- map.put("value", node.getName());
+ map.put("value", node.getUuid() + "锛�" +node.getName()+ "锛�");
result.add(map);
}
return R.ok(result);
@@ -175,4 +194,18 @@
return R.ok().add(result);
}
+ @PostMapping(value = "/node/tree/auth")
+ @ManagerAuth
+ public R tree(@RequestParam(required = false, defaultValue = "") String condition) throws IOException, ClassNotFoundException {
+ ArrayList<Map> tree = treeUtils.getNodeTree(String.valueOf(getOriginNode().getId()));
+ // 娣辨嫹璐�
+ List<Map> result = ListUtils.deepCopy(tree);
+ if (!Cools.isEmpty(condition)) {
+ treeUtils.remove(condition, result);
+ treeUtils.remove(condition, result);
+ }
+ return R.ok(result);
+ }
+
+
}
--
Gitblit v1.9.1