package com.uas.platform.b2b.history.model;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.OrderBy;
import javax.persistence.Table;

import org.codehaus.jackson.annotate.JsonIgnore;

import com.uas.platform.b2b.model.Enterprise;

/**
 * 客户采购询价单（历史数据）
 * 
 * @author yingp
 *
 */
@Table(name = "purc$inquiry$his")
@Entity(name = "PurchaseInquiryHistory")
public class PurchaseInquiry implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 2147648497108840786L;

	@Id
	@Column(name = "in_id")
	private Long id;

	/**
	 * 询价单所属企业UU
	 */
	@Column(name = "in_enuu")
	private Long enUU;
	
	/**
	 * 询价单所属用户UU
	 */
	@Column(name = "in_recorderuu")
	private Long recorderUU;

	/**
	 * 询价企业
	 */
	@OneToOne(cascade = { CascadeType.MERGE })
	@JoinColumn(name = "in_enuu", insertable = false, updatable = false)
	private Enterprise enterprise;

	/**
	 * 流水号
	 */
	@Column(name = "in_code")
	private String code;

	/**
	 * 单据归属日期
	 */
	@Column(name = "in_date")
	private Date date;

	/**
	 * 录入人
	 */
	@Column(name = "in_recorder")
	private String recorder;

	/**
	 * 审核人
	 */
	@Column(name = "in_auditor")
	private String auditor;

	/**
	 * 报价截止日期
	 */
	@Column(name = "in_enddate")
	private Date endDate;

	/**
	 * 备注
	 */
	@Column(name = "in_remark")
	private String remark;

	/**
	 * 询价明细
	 */
	@OneToMany(mappedBy = "inquiry", cascade = { CascadeType.REFRESH, CascadeType.PERSIST, CascadeType.REMOVE, CascadeType.MERGE }, fetch = FetchType.EAGER)
	@OrderBy("number")
	private Set<PurchaseInquiryItem> inquiryItems;

	public Long getId() {
		return id;
	}

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

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public String getRecorder() {
		return recorder;
	}

	public void setRecorder(String recorder) {
		this.recorder = recorder;
	}

	public String getAuditor() {
		return auditor;
	}

	public void setAuditor(String auditor) {
		this.auditor = auditor;
	}

	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public Long getEnUU() {
		return enUU;
	}

	public void setEnUU(Long enUU) {
		this.enUU = enUU;
	}

	public Enterprise getEnterprise() {
		return enterprise;
	}

	public void setEnterprise(Enterprise enterprise) {
		this.enterprise = enterprise;
	}

	public Long getRecorderUU() {
		return recorderUU;
	}

	public void setRecorderUU(Long recorderUU) {
		this.recorderUU = recorderUU;
	}

	@JsonIgnore
	public Set<PurchaseInquiryItem> getInquiryItems() {
		return inquiryItems;
	}

	public void setInquiryItems(Set<PurchaseInquiryItem> inquiryItems) {
		this.inquiryItems = inquiryItems;
	}

}