package org.cs.mgr.order.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Transient;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
import javax.persistence.Version;
import java.util.HashMap;
import java.math.BigDecimal;
import java.util.Map;
import java.util.Date;
import org.cs.core.model.BaseEntity;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

/**
 * 订单商品 
 * 
 * @ClassName: MgmOrderProduct 
 * @Description:  
 * @author: sunny_shi
 * @date: 2018-06-09 13:29:03
 */
@Table(name = "mgm_order_product")
@Entity
@DynamicInsert
@DynamicUpdate
public class MgmOrderProduct extends  BaseEntity {

    /**
	 * 
	 */
	private static final long serialVersionUID = 2977280057240540550L;
	private static final Class<MgmOrderProduct> ENTITY_CLASS = MgmOrderProduct.class;
    
	public MgmOrderProduct()
	{
	}

	/** 订单id  */
	private Integer orderId;  
	
	/** 产品id  */
	private String productId;  
	
	/** 产品名称  */
	private String productName;  
	/** 产品图片  */
	private String productImg;  
	/** 佣金比例  */
	private String commissionRate;  
	/** 实际佣金比例  */
	private Double commissionRateSj;  
	/** 溢出佣金比例  */
	private Double commissionRateYc;  
	/** 单价  */
	private String price;  
	/** 单位  */
	private String unit;  
	/** 意向数量  */
	private Integer willCnt;  
	/** 实际数量  */
	private Integer actualCnt;  
	/** 标准价  */
	private Double standardAmount;  
	/** 成交价  */
	private Double dealAmount;  
	
	//private Integer id;
	@Id
	@SequenceGenerator(name="sequenceGenerator",sequenceName="mgm_order_product_seq")
	@GeneratedValue(generator="sequenceGenerator",strategy=GenerationType.SEQUENCE)
	@Column(name = "id", unique = true, nullable = false, precision = 11, scale = 0)
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "order_id", columnDefinition="NUMBER " )
	public Integer getOrderId()
	{
		return orderId;
	}
	
	public void setOrderId(Integer orderId)
	{
		this.orderId= orderId;
	}
	
	
	@Column(name = "product_name", columnDefinition="VARCHAR2(50) " )
	public String getProductName()
	{
		return productName;
	}
	
	public void setProductName(String productName)
	{
		this.productName= productName;
	}
	
	
	@Column(name = "product_img", columnDefinition="VARCHAR(100) " )
	public String getProductImg()
	{
		return productImg;
	}
	
	public void setProductImg(String productImg)
	{
		this.productImg= productImg;
	}
	
	
	@Column(name = "commission_rate", columnDefinition="NUMBER(4,2) " )
	public String getCommissionRate()
	{
		return commissionRate;
	}
	
	public void setCommissionRate(String commissionRate)
	{
		this.commissionRate= commissionRate;
	}
	
	
	@Column(name = "commission_rate_sj", columnDefinition="NUMBER(4,2) " )
	public Double getCommissionRateSj()
	{
		return commissionRateSj;
	}
	
	public void setCommissionRateSj(Double commissionRateSj)
	{
		this.commissionRateSj= commissionRateSj;
	}
	
	
	@Column(name = "commission_rate_yc", columnDefinition="NUMBER(4,2) " )
	public Double getCommissionRateYc()
	{
		return commissionRateYc;
	}
	
	public void setCommissionRateYc(Double commissionRateYc)
	{
		this.commissionRateYc= commissionRateYc;
	}
	
	
	@Column(name = "price", columnDefinition="VARCHAR(20) " )
	public String getPrice()
	{
		return price;
	}
	
	public void setPrice(String price)
	{
		this.price= price;
	}
	
	
	@Column(name = "unit", columnDefinition="VARCHAR(10) " )
	public String getUnit()
	{
		return unit;
	}
	
	public void setUnit(String unit)
	{
		this.unit= unit;
	}
	
	
	@Column(name = "will_cnt", columnDefinition="NUMBER " )
	public Integer getWillCnt()
	{
		return willCnt;
	}
	
	public void setWillCnt(Integer willCnt)
	{
		this.willCnt= willCnt;
	}
	
	
	@Column(name = "actual_cnt", columnDefinition="NUMBER " )
	public Integer getActualCnt()
	{
		return actualCnt;
	}
	
	public void setActualCnt(Integer actualCnt)
	{
		this.actualCnt= actualCnt;
	}
	
	
	@Column(name = "standard_amount", columnDefinition="NUMBER " )
	public Double getStandardAmount()
	{
		return standardAmount;
	}
	
	public void setStandardAmount(Double standardAmount)
	{
		this.standardAmount= standardAmount;
	}
	
	
	@Column(name = "deal_amount", columnDefinition="NUMBER " )
	public Double getDealAmount()
	{
		return dealAmount;
	}
	
	public void setDealAmount(Double dealAmount)
	{
		this.dealAmount= dealAmount;
	}
	
	
	@Column(name = "product_id", columnDefinition="NUMBER " )
	public String getProductId() {
		return productId;
	}
	public void setProductId(String productId) {
		this.productId = productId;
	}
	
	 
	public Class entityClass()
	{
		return ENTITY_CLASS;
	}
	
	
 	protected StringBuilder toStringBuilder(StringBuilder sb)
 	{
 		return sb 
		.append(",id=").append(this.id)
		.append(",orderId=").append(this.orderId)
		.append(",productName=").append(this.productName)
		.append(",productImg=").append(this.productImg)
		.append(",commissionRate=").append(this.commissionRate)
		.append(",commissionRateSj=").append(this.commissionRateSj)
		.append(",commissionRateYc=").append(this.commissionRateYc)
		.append(",price=").append(this.price)
		.append(",unit=").append(this.unit)
		.append(",willCnt=").append(this.willCnt)
		.append(",actualCnt=").append(this.actualCnt)
		.append(",standardAmount=").append(this.standardAmount)
		.append(",dealAmount=").append(this.dealAmount)
		.append(",attr1=").append(this.attr1)
		.append(",attr2=").append(this.attr2)
		.append(",attr3=").append(this.attr3)
		.append(",createDate=").append(this.createDate)
		.append(",modifyDate=").append(this.modifyDate)
		.append(",isDelete=").append(this.isDelete)
		.append(",productId").append(this.productId)
		;
 	}
 	
 	
 	@Override
	public String toString()
	{
		return toStringBuilder(new StringBuilder().append("MgmOrderProduct[")).append(']').toString();
	}
	 
	
	public Map<String,Object> mapValue()
	{
	    Map<String,Object> map=new HashMap<String,Object>();
	     if(this.id!=null){ map.put("id",this.id);}
	     if(this.orderId!=null){ map.put("orderId",this.orderId);}
	     if(this.productName!=null){ map.put("productName",this.productName);}
	     if(this.productImg!=null){ map.put("productImg",this.productImg);}
	     if(this.commissionRate!=null){ map.put("commissionRate",this.commissionRate);}
	     if(this.commissionRateSj!=null){ map.put("commissionRateSj",this.commissionRateSj);}
	     if(this.commissionRateYc!=null){ map.put("commissionRateYc",this.commissionRateYc);}
	     if(this.price!=null){ map.put("price",this.price);}
	     if(this.unit!=null){ map.put("unit",this.unit);}
	     if(this.willCnt!=null){ map.put("willCnt",this.willCnt);}
	     if(this.actualCnt!=null){ map.put("actualCnt",this.actualCnt);}
	     if(this.standardAmount!=null){ map.put("standardAmount",this.standardAmount);}
	     if(this.dealAmount!=null){ map.put("dealAmount",this.dealAmount);}
		 if(this.attr1 !=null){ map.put("attr1", this.attr1);}
		 if(this.attr2 !=null){ map.put("attr2", this.attr2);}
		 if(this.attr3 !=null){ map.put("attr3", this.attr3);}
		 if(this.createDate != null){ map.put("createDate", this.createDate);}
		 if(this.modifyDate != null){ map.put("modifyDate", this.modifyDate);}
		 if(this.isDelete != null){ map.put("isDelete", this.isDelete);}
		 if(this.productId!=null) {map.put("productId",this.productId);}
		return map;
	}
	
	public void mergeTo(MgmOrderProduct en)
	{
		  if(this.id !=null){ en.setId(this.id);}
		  if(this.orderId !=null){ en.setOrderId(this.orderId);}
		  if(this.productName !=null){ en.setProductName(this.productName);}
		  if(this.productImg !=null){ en.setProductImg(this.productImg);}
		  if(this.commissionRate !=null){ en.setCommissionRate(this.commissionRate);}
		  if(this.commissionRateSj !=null){ en.setCommissionRateSj(this.commissionRateSj);}
		  if(this.commissionRateYc !=null){ en.setCommissionRateYc(this.commissionRateYc);}
		  if(this.price !=null){ en.setPrice(this.price);}
		  if(this.unit !=null){ en.setUnit(this.unit);}
		  if(this.willCnt !=null){ en.setWillCnt(this.willCnt);}
		  if(this.actualCnt !=null){ en.setActualCnt(this.actualCnt);}
		  if(this.standardAmount !=null){ en.setStandardAmount(this.standardAmount);}
		  if(this.dealAmount !=null){ en.setDealAmount(this.dealAmount);}
		  if(this.attr1!=null){ en.setAttr1(this.attr1);}
		  if(this.attr2!=null){ en.setAttr2(this.attr2);}
		  if(this.attr3!=null){ en.setAttr3(this.attr3);}
		  if(this.createDate != null){ en.setCreateDate(this.createDate);}
		  if(this.modifyDate != null){ en.setModifyDate(this.modifyDate);}
		  if(this.isDelete != null){ en.setIsDelete(this.isDelete);}
		  if(this.productId!=null) {en.setProductId(this.productId);}
	}
	
  	@Override
  	public void copyFrom(Object obj)
  	{  
  		 if(!(obj instanceof MgmOrderProduct)) {
  	 		super.copyFrom(obj);
  	 	}else {
  	  		MgmOrderProduct bean=(MgmOrderProduct)obj;
			this.setId(bean.getId());
			this.setOrderId(bean.getOrderId());
			this.setProductName(bean.getProductName());
			this.setProductImg(bean.getProductImg());
			this.setCommissionRate(bean.getCommissionRate());
			this.setCommissionRateSj(bean.getCommissionRateSj());
			this.setCommissionRateYc(bean.getCommissionRateYc());
			this.setPrice(bean.getPrice());
			this.setUnit(bean.getUnit());
			this.setWillCnt(bean.getWillCnt());
			this.setActualCnt(bean.getActualCnt());
			this.setStandardAmount(bean.getStandardAmount());
			this.setDealAmount(bean.getDealAmount());
	     	this.setAttr1(bean.getAttr1());
	     	this.setAttr2(bean.getAttr2());
	     	this.setAttr3(bean.getAttr3());
	     	this.setCreateDate(bean.getCreateDate());
	     	this.setModifyDate(bean.getModifyDate());
	     	this.setIsDelete(bean.getIsDelete());
	     	this.setProductId(bean.getProductId());
     	}
 	 }
  	
  	
}
