package com.uas.search.model;

import java.io.Serializable;

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

/**
 * 器件对应的属性的值
 * 
 * @author suntg
 * @since 2016年3月11日下午2:24:29
 */
@Entity
@Table(name = "product$propertyvalue")
public class PropertyValue implements Serializable {

	/**
	 * 序列号
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * id
	 */
	@Id
	@Column(name = "pv_id")
	private Long id;

	/**
	 * 器件Id TODO 仅用于合并导出的器件和属性数据，jpa中不需要，后期可能会删除
	 */
	@Column(name = "pv_componentid")
	private Long componentid;

	/**
	 * 属性Id
	 */
	@Column(name = "pv_propertyid")
	private Long propertyid;

	/**
	 * 属性
	 */
	// TODO 索引未用到，确认无用后删除
	@OneToOne(cascade = { CascadeType.REFRESH })
	@JoinColumn(name = "pv_propertyid", insertable = false, updatable = false)
	private Property property;

	/**
	 * 排序 TODO jpa使用，之后换为jdbc后，需要删除
	 */
	@Column(name = "pv_detno")
	private Short detno;

	/**
	 * 属性的值
	 */
	@Column(name = "pv_value")
	private String value;

	public Long getId() {
		return id;
	}

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

	public Long getComponentid() {
		return componentid;
	}

	public void setComponentid(Long componentid) {
		this.componentid = componentid;
	}

	public Property getProperty() {
		return property;
	}

	public void setProperty(Property property) {
		this.property = property;
	}

	public Short getDetno() {
		return detno;
	}

	public void setDetno(Short detno) {
		this.detno = detno;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public Long getPropertyid() {
		return propertyid;
	}

	public void setPropertyid(Long propertyid) {
		this.propertyid = propertyid;
	}

	@Override
	public String toString() {
		return "PropertyValue [propertyid=" + propertyid + ", value=" + value + "]";
	}

}
