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

import com.gyee.wisdom.common.data.ToData;
import com.gyee.wisdom.common.data.windturbine.Windturbine;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;

import javax.persistence.*;
import java.util.Date;


@Data
@NoArgsConstructor
@ToString
@EqualsAndHashCode()
@Entity
@Table(name = "WINDTURBINE")
public class WindturbineEntity implements ToData<Windturbine> {
    
//      `ID` varchar(50) NOT NULL,
//  `CODE` varchar(50) DEFAULT NULL,
//  `WINDPOWERSTATIONID` varchar(50) NOT NULL,
//  `LONGITUDE` float(18,2) DEFAULT NULL,
//  `LATITUDE` float(18,2) DEFAULT NULL,
//  `MODELID` varchar(50) DEFAULT NULL,
//  `STATUS` varchar(50) DEFAULT NULL,
//  `PROJECTID` varchar(50) DEFAULT NULL,
//  `LINEID` varchar(50) DEFAULT NULL,
//  `FIRSTINTEGRATEDTIME` varchar(50) DEFAULT NULL,
//  `PHOTO` varchar(50) DEFAULT NULL,
//  `NAME` varchar(50) DEFAULT NULL,
//  `STANDARDID` varchar(50) DEFAULT NULL,
//  `GYCP_ID` int(11) DEFAULT NULL COMMENT '通信通道Id',
    
    /** 主键ID */
    @Id
    /*@GeneratedValue(strategy = GenerationType.IDENTITY)*/
    @Column(name = "ID")
    private String id;
    /** 编码 */
    @Column(name = "CODE")
    private String code;
    /** 风场id */
    @Column(name = "WINDPOWERSTATIONID")
    private String windPowerStationId;
    /** 经度*/
    @Column(name = "LONGITUDE")
    private Double longitude;
    /** 纬度 */
    @Column(name = "LATITUDE")
    private Double latitude;
    /** 模型id */
    @Column(name = "MODELID")
    private String modelId;
    /** 状态 */
    @Column(name = "STATUS")
    private String status;
    /** 项目id */
    @Column(name = "PROJECTID")
    private String projectId;
    /** 线路id */
    @Column(name = "LINEID")
    private String lineId;
    /** 首次并网的时间 */
    @Column(name = "FIRSTINTEGRATEDTIME")
    private Date firstIntegratedTime;
    /** app注册ID */
    @Column(name = "PHOTO")
    private String photo;
    /** app注册ID */
    @Column(name = "NAME")
    private String name;
    /** app注册ID */
    @Column(name = "STANDARDID")
    private String standardId;




    public WindturbineEntity(Windturbine win) {
        this.id = win.getId();
        this.code = win.getCode();
        this.windPowerStationId = win.getWindPowerStationId();
        this.longitude = win.getLongitude();
        this.latitude = win.getLatitude();
        this.modelId = win.getModelId();
        this.status = win.getStatus();
        this.projectId = win.getProjectId();
        this.lineId = win.getLineId();
        this.firstIntegratedTime = win.getFirstIntegratedTime();
        this.photo = win.getPhoto();
        this.name = win.getName();
        this.standardId =win.getStandardId();
/*        this.line=new LineEntity(win.getLine());
        this.model=new ModelEntity(win.getModel());*/
    }


    @Override
    public Windturbine toData() {
        if(this!=null) {
            Windturbine win = new Windturbine();
            win.setId(id);
            win.setCode(code);
            win.setWindPowerStationId(windPowerStationId);
            win.setLongitude(longitude);
            win.setLatitude(latitude);
            win.setModelId(modelId);
            win.setStatus(status);
            win.setProjectId(projectId);
            win.setLineId(lineId);
            win.setFirstIntegratedTime(firstIntegratedTime);
            win.setPhoto(photo);
            win.setName(name);
            win.setStandardId(standardId);

            return win;
        }else{
            return null;
        }
    }


}
