package com.casic.PgInterface.patroler.domain;

import com.casic.PgInterface.devTable.domain.PgAlarmType;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

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

/**
 * Created by yxw on 2017/12/14.
 */
@Entity
@Table(name = "PG_ALARM_RULE")
@SequenceGenerator(name = "SEQ_PG_ALARM_RULE_ID", sequenceName = "SEQ_PG_ALARM_RULE_ID",allocationSize=1,initialValue=1)
public class PgAlarmRule implements Serializable {

    private static final long serialVersionUID = 1L;
    private long id;
    private String highValue;//高限
    private String lowValue;//低限
    private String unit;//单位
    private String devType;//设备类型
    private PgAlarmType alarmTypeId;//报警类型

    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_ALARM_RULE_ID")
    public long getId() {
        return id;
    }

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

    @Column(name = "HIGHVALUE")
    public String getHighValue() {
        return highValue;
    }

    public void setHighValue(String highValue) {
        this.highValue = highValue;
    }

    @Column(name = "LOWVALUE")
    public String getLowValue() {
        return lowValue;
    }

    public void setLowValue(String lowValue) {
        this.lowValue = lowValue;
    }

    @Column(name="UNIT")
    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    @Column(name = "DEVTYPE")
    public String getDevType() {
        return devType;
    }

    public void setDevType(String devType) {
        this.devType = devType;
    }

    @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
    @NotFound(action = NotFoundAction.IGNORE)
    @JoinColumn(name = "ALARMTYPEID")
    public PgAlarmType getAlarmTypeId() {
        return alarmTypeId;
    }

    public void setAlarmTypeId(PgAlarmType alarmTypeId) {
        this.alarmTypeId = alarmTypeId;
    }
}
