package com.wms_main.model.vo.wms;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.wms_main.model.po.TAppEquipment;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class EquipmentVo {
    /**
     * 设备id
     */
    @JsonProperty(value = "equipmentId")
    private Integer equipmentId;
    /**
     * 设备类型
     */
    @JsonProperty(value = "equipmentType")
    private Integer equipmentType;
    /**
     * 设备状态
     */
    @JsonProperty(value = "equipmentStatus")
    private Integer equipmentStatus;
    /**
     * 设备名称
     */
    @JsonProperty(value = "equipmentName")
    private String equipmentName;
    /**
     * 设备描述
     */
    @JsonProperty(value = "equipmentDesc")
    private String equipmentDesc;
    /**
     * 上次更新时间
     */
    @JsonProperty(value = "lastUpdateTime")
    private LocalDateTime lastUpdateTime;
    /**
     * 上次更新用户
     */
    @JsonProperty(value = "lastUpdateUser")
    private String lastUpdateUser;

    /**
     * 将po对象转换为vo对象
     * @param po po对象
     * @return vo
     */
    public static EquipmentVo of(TAppEquipment po) {
        if (po == null) {
            return new EquipmentVo();
        }
        // 返回vo
        return new EquipmentVo(
                po.getEquipmentId(),
                po.getEquipmentType(),
                po.getEquipmentStatus(),
                po.getEquipmentName(),
                po.getEquipmentDesc(),
                po.getLastUpdateTime(),
                po.getLastUpdateUser()
        );
    }
}