package org.well.well.domain;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

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

/****
 * 报警表
 */

@Entity
@Table(name = "alarm_records")

public class AlarmRecord implements Serializable {

    /**
     *
     */
    private static final long serialVersionUID = 1658147150462234453L;
    private Long id;
    private Long jobId;
    private String alarmType;
    private String alarmContent;
    private String alarmValue;
    private String alarmMsg;
    private Device device;
    private String deviceCode;
    private String wellCode;
    private Date alarmTime;
    private String status;
    private Integer alarmLevel;//告警等级


    public AlarmRecord() {
        super();
    }





    public AlarmRecord(Long jobId, String alarmType,Integer alarmLevel, String alarmContent, String alarmValue,
                       Device device, String deviceCode, String wellCode, Date alarmTime,String alarmMsg) {
        this.jobId = jobId;
        this.alarmType = alarmType;
        this.alarmLevel = alarmLevel;
        this.alarmContent = alarmContent;
        this.alarmValue = alarmValue;
        this.device = device;
        this.deviceCode = deviceCode;
        this.wellCode = wellCode;
        this.alarmTime = alarmTime;
        this.status = "1";
        this.alarmMsg = alarmMsg;
    }

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }


    @Column(name = "JOB_ID")
    public Long getJobId() {
        return jobId;
    }

    public void setJobId(Long jobId) {
        this.jobId = jobId;
    }

    @Column(name = "ALARM_TYPE")
    public String getAlarmType() {
        return alarmType;
    }

    public void setAlarmType(String alarmType) {
        this.alarmType = alarmType;
    }

    @Column(name = "ALARM_CONTENT")
    public String getAlarmContent() {
        return alarmContent;
    }

    public void setAlarmContent(String alarmContent) {
        this.alarmContent = alarmContent;
    }

    @Column(name = "ALARM_VALUE")
    public String getAlarmValue() {
        return alarmValue;
    }

    public void setAlarmValue(String alarmValue) {
        this.alarmValue = alarmValue;
    }



    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "DEVICE_ID")
    @NotFound(action= NotFoundAction.IGNORE)
    public Device getDevice() {
        return device;
    }

    public void setDevice(Device device) {
        this.device = device;
    }

    @Column(name = "DEVCODE")
    public String getDeviceCode() {
        return deviceCode;
    }

    public void setDeviceCode(String deviceCode) {
        this.deviceCode = deviceCode;
    }

    @Column(name = "WELL_CODE")
    public String getWellCode() {
        return wellCode;
    }

    public void setWellCode(String wellCode) {
        this.wellCode = wellCode;
    }

    @Column(name = "ALARM_TIME")
    public Date getAlarmTime() {
        return alarmTime;
    }

    public void setAlarmTime(Date alarmTime) {
        this.alarmTime = alarmTime;
    }

    @Column(name = "STATUS")
    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    @Column(name = "ALARM_LEVEL")
    public Integer getAlarmLevel() {
        return alarmLevel;
    }

    public void setAlarmLevel(Integer alarmLevel) {
        this.alarmLevel = alarmLevel;
    }

    @Column(name = "ALARM_MSG")
    public String getAlarmMsg() {
        return alarmMsg;
    }

    public void setAlarmMsg(String alarmMsg) {
        this.alarmMsg = alarmMsg;
    }
}
