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

    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private static final Class<MgmUser> ENTITY_CLASS = MgmUser.class;
    
	public MgmUser()
	{
	}
     
	/** 用户类型  */
	private String type;  //0.集团用户 1.非集团用户
	/** 人员编码  */
	private String personnelcode;  
	/** 密码  */
	private String pwd;  
	/** 姓名  */
	private String name;  
	/** 部门名称  */
	private String deptName;  
	/** 部门编号  */
	private String deptCode;  
	/** 部门全路径  */
	private String deptPath;  
	/** 性别  */
	private String sex;  
	/** 邮箱  */
	private String mail;  
	/** 手机号  */
	private String phone;  
	/** 身份证号  */
	private String idnumber;  
	/** 人员状态  */
	private String state;  
	/** 人员分类  */
	private String classify;  
	/** 职业通道  */
	private String careerpath;  
	/** 职务  */
	private String post;  
	/** 职位  */
	private String job;  
	/** 职级  */
	private String professionallevel;  
	/** 入职日期  */
	private java.util.Date joineddate;  
	/** 生日  */
	private java.util.Date birthday;  
	/** 国籍  */
	private String country;  
	/** 微信  */
	private String weixin;  
	/** qq  */
	private String qq;  
	/** 住址  */
	private String address;  
	/** 邀请码  */
	private String invitecode;  
	/** 是否首次登录  */
	private String firstLogin;   //0首次登陆 1非首次登陆
	/** 是否销售  */
	private String isSaler;
	/** 省**/
	private String province;
	/** 市**/
	private String city;
	/** 区**/
	private String area;
	/** 极光推送ID */
	private String clientId;
	/** 二维码路径*/
	private String imgURL;
	
	/** 验证码  */
	private String code;
	
	/** 佣金金额  */
	private BigDecimal sum;
	
	
	@Id
	@SequenceGenerator(name="sequenceGenerator",sequenceName="USER_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 = "type", columnDefinition="CHAR(1) " )
	public String getType()
	{
		return type;
	}
	
	public void setType(String type)
	{
		this.type= type;
	}
	
	
	@Column(name = "personnelcode", columnDefinition="VARCHAR2(40) " )
	public String getPersonnelcode()
	{
		return personnelcode;
	}
	
	public void setPersonnelcode(String personnelcode)
	{
		this.personnelcode= personnelcode;
	}
	
	
	@Column(name = "pwd", columnDefinition="VARCHAR2(100) " )
	public String getPwd()
	{
		return pwd;
	}
	
	public void setPwd(String pwd)
	{
		this.pwd= pwd;
	}
	
	
	@Column(name = "name", columnDefinition="VARCHAR2(40) " )
	public String getName()
	{
		return name;
	}
	
	public void setName(String name)
	{
		this.name= name;
	}
	
	
	@Column(name = "dept_name", columnDefinition="VARCHAR2(50) " )
	public String getDeptName()
	{
		return deptName;
	}
	
	public void setDeptName(String deptName)
	{
		this.deptName= deptName;
	}
	
	
	@Column(name = "dept_code", columnDefinition="VARCHAR2(30) " )
	public String getDeptCode()
	{
		return deptCode;
	}
	
	public void setDeptCode(String deptCode)
	{
		this.deptCode= deptCode;
	}
	
	
	@Column(name = "dept_path", columnDefinition="VARCHAR2(100) " )
	public String getDeptPath()
	{
		return deptPath;
	}
	
	public void setDeptPath(String deptPath)
	{
		this.deptPath= deptPath;
	}
	
	
	@Column(name = "sex", columnDefinition="CHAR(1) " )
	public String getSex()
	{
		return sex;
	}
	
	public void setSex(String sex)
	{
		this.sex= sex;
	}
	
	
	@Column(name = "mail", columnDefinition="VARCHAR2(80) " )
	public String getMail()
	{
		return mail;
	}
	
	public void setMail(String mail)
	{
		this.mail= mail;
	}
	
	
	@Column(name = "phone", columnDefinition="VARCHAR2(20) " )
	public String getPhone()
	{
		return phone;
	}
	
	public void setPhone(String phone)
	{
		this.phone= phone;
	}
	
	
	@Column(name = "idnumber", columnDefinition="CHAR(18) " )
	public String getIdnumber()
	{
		return idnumber;
	}
	
	public void setIdnumber(String idnumber)
	{
		this.idnumber= idnumber;
	}
	
	
	@Column(name = "state", columnDefinition="CHAR(1) " )
	public String getState()
	{
		return state;
	}
	
	public void setState(String state)
	{
		this.state= state;
	}
	
	
	@Column(name = "classify", columnDefinition="VARCHAR2(10) " )
	public String getClassify()
	{
		return classify;
	}
	
	public void setClassify(String classify)
	{
		this.classify= classify;
	}
	
	
	@Column(name = "careerpath", columnDefinition="VARCHAR2(10) " )
	public String getCareerpath()
	{
		return careerpath;
	}
	
	public void setCareerpath(String careerpath)
	{
		this.careerpath= careerpath;
	}
	
	
	@Column(name = "post", columnDefinition="VARCHAR2(20) " )
	public String getPost()
	{
		return post;
	}
	
	public void setPost(String post)
	{
		this.post= post;
	}
	
	
	@Column(name = "job", columnDefinition="VARCHAR2(20) " )
	public String getJob()
	{
		return job;
	}
	
	public void setJob(String job)
	{
		this.job= job;
	}
	
	
	@Column(name = "professionallevel", columnDefinition="VARCHAR2(10) " )
	public String getProfessionallevel()
	{
		return professionallevel;
	}
	
	public void setProfessionallevel(String professionallevel)
	{
		this.professionallevel= professionallevel;
	}
	
	
	@Column(name = "joineddate", columnDefinition="DATE " )
	public java.util.Date getJoineddate()
	{
		return joineddate;
	}
	
	public void setJoineddate(java.util.Date joineddate)
	{
		this.joineddate= joineddate;
	}
	
	
	@Column(name = "birthday", columnDefinition="DATE " )
	public java.util.Date getBirthday()
	{
		return birthday;
	}
	
	public void setBirthday(java.util.Date birthday)
	{
		this.birthday= birthday;
	}
	
	
	@Column(name = "country", columnDefinition="VARCHAR2(30) " )
	public String getCountry()
	{
		return country;
	}
	
	public void setCountry(String country)
	{
		this.country= country;
	}
	
	
	@Column(name = "weixin", columnDefinition="VARCHAR2(20) " )
	public String getWeixin()
	{
		return weixin;
	}
	
	public void setWeixin(String weixin)
	{
		this.weixin= weixin;
	}
	
	
	@Column(name = "qq", columnDefinition="VARCHAR2(20) " )
	public String getQq()
	{
		return qq;
	}
	
	public void setQq(String qq)
	{
		this.qq= qq;
	}
	
	
	@Column(name = "address", columnDefinition="VARCHAR2(100) " )
	public String getAddress()
	{
		return address;
	}
	
	public void setAddress(String address)
	{
		this.address= address;
	}
	
	
	@Column(name = "invitecode", columnDefinition="VARCHAR2(8) " )
	public String getInvitecode()
	{
		return invitecode;
	}
	
	public void setInvitecode(String invitecode)
	{
		this.invitecode= invitecode;
	}
	
	
	@Column(name = "first_login", columnDefinition="CHAR(1) " )
	public String getFirstLogin()
	{
		return firstLogin;
	}
	
	public void setFirstLogin(String firstLogin)
	{
		this.firstLogin= firstLogin;
	}
	
	
	@Column(name = "is_saler", columnDefinition="CHAR(1) " )
	public String getIsSaler()
	{
		return isSaler;
	}
	
	public void setIsSaler(String isSaler)
	{
		this.isSaler= isSaler;
	}
	
	
	@Column(name = "province", columnDefinition="CHAR(10) " )
	public String getProvince() {
		return province;
	}
	public void setProvince(String province) {
		this.province = province;
	}
	
	@Column(name = "city", columnDefinition="CHAR(10) " )
	public String getCity() {
		return city;
	}
	public void setCity(String city) {
		this.city = city;
	}
	
	@Column(name = "area", columnDefinition="CHAR(10) " )
	public String getArea() {
		return area;
	}
	public void setArea(String area) {
		this.area = area;
	}
	
	
	@Column(name = "client_Id", columnDefinition="VARCHAR2(125) " )
	public String getClientId() {
		return clientId;
	}
	public void setClientId(String clientId) {
		this.clientId = clientId;
	}
	
	@Column(name = "img_url", columnDefinition="VARCHAR2(325) " )
	public String getImgURL() {
		return imgURL;
	}
	public void setImgURL(String imgURL) {
		this.imgURL = imgURL;
	}
	@Transient
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	
	@Transient
	public BigDecimal getSum() {
		return sum;
	}
	public void setSum(BigDecimal sum) {
		this.sum = sum;
	}
	public Class entityClass()
	{
		return ENTITY_CLASS;
	}
	
	
 	protected StringBuilder toStringBuilder(StringBuilder sb)
 	{
 		return sb 
		.append(",id=").append(this.id)
		.append(",type=").append(this.type)
		.append(",personnelcode=").append(this.personnelcode)
		.append(",pwd=").append(this.pwd)
		.append(",name=").append(this.name)
		.append(",deptName=").append(this.deptName)
		.append(",deptCode=").append(this.deptCode)
		.append(",deptPath=").append(this.deptPath)
		.append(",sex=").append(this.sex)
		.append(",mail=").append(this.mail)
		.append(",phone=").append(this.phone)
		.append(",idnumber=").append(this.idnumber)
		.append(",state=").append(this.state)
		.append(",classify=").append(this.classify)
		.append(",careerpath=").append(this.careerpath)
		.append(",post=").append(this.post)
		.append(",job=").append(this.job)
		.append(",professionallevel=").append(this.professionallevel)
		.append(",joineddate=").append(this.joineddate)
		.append(",birthday=").append(this.birthday)
		.append(",country=").append(this.country)
		.append(",weixin=").append(this.weixin)
		.append(",qq=").append(this.qq)
		.append(",address=").append(this.address)
		.append(",invitecode=").append(this.invitecode)
		.append(",firstLogin=").append(this.firstLogin)
		.append(",isSaler=").append(this.isSaler)
		.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(",province=").append(this.province)
		.append(",city=").append(this.city)
		.append(",area=").append(this.area)
		.append(",clientId=").append(this.clientId)
		.append(",imgURL=").append(this.imgURL)
		.append(",sum=").append(this.sum)
		;
 	}
 	
 	
 	@Override
	public String toString()
	{
		return toStringBuilder(new StringBuilder().append("MgmUser[")).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.type!=null){ map.put("type",this.type);}
	     if(this.personnelcode!=null){ map.put("personnelcode",this.personnelcode);}
	     if(this.pwd!=null){ map.put("pwd",this.pwd);}
	     if(this.name!=null){ map.put("name",this.name);}
	     if(this.deptName!=null){ map.put("deptName",this.deptName);}
	     if(this.deptCode!=null){ map.put("deptCode",this.deptCode);}
	     if(this.deptPath!=null){ map.put("deptPath",this.deptPath);}
	     if(this.sex!=null){ map.put("sex",this.sex);}
	     if(this.mail!=null){ map.put("mail",this.mail);}
	     if(this.phone!=null){ map.put("phone",this.phone);}
	     if(this.idnumber!=null){ map.put("idnumber",this.idnumber);}
	     if(this.state!=null){ map.put("state",this.state);}
	     if(this.classify!=null){ map.put("classify",this.classify);}
	     if(this.careerpath!=null){ map.put("careerpath",this.careerpath);}
	     if(this.post!=null){ map.put("post",this.post);}
	     if(this.job!=null){ map.put("job",this.job);}
	     if(this.professionallevel!=null){ map.put("professionallevel",this.professionallevel);}
	     if(this.joineddate!=null){ map.put("joineddate",this.joineddate);}
	     if(this.birthday!=null){ map.put("birthday",this.birthday);}
	     if(this.country!=null){ map.put("country",this.country);}
	     if(this.weixin!=null){ map.put("weixin",this.weixin);}
	     if(this.qq!=null){ map.put("qq",this.qq);}
	     if(this.address!=null){ map.put("address",this.address);}
	     if(this.invitecode!=null){ map.put("invitecode",this.invitecode);}
	     if(this.firstLogin!=null){ map.put("firstLogin",this.firstLogin);}
	     if(this.isSaler!=null){ map.put("isSaler",this.isSaler);}
		 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.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.clientId != null){ map.put("clientId", this.clientId);}
		 if(this.imgURL != null){ map.put("imgURL", this.imgURL);}
		 if(this.sum!=null){map.put("sum",this.sum);}
		return map;
	}
	
	public void mergeTo(MgmUser en)
	{
		  if(this.id !=null){ en.setId(this.id);}
		  if(this.type !=null){ en.setType(this.type);}
		  if(this.personnelcode !=null){ en.setPersonnelcode(this.personnelcode);}
		  if(this.pwd !=null){ en.setPwd(this.pwd);}
		  if(this.name !=null){ en.setName(this.name);}
		  if(this.deptName !=null){ en.setDeptName(this.deptName);}
		  if(this.deptCode !=null){ en.setDeptCode(this.deptCode);}
		  if(this.deptPath !=null){ en.setDeptPath(this.deptPath);}
		  if(this.sex !=null){ en.setSex(this.sex);}
		  if(this.mail !=null){ en.setMail(this.mail);}
		  if(this.phone !=null){ en.setPhone(this.phone);}
		  if(this.idnumber !=null){ en.setIdnumber(this.idnumber);}
		  if(this.state !=null){ en.setState(this.state);}
		  if(this.classify !=null){ en.setClassify(this.classify);}
		  if(this.careerpath !=null){ en.setCareerpath(this.careerpath);}
		  if(this.post !=null){ en.setPost(this.post);}
		  if(this.job !=null){ en.setJob(this.job);}
		  if(this.professionallevel !=null){ en.setProfessionallevel(this.professionallevel);}
		  if(this.joineddate !=null){ en.setJoineddate(this.joineddate);}
		  if(this.birthday !=null){ en.setBirthday(this.birthday);}
		  if(this.country !=null){ en.setCountry(this.country);}
		  if(this.weixin !=null){ en.setWeixin(this.weixin);}
		  if(this.qq !=null){ en.setQq(this.qq);}
		  if(this.address !=null){ en.setAddress(this.address);}
		  if(this.invitecode !=null){ en.setInvitecode(this.invitecode);}
		  if(this.firstLogin !=null){ en.setFirstLogin(this.firstLogin);}
		  if(this.isSaler !=null){ en.setIsSaler(this.isSaler);}
		  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.province != null){ en.setProvince(this.province);}
		  if(this.city != null){ en.setCity(this.city);} 
		  if(this.area != null){ en.setArea(this.area);} 
		  if(this.clientId != null){ en.setClientId(this.clientId);}
		  if(this.imgURL != null){ en.setImgURL(this.imgURL);}
		  if(this.sum != null){ en.setSum(this.sum);}
	}
	
  	@Override
  	public void copyFrom(Object obj)
  	{  
  		 if(!(obj instanceof MgmUser)) {
  	 		super.copyFrom(obj);
  	 	}else {
  	  		MgmUser bean=(MgmUser)obj;
			this.setId(bean.getId());
			this.setType(bean.getType());
			this.setPersonnelcode(bean.getPersonnelcode());
			this.setPwd(bean.getPwd());
			this.setName(bean.getName());
			this.setDeptName(bean.getDeptName());
			this.setDeptCode(bean.getDeptCode());
			this.setDeptPath(bean.getDeptPath());
			this.setSex(bean.getSex());
			this.setMail(bean.getMail());
			this.setPhone(bean.getPhone());
			this.setIdnumber(bean.getIdnumber());
			this.setState(bean.getState());
			this.setClassify(bean.getClassify());
			this.setCareerpath(bean.getCareerpath());
			this.setPost(bean.getPost());
			this.setJob(bean.getJob());
			this.setProfessionallevel(bean.getProfessionallevel());
			this.setJoineddate(bean.getJoineddate());
			this.setBirthday(bean.getBirthday());
			this.setCountry(bean.getCountry());
			this.setWeixin(bean.getWeixin());
			this.setQq(bean.getQq());
			this.setAddress(bean.getAddress());
			this.setInvitecode(bean.getInvitecode());
			this.setFirstLogin(bean.getFirstLogin());
			this.setIsSaler(bean.getIsSaler());
	     	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.setProvince(bean.getProvince());
	     	this.setCity(bean.getCity());
	     	this.setArea(bean.getArea());
	     	this.setClientId(bean.getClientId());
	     	this.setImgURL(bean.getImgURL());
	     	this.setSum(bean.getSum());
     	}
 	 }
}