package cn.estsh.i3plus.pojo.mes.bean;

import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;

/**
 * @Description:
 * @Reference:
 * @Author: Crish
 * @CreateDate:2019-04-16-17:36
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "MES_KEY_DATA")
@Api("设备关键数据")
public class MesKeyData extends BaseBean implements Serializable {
    private static final long serialVersionUID = 3843016083013276333L;
    @Column(name = "KEY_DATA_CODE")
    @ApiParam("关键数据代码")
    private String keyDataCode;

    @Column(name = "KEY_DATA_NAME")
    @ApiParam("关键数据名称")
    private String keyDataName;

    @Column(name = "UPPER_LIMIT", columnDefinition = "decimal(18,8)")
    @ColumnDefault("0")
    @ApiParam("数据上限")
    private Double upperLimit;

    @Column(name = "LOWER_LIMIT", columnDefinition = "decimal(18,8)")
    @ColumnDefault("0")
    @ApiParam("数据下限")
    private Double lowerLimit;

    public double getUpperLimitVal() {
        return this.upperLimit == null ? 0.0d : this.upperLimit;
    }

    public double getLowerLimitVal() {
        return this.lowerLimit == null ? 0.0d : this.lowerLimit;
    }
}
