package org.cs.mgr.user.model;
import javax.persistence.*;
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: MgmCustomer 
 * @Description:  
 * @author: sunny_shi
 * @date: 2018-06-09 13:28:56
 */
@Table(name = "mgm_customer")
@Entity
@DynamicInsert
@DynamicUpdate
public class MgmCustomer extends  BaseEntity {

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

	private static final Class<MgmCustomer> ENTITY_CLASS = MgmCustomer.class;
    
	public MgmCustomer()
	{
	}

	/** 姓名  */
	private String name;  
	/** 联系电话  */
	private String phone;  
	/** 所在单位  */
	private String company;  
	/** 所在区域  */
	private String attributionArea;  
	/** 省  */
	private String province;  
	/** 市  */
	private String city;  
	/** 区  */
	private String area;  
	/** 地址  */
	private String address;  
	/** 推介人  */
	private Integer recommendId;  
	/** 是否待定  */
	private String state;

	/**客户备注*/
	private String remarks;
	
	@Id
	@SequenceGenerator(name="sequenceGenerator",sequenceName="CUSTOMER_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 = "name", columnDefinition="VARCHAR2(30) " )
	public String getName()
	{
		return name;
	}
	
	public void setName(String name)
	{
		this.name= name;
	}
	
	
	@Column(name = "phone", columnDefinition="VARCHAR2(30) " )
	public String getPhone()
	{
		return phone;
	}
	
	public void setPhone(String phone)
	{
		this.phone= phone;
	}
	
	
	@Column(name = "company", columnDefinition="VARCHAR2(100) " )
	public String getCompany()
	{
		return company;
	}
	
	public void setCompany(String company)
	{
		this.company= company;
	}
	
	
	
	@Column(name = "province", columnDefinition="VARCHAR2(30) " )
	public String getProvince()
	{
		return province;
	}
	
	public void setProvince(String province)
	{
		this.province= province;
	}
	
	
	@Column(name = "city", columnDefinition="VARCHAR2(30) " )
	public String getCity()
	{
		return city;
	}
	
	public void setCity(String city)
	{
		this.city= city;
	}
	
	
	@Column(name = "area", columnDefinition="VARCHAR2(30) " )
	public String getArea()
	{
		return area;
	}
	
	public void setArea(String area)
	{
		this.area= area;
	}
	
	
	@Column(name = "address", columnDefinition="VARCHAR2(110) " )
	public String getAddress()
	{
		return address;
	}
	
	public void setAddress(String address)
	{
		this.address= address;
	}
	
	
	@Column(name = "recommend_id", columnDefinition="NUMBER " )
	public Integer getRecommendId()
	{
		return recommendId;
	}
	
	public void setRecommendId(Integer recommendId)
	{
		this.recommendId= recommendId;
	}
	
	
	@Column(name = "state", columnDefinition="CHAR(1) " )
	public String getState()
	{
		return state;
	}
	
	public void setState(String state)
	{
		this.state= state;
	}
	
	@Column(name = "attribution_area", columnDefinition="VARCHAR2(100) " )
	public String getAttributionArea() {
		return attributionArea;
	}
	public void setAttributionArea(String attributionArea) {
		this.attributionArea = attributionArea;
	}
	
	@Column(name = "remarks", columnDefinition="VARCHAR2(800) " )
	public String getRemarks() {
		return remarks;
	}
	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}
	
	
	public Class entityClass()
	{
		return ENTITY_CLASS;
	}
	
	
 	protected StringBuilder toStringBuilder(StringBuilder sb)
 	{
 		return sb 
		.append(",id=").append(this.id)
		.append(",name=").append(this.name)
		.append(",phone=").append(this.phone)
		.append(",company=").append(this.company)
		//.append(",所在区域=").append(this.所在区域)
		.append(",attributionArea").append(this.attributionArea)
		.append(",province=").append(this.province)
		.append(",city=").append(this.city)
		.append(",area=").append(this.area)
		.append(",address=").append(this.address)
		.append(",recommendId=").append(this.recommendId)
		.append(",state=").append(this.state)
		.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(",remarks").append(this.remarks)
		;
 	}
 	
 	
 	@Override
	public String toString()
	{
		return toStringBuilder(new StringBuilder().append("MgmCustomer[")).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.name!=null){ map.put("name",this.name);}
	     if(this.phone!=null){ map.put("phone",this.phone);}
	     if(this.company!=null){ map.put("company",this.company);}
	     if(this.attributionArea!=null){ map.put("attributionArea",this.attributionArea);}
	     
	     if(this.province!=null){ map.put("province",this.province);}
	     if(this.city!=null){ map.put("city",this.city);}
	     if(this.area!=null){ map.put("area",this.area);}
	     if(this.address!=null){ map.put("address",this.address);}
	     if(this.recommendId!=null){ map.put("recommendId",this.recommendId);}
	     if(this.state!=null){ map.put("state",this.state);}
		 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.remarks !=  null) {map.put("remarks", this.remarks);}
		return map;
	}
	
	public void mergeTo(MgmCustomer en)
	{
		  if(this.id !=null){ en.setId(this.id);}
		  if(this.name !=null){ en.setName(this.name);}
		  if(this.phone !=null){ en.setPhone(this.phone);}
		  if(this.company !=null){ en.setCompany(this.company);}
		  if(this.attributionArea !=null){ en.setAttributionArea(this.attributionArea);}
		  if(this.province !=null){ en.setProvince(this.province);}
		  if(this.city !=null){ en.setCity(this.city);}
		  if(this.area !=null){ en.setArea(this.area);}
		  if(this.address !=null){ en.setAddress(this.address);}
		  if(this.recommendId !=null){ en.setRecommendId(this.recommendId);}
		  if(this.state !=null){ en.setState(this.state);}
		  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.remarks!=null) {en.setRemarks(this.remarks);}
	}
	
  	@Override
  	public void copyFrom(Object obj)
  	{  
  		 if(!(obj instanceof MgmCustomer)) {
  	 		super.copyFrom(obj);
  	 	}else {
  	  		MgmCustomer bean=(MgmCustomer)obj; 	  			
  	  		this.setId(bean.getId());
			this.setId(bean.getId());
			this.setName(bean.getName());
			this.setPhone(bean.getPhone());
			this.setCompany(bean.getCompany());
			this.setAttributionArea(bean.getAttributionArea());
			this.setProvince(bean.getProvince());
			this.setCity(bean.getCity());
			this.setArea(bean.getArea());
			this.setAddress(bean.getAddress());
			this.setRecommendId(bean.getRecommendId());
			this.setState(bean.getState());
	     	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.setRemarks(bean.getRemarks());
     	}
 	 }
	
	
}
