#
luxiaotao1123
2021-01-19 f74bb3a0d31392a2ea06ac231a854c38df060e65
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package zy.cloud.wms.manager.utils;
 
import com.core.common.SpringUtils;
import zy.cloud.wms.manager.entity.Node;
import zy.cloud.wms.manager.service.NodeService;
 
/**
 * Created by vincent on 2021/1/19
 */
public class NodeUtils {
 
    public StringBuilder path = new StringBuilder();
 
    public StringBuilder pathName = new StringBuilder();
 
    public void executePath(Node node) {
        NodeService bean = SpringUtils.getBean(NodeService.class);
        Node parent = bean.selectById(node.getParentId());
        if (null != parent) {
            path.insert(0, parent.getId()).insert(0,",");
            pathName.insert(0, parent.getName()).insert(0,",");
            if (parent.getParentId() != null) {
                executePath(parent);
            } else {
                path.deleteCharAt(0);
                pathName.deleteCharAt(0);
            }
        }
 
    }
 
}