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

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

	/** 邀请码  */
	private String inviteCode;  
	/** 被邀请人姓名  */
	private String name;  
	/** 手机号  */
	private String phone;  
	/** 被邀请人id  */
	private Integer userId;  
	/** 邀请时间  */
	private java.util.Date inviteDate;

	@Id
	@SequenceGenerator(name="sequenceGenerator",sequenceName="USER_INVITE_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 = "invite_code", columnDefinition="VARCHAR2(8) " )
	public String getInviteCode()
	{
		return inviteCode;
	}
	
	public void setInviteCode(String inviteCode)
	{
		this.inviteCode= inviteCode;
	}
	
	
	@Column(name = "name", columnDefinition="VARCHAR2(20) " )
	public String getName()
	{
		return name;
	}
	
	public void setName(String name)
	{
		this.name= name;
	}
	
	
	@Column(name = "phone", columnDefinition="VARCHAR2(20) " )
	public String getPhone()
	{
		return phone;
	}
	
	public void setPhone(String phone)
	{
		this.phone= phone;
	}
	
	
	@Column(name = "user_id", columnDefinition="NUMBER(11) " )
	public Integer getUserId()
	{
		return userId;
	}
	
	public void setUserId(Integer userId)
	{
		this.userId= userId;
	}
	
	
	@Column(name = "inviteDate", columnDefinition="DATE " )
	public java.util.Date getInviteDate()
	{
		return inviteDate;
	}
	
	public void setInviteDate(java.util.Date inviteDate)
	{
		this.inviteDate= inviteDate;
	}
	
	
	 
	public Class entityClass()
	{
		return ENTITY_CLASS;
	}
	
	
 	protected StringBuilder toStringBuilder(StringBuilder sb)
 	{
 		return sb 
		.append(",id=").append(this.id)
		.append(",inviteCode=").append(this.inviteCode)
		.append(",name=").append(this.name)
		.append(",phone=").append(this.phone)
		.append(",userId=").append(this.userId)
		.append(",邀请时间=").append(this.inviteDate)
		.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("MgmInviteRecord[")).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.inviteCode!=null){ map.put("inviteCode",this.inviteCode);}
	     if(this.name!=null){ map.put("name",this.name);}
	     if(this.phone!=null){ map.put("phone",this.phone);}
	     if(this.userId!=null){ map.put("userId",this.userId);}
	     if(this.inviteDate!=null){ map.put("inviteDate",this.inviteDate);}
		 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(MgmInviteRecord en)
	{
		  if(this.id !=null){ en.setId(this.id);}
		  if(this.inviteCode !=null){ en.setInviteCode(this.inviteCode);}
		  if(this.name !=null){ en.setName(this.name);}
		  if(this.phone !=null){ en.setPhone(this.phone);}
		  if(this.userId !=null){ en.setUserId(this.userId);}
		  if(this.inviteDate !=null){ en.setInviteDate(this.inviteDate);}
		  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 MgmInviteRecord)) {
  	 		super.copyFrom(obj);
  	 	}else {
  	  		MgmInviteRecord bean=(MgmInviteRecord)obj;
			this.setId(bean.getId());
			this.setInviteCode(bean.getInviteCode());
			this.setName(bean.getName());
			this.setPhone(bean.getPhone());
			this.setUserId(bean.getUserId());
			this.setInviteDate(bean.getInviteDate());
	     	this.setAttr1(bean.getAttr1());
	     	this.setAttr2(bean.getAttr2());
	     	this.setAttr3(bean.getAttr3());
	     	this.setCreateDate(bean.getCreateDate());
	     	this.setModifyDate(bean.getModifyDate());
	     	this.setIsDelete(bean.getIsDelete());
     	}
 	 }
}

