lius
2023-06-08 534aec7a687ceca8120ba798ad20d80d7058ffe6
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
package org.jeecg.modules.mdc.model;
 
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.modules.mdc.entity.MdcEquipment;
import org.jeecg.modules.system.model.MdcProductionTreeModel;
import org.jeecg.modules.system.model.SysDepartTreeModel;
 
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
 
/**
 * 设备树
 *
 * @author: LiuS
 * @create: 2023-03-29 17:11
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "设备树结构数据实体", description = "设备")
public class MdcEquipmentTree implements Serializable {
 
    private static final long serialVersionUID = -5202127219834067917L;
 
    /**
     * 前端数据树中的key
     */
    private String key;
 
    /**
     * 前端数据树中的value
     */
    private String value;
 
    /**
     * 前端数据树中的title
     */
    private String title;
 
    /**
     * 是否是子节点
     */
    private boolean isLeaf;
 
    /**
     * 设备编号(前端定位用)
     */
    private String equipmentId;
 
    /**
     * 设备名称(前端定位用)
     */
    private String equipmentName;
 
    /**
     * 父级id(前端请求用)
     */
    private String parentId;
 
    private List<MdcEquipmentTree> children = new ArrayList<>();
 
    /**
     * 将设备数据放在该对象中
     * @param mdcEquipment
     * @return
     */
    public MdcEquipmentTree convert(MdcEquipment mdcEquipment) {
        this.key = mdcEquipment.getId();
        this.value = mdcEquipment.getId();
        this.title = mdcEquipment.getEquipmentId() + "/" + mdcEquipment.getEquipmentName();
        this.equipmentId = mdcEquipment.getEquipmentId();
        this.equipmentName = mdcEquipment.getEquipmentName();
        this.isLeaf = true;
        return this;
    }
 
    /**
     * 将SysDepartTreeModel的部分数据放在该对象当中
     * @param treeModel
     * @return
     */
    public MdcEquipmentTree convertByDepart(SysDepartTreeModel treeModel) {
        this.key = treeModel.getId();
        this.value = treeModel.getId();
        this.title = treeModel.getDepartName();
        return this;
    }
 
    /**
     * 将mdcProductionTreeModel的部分数据放在该对象当中
     * @param treeModel
     * @return
     */
    public MdcEquipmentTree convertByProduction(MdcProductionTreeModel treeModel) {
        this.key = treeModel.getId();
        this.value = treeModel.getId();
        this.title = treeModel.getProductionName();
        return this;
    }
 
 
}