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

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

	/** 银行名  */
	private String bankName;  
	/** 支行  */
	private String bankBranch;  
	/** 卡号  */
	private String bankNo;  
	/** 姓名  */
	private String username;  
	/** 省  */
	private String province;  
	/** 市  */
	private String city;  
	/** 区  */
	private String area;
	/** 用户ID  */
	private String userId;

	@Id
	@SequenceGenerator(name="sequenceGenerator",sequenceName="USERBANK_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 = "bank_name", columnDefinition="VARCHAR2(20) " )
	public String getBankName()
	{
		return bankName;
	}
	
	public void setBankName(String bankName)
	{
		this.bankName= bankName;
	}
	
	
	@Column(name = "bank_branch", columnDefinition="VARCHAR2(50) " )
	public String getBankBranch()
	{
		return bankBranch;
	}
	
	public void setBankBranch(String bankBranch)
	{
		this.bankBranch= bankBranch;
	}
	
	
	@Column(name = "bank_no", columnDefinition="VARCHAR2(40) " )
	public String getBankNo()
	{
		return bankNo;
	}
	
	public void setBankNo(String bankNo)
	{
		this.bankNo= bankNo;
	}
	
	
	@Column(name = "username", columnDefinition="VARCHAR2(10) " )
	public String getUsername()
	{
		return username;
	}
	
	public void setUsername(String username)
	{
		this.username= username;
	}
	
	
	@Column(name = "province", columnDefinition="VARCHAR2(10) " )
	public String getProvince()
	{
		return province;
	}
	
	public void setProvince(String province)
	{
		this.province= province;
	}
	
	
	@Column(name = "city", columnDefinition="VARCHAR2(10) " )
	public String getCity()
	{
		return city;
	}
	
	public void setCity(String city)
	{
		this.city= city;
	}
	
	
	@Column(name = "area", columnDefinition="VARCHAR2(15) " )
	public String getArea()
	{
		return area;
	}
	
	public void setArea(String area)
	{
		this.area= area;
	}
	
	@Column(name = "userId", columnDefinition="VARCHAR2(15) " )
	public String getUserId() {
		return userId;
	}
	
	public void setUserId(String userId) {
		this.userId = userId;
	}
	
	public Class entityClass()
	{
		return ENTITY_CLASS;
	}
	
	
 	protected StringBuilder toStringBuilder(StringBuilder sb)
 	{
 		return sb 
		.append(",id=").append(this.id)
		.append(",bankName=").append(this.bankName)
		.append(",bankBranch=").append(this.bankBranch)
		.append(",bankNo=").append(this.bankNo)
		.append(",username=").append(this.username)
		.append(",province=").append(this.province)
		.append(",city=").append(this.city)
		.append(",area=").append(this.area)
		.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("MgmUserBank[")).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.bankName!=null){ map.put("bankName",this.bankName);}
	     if(this.bankBranch!=null){ map.put("bankBranch",this.bankBranch);}
	     if(this.bankNo!=null){ map.put("bankNo",this.bankNo);}
	     if(this.username!=null){ map.put("username",this.username);}
	     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.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(MgmUserBank en)
	{
		  if(this.id !=null){ en.setId(this.id);}
		  if(this.bankName !=null){ en.setBankName(this.bankName);}
		  if(this.bankBranch !=null){ en.setBankBranch(this.bankBranch);}
		  if(this.bankNo !=null){ en.setBankNo(this.bankNo);}
		  if(this.username !=null){ en.setUsername(this.username);}
		  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.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 MgmUserBank)) {
  	 		super.copyFrom(obj);
  	 	}else {
  	  		MgmUserBank bean=(MgmUserBank)obj;
			this.setId(bean.getId());
			this.setBankName(bean.getBankName());
			this.setBankBranch(bean.getBankBranch());
			this.setBankNo(bean.getBankNo());
			this.setUsername(bean.getUsername());
			this.setProvince(bean.getProvince());
			this.setCity(bean.getCity());
			this.setArea(bean.getArea());
     	this.setAttr1(bean.getAttr1());
     	this.setAttr2(bean.getAttr2());
     	this.setAttr3(bean.getAttr3());
     	this.setCreateDate(bean.getCreateDate());
     	this.setModifyDate(bean.getModifyDate());
     	this.setIsDelete(bean.getIsDelete());
     	}
 	 }
}
