cuilei
8 天以前 58020f3d711d4baa16ef092c2ea826071c7d23b9
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
package org.jeecg.modules.eam.vo;
 
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.modules.eam.entity.EamEquipment;
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;
 
/**
 * 设备树
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "设备树结构数据实体", description = "设备")
public class EamEquipmentTree implements Serializable {
 
    /**
     * 前端数据树中的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 String memo;
 
    /**
     * 类型 1 车间 2设备
     */
    private Integer type;
 
    /**
     * orgType
     */
    private String orgType;
 
 
    private List<EamEquipmentTree> children = new ArrayList<>();
 
    /**
     * 将设备数据放在该对象中
     *
     * @param mdcEquipment
     * @return
     */
    public EamEquipmentTree convert(EamEquipment mdcEquipment) {
        this.key = mdcEquipment.getId();
        this.value = mdcEquipment.getId();
        this.title = mdcEquipment.getEquipmentCode() + "/" + mdcEquipment.getEquipmentName();
        this.equipmentId = mdcEquipment.getEquipmentCode();
        this.equipmentName = mdcEquipment.getEquipmentName();
        this.isLeaf = true;
        return this;
    }
 
    /**
     * 将SysDepartTreeModel的部分数据放在该对象当中
     *
     * @param treeModel
     * @return
     */
    public EamEquipmentTree convertByDepart(SysDepartTreeModel treeModel) {
        this.key = treeModel.getId();
        this.value = treeModel.getId();
        this.title = treeModel.getDepartName();
        return this;
    }
 
    /**
     * 将mdcProductionTreeModel的部分数据放在该对象当中
     *
     * @param treeModel
     * @return
     */
    public EamEquipmentTree convertByProduction(MdcProductionTreeModel treeModel) {
        this.key = treeModel.getId();
        this.value = treeModel.getId();
        this.title = treeModel.getProductionName();
        this.memo = treeModel.getMemo();
        this.type = treeModel.getType();
        this.orgType = treeModel.getOrgType();
        return this;
    }
}