zxl
6 小时以前 3b0516a2959e25576e4f3fda697a3b025d06c8c9
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package com.ycl.system.domain;
 
import com.baomidou.mybatisplus.annotation.TableField;
 
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
 
/**
 * 树节点,所有需要实现树节点的,都需要继承该类
 *
 * @author Mark sunlightcs@gmail.com
 * @since 1.0.0
 */
public class TreeNode<T> implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 主键
     */
    private Long id;
    /**
     * 上级ID
     */
 
    private Long parentId;
    /**
     * 子节点列表
     */
    @TableField(exist = false)
    private List<T> children = new ArrayList<>();
 
    public Long getId() {
        return id;
    }
 
    public void setId(Long id) {
        this.id = id;
    }
 
    public Long getParentId() {
        return parentId;
    }
 
    public void setParentId(Long pid) {
        this.parentId = pid;
    }
 
    public List<T> getChildren() {
        return children;
    }
 
    public void setChildren(List<T> children) {
        this.children = children;
    }
}