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: MgmOrderTransfer 
 * @Description:  
 * @author: sunny_shi
 * @date: 2018-06-09 13:29:03
 */
@Table(name = "mgm_order_transfer")
@Entity
@DynamicInsert
@DynamicUpdate
public class MgmOrderTransfer extends  BaseEntity {

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

	/** 订单id  */
	private Integer orderId;  
	/** 订单状态  */
	private String orderState;  
	/** 原销售id  */
	private Integer fromUserid;  
	/** 原销售姓名  */
	private String fromUsename;  
	/** 现销售id  */
	private Integer toUserid;  
	/** 现销售姓名  */
	private String toUsername;  
	/** 转单类型 离职/换人  */
	private String type;  
	/** 转单原因  */
	private String reason;  
	/** 转单时间  */
	private java.util.Date transferTime;  
	
	//private Integer id;
	@Id
	@SequenceGenerator(name="sequenceGenerator",sequenceName="mgm_order_transfer_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 = "order_state", columnDefinition="CHAR(1) " )
	public String getOrderState()
	{
		return orderState;
	}
	
	public void setOrderState(String orderState)
	{
		this.orderState= orderState;
	}
	
	
	@Column(name = "from_userid", columnDefinition="NUMBER " )
	public Integer getFromUserid()
	{
		return fromUserid;
	}
	
	public void setFromUserid(Integer fromUserid)
	{
		this.fromUserid= fromUserid;
	}
	
	
	@Column(name = "from_usename", columnDefinition="VARCHAR2(20) " )
	public String getFromUsename()
	{
		return fromUsename;
	}
	
	public void setFromUsename(String fromUsename)
	{
		this.fromUsename= fromUsename;
	}
	
	
	@Column(name = "to_userid", columnDefinition="NUMBER " )
	public Integer getToUserid()
	{
		return toUserid;
	}
	
	public void setToUserid(Integer toUserid)
	{
		this.toUserid= toUserid;
	}
	
	
	@Column(name = "to_username", columnDefinition="VARCHAR2(20) " )
	public String getToUsername()
	{
		return toUsername;
	}
	
	public void setToUsername(String toUsername)
	{
		this.toUsername= toUsername;
	}
	
	
	@Column(name = "type", columnDefinition="CHAR(10) " )
	public String getType()
	{
		return type;
	}
	
	public void setType(String type)
	{
		this.type= type;
	}
	
	
	@Column(name = "reason", columnDefinition="VARCHAR2(100) " )
	public String getReason()
	{
		return reason;
	}
	
	public void setReason(String reason)
	{
		this.reason= reason;
	}
	
	
	@Column(name = "transfer_time", columnDefinition="DATE " )
	public java.util.Date getTransferTime()
	{
		return transferTime;
	}
	
	public void setTransferTime(java.util.Date transferTime)
	{
		this.transferTime= transferTime;
	}
	
	
	 
	public Class entityClass()
	{
		return ENTITY_CLASS;
	}
	
	
 	protected StringBuilder toStringBuilder(StringBuilder sb)
 	{
 		return sb 
		.append(",id=").append(this.id)
		.append(",orderId=").append(this.orderId)
		.append(",orderState=").append(this.orderState)
		.append(",fromUserid=").append(this.fromUserid)
		.append(",fromUsename=").append(this.fromUsename)
		.append(",toUserid=").append(this.toUserid)
		.append(",toUsername=").append(this.toUsername)
		.append(",type=").append(this.type)
		.append(",reason=").append(this.reason)
		.append(",transferTime=").append(this.transferTime)
		.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)
		;
 	}
 	
 	
 	@Override
	public String toString()
	{
		return toStringBuilder(new StringBuilder().append("MgmOrderTransfer[")).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.orderState!=null){ map.put("orderState",this.orderState);}
	     if(this.fromUserid!=null){ map.put("fromUserid",this.fromUserid);}
	     if(this.fromUsename!=null){ map.put("fromUsename",this.fromUsename);}
	     if(this.toUserid!=null){ map.put("toUserid",this.toUserid);}
	     if(this.toUsername!=null){ map.put("toUsername",this.toUsername);}
	     if(this.type!=null){ map.put("type",this.type);}
	     if(this.reason!=null){ map.put("reason",this.reason);}
	     if(this.transferTime!=null){ map.put("transferTime",this.transferTime);}
		 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);}
		return map;
	}
	
	public void mergeTo(MgmOrderTransfer en)
	{
		  if(this.id !=null){ en.setId(this.id);}
		  if(this.orderId !=null){ en.setOrderId(this.orderId);}
		  if(this.orderState !=null){ en.setOrderState(this.orderState);}
		  if(this.fromUserid !=null){ en.setFromUserid(this.fromUserid);}
		  if(this.fromUsename !=null){ en.setFromUsename(this.fromUsename);}
		  if(this.toUserid !=null){ en.setToUserid(this.toUserid);}
		  if(this.toUsername !=null){ en.setToUsername(this.toUsername);}
		  if(this.type !=null){ en.setType(this.type);}
		  if(this.reason !=null){ en.setReason(this.reason);}
		  if(this.transferTime !=null){ en.setTransferTime(this.transferTime);}
		  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);}
	}
	
  	@Override
  	public void copyFrom(Object obj)
  	{  
  		 if(!(obj instanceof MgmOrderTransfer)) {
  	 		super.copyFrom(obj);
  	 	}else {
  	  		MgmOrderTransfer bean=(MgmOrderTransfer)obj;
			this.setId(bean.getId());
			this.setOrderId(bean.getOrderId());
			this.setOrderState(bean.getOrderState());
			this.setFromUserid(bean.getFromUserid());
			this.setFromUsename(bean.getFromUsename());
			this.setToUserid(bean.getToUserid());
			this.setToUsername(bean.getToUsername());
			this.setType(bean.getType());
			this.setReason(bean.getReason());
			this.setTransferTime(bean.getTransferTime());
     	this.setAttr1(bean.getAttr1());
     	this.setAttr2(bean.getAttr2());
     	this.setAttr3(bean.getAttr3());
     	this.setCreateDate(bean.getCreateDate());
     	this.setModifyDate(bean.getModifyDate());
     	this.setIsDelete(bean.getIsDelete());
     	}
 	 }
}
