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

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

	/** 操作人id  */
	private Long userId;  
	/** 操作方法  */
	private String optionMethod;  
	/** 操作描述  */
	private String optionDesc;  
	/** ip地址  */
	private String optionIp;  
	/** 操作时间  */
	private Integer optionTime;  
	/** 参数  */
	private String param;

	@Id
	@SequenceGenerator(name="sequenceGenerator",sequenceName="LOG_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 = "user_id", columnDefinition="NUMBER(11) " )
	public Long getUserId()
	{
		return userId;
	}
	
	public void setUserId(Long userId)
	{
		this.userId= userId;
	}
	
	
	@Column(name = "option_method", columnDefinition="VARCHAR2(100) " )
	public String getOptionMethod()
	{
		return optionMethod;
	}
	
	public void setOptionMethod(String optionMethod)
	{
		this.optionMethod= optionMethod;
	}
	
	
	@Column(name = "option_desc", columnDefinition="VARCHAR2(100) " )
	public String getOptionDesc()
	{
		return optionDesc;
	}
	
	public void setOptionDesc(String optionDesc)
	{
		this.optionDesc= optionDesc;
	}
	
	
	@Column(name = "option_ip", columnDefinition="VARCHAR2(100) " )
	public String getOptionIp()
	{
		return optionIp;
	}
	
	public void setOptionIp(String optionIp)
	{
		this.optionIp= optionIp;
	}
	
	
	@Column(name = "option_time", columnDefinition="DAET " )
	public Integer getOptionTime()
	{
		return optionTime;
	}
	
	public void setOptionTime(Integer optionTime)
	{
		this.optionTime= optionTime;
	}
	
	
	@Column(name = "param", columnDefinition="VARCHAR2(100) " )
	public String getParam()
	{
		return param;
	}
	
	public void setParam(String param)
	{
		this.param= param;
	}
	
	
	 
	public Class entityClass()
	{
		return ENTITY_CLASS;
	}
	
	
 	protected StringBuilder toStringBuilder(StringBuilder sb)
 	{
 		return sb 
		.append(",id=").append(this.id)
		.append(",userId=").append(this.userId)
		.append(",optionMethod=").append(this.optionMethod)
		.append(",optionDesc=").append(this.optionDesc)
		.append(",optionIp=").append(this.optionIp)
		.append(",optionTime=").append(this.optionTime)
		.append(",param=").append(this.param)
		.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("SysLog[")).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.userId!=null){ map.put("userId",this.userId);}
	     if(this.optionMethod!=null){ map.put("optionMethod",this.optionMethod);}
	     if(this.optionDesc!=null){ map.put("optionDesc",this.optionDesc);}
	     if(this.optionIp!=null){ map.put("optionIp",this.optionIp);}
	     if(this.optionTime!=null){ map.put("optionTime",this.optionTime);}
	     if(this.param!=null){ map.put("param",this.param);}
		 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(SysLog en)
	{
		  if(this.id !=null){ en.setId(this.id);}
		  if(this.userId !=null){ en.setUserId(this.userId);}
		  if(this.optionMethod !=null){ en.setOptionMethod(this.optionMethod);}
		  if(this.optionDesc !=null){ en.setOptionDesc(this.optionDesc);}
		  if(this.optionIp !=null){ en.setOptionIp(this.optionIp);}
		  if(this.optionTime !=null){ en.setOptionTime(this.optionTime);}
		  if(this.param !=null){ en.setParam(this.param);}
		  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 SysLog)) {
  	 		super.copyFrom(obj);
  	 	}else {
  	  		SysLog bean=(SysLog)obj;
			this.setId(bean.getId());
			this.setUserId(bean.getUserId());
			this.setOptionMethod(bean.getOptionMethod());
			this.setOptionDesc(bean.getOptionDesc());
			this.setOptionIp(bean.getOptionIp());
			this.setOptionTime(bean.getOptionTime());
			this.setParam(bean.getParam());
     	this.setAttr1(bean.getAttr1());
     	this.setAttr2(bean.getAttr2());
     	this.setAttr3(bean.getAttr3());
     	this.setCreateDate(bean.getCreateDate());
     	this.setModifyDate(bean.getModifyDate());
     	this.setIsDelete(bean.getIsDelete());
     	}
 	 }
}
