package com.casic.PgInterface.devTable.domain;

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

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

/**
 * Created by yxw on 2017/10/30.
 */
@Entity
@Table(name = "PG_PIPELINE")
@SequenceGenerator(name = "SEQ_PG_PIPELINE_ID", sequenceName = "SEQ_PG_PIPELINE_ID", allocationSize = 1, initialValue = 1)
public class PgPipeLine implements Serializable {
    private static final long serialVersionUID = 1L;
    private long id;
    private String lineName;//管线唯一名称
    private String lineType;//管线类型
    private String ownerUnit;//权属单位
    private Date enterDate;//入廊时间
    private String layerNum;//所在层数
    private String diameter;//管径
    private double pipeLength;//管线长度
    private PipeGallery pipeGalleryId;//所在管廊信息
    private int active;//状态位

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

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

    @Column(name = "LINE_NAME")
    public String getLineName() {
        return lineName;
    }

    public void setLineName(String lineName) {
        this.lineName = lineName;
    }

    @Column(name = "LINE_TYPE")
    public String getLineType() {
        return lineType;
    }

    public void setLineType(String lineType) {
        this.lineType = lineType;
    }

    @Column(name = "OWNERUNIT")
    public String getOwnerUnit() {
        return ownerUnit;
    }

    public void setOwnerUnit(String ownerUnit) {
        this.ownerUnit = ownerUnit;
    }

    @Column(name = "ENTERDATE")
    public Date getEnterDate() {
        return enterDate;
    }

    public void setEnterDate(Date enterDate) {
        this.enterDate = enterDate;
    }

    @Column(name = "LAYERNUM")
    public String getLayerNum() {
        return layerNum;
    }

    public void setLayerNum(String layerNum) {
        this.layerNum = layerNum;
    }

    @Column(name = "DIAMETER")
    public String getDiameter() {
        return diameter;
    }

    public void setDiameter(String diameter) {
        this.diameter = diameter;
    }

    @Column(name = "PIPE_LENGTH")
    public double getPipeLength() {
        return pipeLength;
    }

    public void setPipeLength(double pipeLength) {
        this.pipeLength = pipeLength;
    }

    @Column(name = "ACTIVE")
    public int getActive() {
        return active;
    }

    public void setActive(int active) {
        this.active = active;
    }

    @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
    @NotFound(action = NotFoundAction.IGNORE)
    @JoinColumn(name = "PGID")
    public PipeGallery getPipeGalleryId() {
        return pipeGalleryId;
    }

    public void setPipeGalleryId(PipeGallery pipeGalleryId) {
        this.pipeGalleryId = pipeGalleryId;
    }
}
