package com.casic.PgInterface.construction.domain;

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

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

/**
 * Created by zxh on 2018/3/23.
 */
@Entity
@Table(name = "PG_CONSTRUCTION")
@SequenceGenerator(name = "SEQ_PG_CONSTRUCTION_ID", sequenceName = "SEQ_PG_CONSTRUCTION_ID", allocationSize = 1,initialValue = 1)
public class PgConstruction implements Serializable{

    private static final long serialVersionUID = 1L;
    private long id;
    private String cs_name;//项目名称
    private String cs_detail;//施工内容
    private Date cs_beginTime;//施工开始时间
    private Date cs_endTime;//施工结束时间
    private String cs_charge;//施工负责人
    private String cs_phone;//联系方式
    private String cs_type;//工程类别
    private PgPartition pgPartitionId;//施工区域
    private PgConstructionType pgConstructionTypeId;//项目状态
    private List<PgCsDocument> pgCsDocumentList;//施工文档
    private int active;//状态位

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

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

    @Column(name = "CS_NAME")
    public String getCs_name(){ return cs_name; }

    public void setCs_name(String cs_name){ this.cs_name = cs_name; }

    @Column(name = "CS_DETAIL")
    public String getCs_detail(){ return cs_detail; }

    public void setCs_detail(String cs_detail){ this.cs_detail = cs_detail; }

    @Column(name = "CS_BEGINTIME")
    public Date getCs_beginTime(){ return cs_beginTime; }

    public void setCs_beginTime(Date cs_beginTime){ this.cs_beginTime = cs_beginTime; }

    @Column(name = "CS_ENDTIME")
    public Date getCs_endTime(){ return cs_endTime; }

    public void setCs_endTime(Date cs_endTime){ this.cs_endTime = cs_endTime; }

    @Column(name = "CS_CHARGE")
    public String getCs_charge(){ return cs_charge; }

    public void setCs_charge(String cs_charge){ this.cs_charge = cs_charge; }

    @Column(name = "CS_PHONE")
    public String getCs_phone(){ return cs_phone; }

    public void setCs_phone(String cs_phone){ this.cs_phone = cs_phone; }

    @Column(name = "CS_TYPE")
    public String getCs_type(){ return cs_type; }

    public void setCs_type(String cs_type){ this.cs_type = cs_type; }

    @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
    @NotFound(action = NotFoundAction.IGNORE)
    @JoinColumn(name = "PAPARTITION_ID")
    public PgPartition getPgPartitionId() {
        return pgPartitionId;
    }

    public void setPgPartitionId(PgPartition pgPartitionId) {
        this.pgPartitionId = pgPartitionId;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgConstructionId")
    public List<PgCsDocument> getPgCsDocumentList() {
        return pgCsDocumentList;
    }

    public void setPgCsDocumentList(List<PgCsDocument> pgCsDocumentList) {
        this.pgCsDocumentList = pgCsDocumentList;
    }

    @ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST})
    @NotFound(action = NotFoundAction.IGNORE)
    @JoinColumn(name = "PGCONSTRUCTIONTYPE_ID")
    public PgConstructionType getPgConstructionTypeId() {
        return pgConstructionTypeId;
    }

    public void setPgConstructionTypeId(PgConstructionType pgConstructionTypeId) {
        this.pgConstructionTypeId = pgConstructionTypeId;
    }

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

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

}
