package org.cs.mgr.setting.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: SysVersion 
 * @Description:  
 * @author: sunny_shi
 * @date: 2018-06-09 13:29:14
 */
@Table(name = "sys_version")
@Entity
@DynamicInsert
@DynamicUpdate
public class SysVersion extends  BaseEntity {

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

	/** 类型  */
	private String type;  
	/** 版本号  */
	private String v;  
	/** 版本说明  */
	private String note;  
	/** 文件地址  */
	private String file;  
	/** 发布状态  */
	private String state;

	@Id
	@SequenceGenerator(name="TB_MGM_PRODUCT",sequenceName="VERSION_SEQ")
	@GeneratedValue(generator="TB_MGM_PRODUCT",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="VARCHAR2(10) " )
	public String getType()
	{
		return type;
	}
	
	public void setType(String type)
	{
		this.type= type;
	}
	
	
	@Column(name = "v", columnDefinition="VARCHAR2(20) " )
	public String getV()
	{
		return v;
	}
	
	public void setV(String v)
	{
		this.v= v;
	}
	
	
	@Column(name = "note", columnDefinition="VARCHAR2(200) " )
	public String getNote()
	{
		return note;
	}
	
	public void setNote(String note)
	{
		this.note= note;
	}
	
	
	@Column(name = "file", columnDefinition="VARCHAR2(100) " )
	public String getFile()
	{
		return file;
	}
	
	public void setFile(String file)
	{
		this.file= file;
	}
	
	
	@Column(name = "state", columnDefinition="CHAR(1) " )
	public String getState()
	{
		return state;
	}
	
	public void setState(String state)
	{
		this.state= state;
	}
	
	
	 
	public Class entityClass()
	{
		return ENTITY_CLASS;
	}
	
	
 	protected StringBuilder toStringBuilder(StringBuilder sb)
 	{
 		return sb 
		.append(",id=").append(this.id)
		.append(",type=").append(this.type)
		.append(",v=").append(this.v)
		.append(",note=").append(this.note)
		.append(",file=").append(this.file)
		.append(",state=").append(this.state)
		.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("SysVersion[")).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.v!=null){ map.put("v",this.v);}
	     if(this.note!=null){ map.put("note",this.note);}
	     if(this.file!=null){ map.put("file",this.file);}
	     if(this.state!=null){ map.put("state",this.state);}
		 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(SysVersion en)
	{
		  if(this.id !=null){ en.setId(this.id);}
		  if(this.type !=null){ en.setType(this.type);}
		  if(this.v !=null){ en.setV(this.v);}
		  if(this.note !=null){ en.setNote(this.note);}
		  if(this.file !=null){ en.setFile(this.file);}
		  if(this.state !=null){ en.setState(this.state);}
		  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 SysVersion)) {
  	 		super.copyFrom(obj);
  	 	}else {
  	  		SysVersion bean=(SysVersion)obj;
			this.setId(bean.getId());
			this.setType(bean.getType());
			this.setV(bean.getV());
			this.setNote(bean.getNote());
			this.setFile(bean.getFile());
			this.setState(bean.getState());
     	this.setAttr1(bean.getAttr1());
     	this.setAttr2(bean.getAttr2());
     	this.setAttr3(bean.getAttr3());
     	this.setCreateDate(bean.getCreateDate());
     	this.setModifyDate(bean.getModifyDate());
     	this.setIsDelete(bean.getIsDelete());
     	}
 	 }
}
