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

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

	/** 机构编码  */
	private String deptCode;  
	/** 组织名称  */
	private String deptName;  
	/** 部门全路径  */
	private String deptPath;  
	/** 上级部门  */
	private String deptParentCode;  
	/** 是否停用  */
	private String deptStop;

	@Id
	@SequenceGenerator(name="sequenceGenerator",sequenceName="USERDEPT_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 = "dept_code", columnDefinition="VARCHAR2(30) " )
	public String getDeptCode()
	{
		return deptCode;
	}
	
	public void setDeptCode(String deptCode)
	{
		this.deptCode= deptCode;
	}
	
	
	@Column(name = "dept_name", columnDefinition="VARCHAR2(50) " )
	public String getDeptName()
	{
		return deptName;
	}
	
	public void setDeptName(String deptName)
	{
		this.deptName= deptName;
	}
	
	
	@Column(name = "dept_path", columnDefinition="VARCHAR2(200) " )
	public String getDeptPath()
	{
		return deptPath;
	}
	
	public void setDeptPath(String deptPath)
	{
		this.deptPath= deptPath;
	}
	
	
	@Column(name = "dept_parent_code", columnDefinition="VARCHAR2(30) " )
	public String getDeptParentCode()
	{
		return deptParentCode;
	}
	
	public void setDeptParentCode(String deptParentCode)
	{
		this.deptParentCode= deptParentCode;
	}
	
	
	@Column(name = "dept_stop", columnDefinition="CHAR(1) " )
	public String getDeptStop()
	{
		return deptStop;
	}
	
	public void setDeptStop(String deptStop)
	{
		this.deptStop= deptStop;
	}
	
	
	 
	public Class entityClass()
	{
		return ENTITY_CLASS;
	}
	
	
 	protected StringBuilder toStringBuilder(StringBuilder sb)
 	{
 		return sb 
		.append(",id=").append(this.id)
		.append(",deptCode=").append(this.deptCode)
		.append(",deptName=").append(this.deptName)
		.append(",deptPath=").append(this.deptPath)
		.append(",deptParentCode=").append(this.deptParentCode)
		.append(",deptStop=").append(this.deptStop)
		.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("MgmUserDept[")).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.deptCode!=null){ map.put("deptCode",this.deptCode);}
	     if(this.deptName!=null){ map.put("deptName",this.deptName);}
	     if(this.deptPath!=null){ map.put("deptPath",this.deptPath);}
	     if(this.deptParentCode!=null){ map.put("deptParentCode",this.deptParentCode);}
	     if(this.deptStop!=null){ map.put("deptStop",this.deptStop);}
		 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(MgmUserDept en)
	{
		  if(this.id !=null){ en.setId(this.id);}
		  if(this.deptCode !=null){ en.setDeptCode(this.deptCode);}
		  if(this.deptName !=null){ en.setDeptName(this.deptName);}
		  if(this.deptPath !=null){ en.setDeptPath(this.deptPath);}
		  if(this.deptParentCode !=null){ en.setDeptParentCode(this.deptParentCode);}
		  if(this.deptStop !=null){ en.setDeptStop(this.deptStop);}
		  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 MgmUserDept)) {
  	 		super.copyFrom(obj);
  	 	}else {
  	  		MgmUserDept bean=(MgmUserDept)obj;
			this.setId(bean.getId());
			this.setDeptCode(bean.getDeptCode());
			this.setDeptName(bean.getDeptName());
			this.setDeptPath(bean.getDeptPath());
			this.setDeptParentCode(bean.getDeptParentCode());
			this.setDeptStop(bean.getDeptStop());
     	this.setAttr1(bean.getAttr1());
     	this.setAttr2(bean.getAttr2());
     	this.setAttr3(bean.getAttr3());
     	this.setCreateDate(bean.getCreateDate());
     	this.setModifyDate(bean.getModifyDate());
     	this.setIsDelete(bean.getIsDelete());
     	}
 	 }
}
