package com.gyee.wisdom.dao.sql.control.entity;

import com.gyee.wisdom.common.data.ToData;
import com.gyee.wisdom.common.data.control.GycpCmdInfo;
import com.gyee.wisdom.common.data.windturbine.EquipmentModel;
import com.gyee.wisdom.dao.sql.ModelConstants;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

/**
 * @descrition:
 * @author:Wanghs
 * @date:2019-09-02
 */
@Data
@NoArgsConstructor
@ToString
@EqualsAndHashCode()
@Entity
@Table(name = ModelConstants.GYCP_CMD_INFO)
public class GycpCmdInfoEntity implements ToData<GycpCmdInfo> {


    /**
     * 主键ID
     */
    @Id
    @Column(name = ModelConstants.ID_)
    private int id;
    /**
     * 控制类型(启停维护等)
     */
    @Column(name = ModelConstants.TYPE_)
    private int type;
    /**
     * 命令地址
     */
    @Column(name = ModelConstants.CMD_ID)
    private int cmdId;
    /**
     * 命令值
     */
    @Column(name = ModelConstants.CMD_VALUE)
    private int cmdValue;
    /**
     * 风机id
     */
    @Column(name = ModelConstants.WINDTURBINE_ID)
    private String windturbineId;

    @Override
    public GycpCmdInfo toData() {
        if (this != null) {
            GycpCmdInfo cmdInfo = new GycpCmdInfo();
            cmdInfo.setCmdId(this.getId());
            cmdInfo.setCmdId(this.getCmdId());
            cmdInfo.setCmdValue(this.getCmdValue());
            cmdInfo.setType(this.getType());
            cmdInfo.setWindturbineId(this.getWindturbineId());
            return cmdInfo;

        } else {
            return null;
        }
    }
}
