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 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; } }