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

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

	/** id  */
	private Integer id;  
	/** 类型  */
	private String type;  
	/** 标题  */
	private String title;  
	/** 详情  */
	private String content;  
	/** 关键字  */
	private String keyword;
	/**是否公开*/
	private Boolean openFlag;
	

	@Id
	@SequenceGenerator(name="TB_MGM_PRODUCT",sequenceName="NOTICE_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="open_flag", nullable = false, columnDefinition="number(1) default 1")
	public Boolean getOpenFlag() {
		return openFlag;
	}

	public void setOpenFlag(Boolean openFlag) {
		this.openFlag = openFlag;
	}
	
	@Column(name = "type", columnDefinition="CHAR(1) " )
	public String getType()
	{
		return type;
	}
	
	public void setType(String type)
	{
		this.type= type;
	}
	
	
	
	@Column(name = "title", columnDefinition="VARCHAR2(100) " )
	public String getTitle()
	{
		return title;
	}
	
	public void setTitle(String title)
	{
		this.title= title;
	}
	
	
	@Column(name = "content", columnDefinition="CLOB " )
	public String getContent()
	{
		return content;
	}
	
	public void setContent(String content)
	{
		this.content= content;
	}
	
	
	@Column(name = "keyword", columnDefinition="VARCHAR2(100) " )
	public String getKeyword()
	{
		return keyword;
	}
	
	public void setKeyword(String keyword)
	{
		this.keyword= keyword;
	}
	
	
	 
	public Class entityClass()
	{
		return ENTITY_CLASS;
	}
	
	
 	protected StringBuilder toStringBuilder(StringBuilder sb)
 	{
 		return sb 
		.append(",id=").append(this.id)
		.append(",type=").append(this.type)
		.append(",title=").append(this.title)
		.append(",content=").append(this.content)
		.append(",keyword=").append(this.keyword)
		.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("SysNotice[")).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.title!=null){ map.put("title",this.title);}
	     if(this.content!=null){ map.put("content",this.content);}
	     if(this.keyword!=null){ map.put("keyword",this.keyword);}
		 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(SysNotice en)
	{
		  if(this.id !=null){ en.setId(this.id);}
		  if(this.type !=null){ en.setType(this.type);}
		  if(this.title !=null){ en.setTitle(this.title);}
		  if(this.content !=null){ en.setContent(this.content);}
		  if(this.keyword !=null){ en.setKeyword(this.keyword);}
		  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 SysNotice)) {
  	 		super.copyFrom(obj);
  	 	}else {
  	  		SysNotice bean=(SysNotice)obj;
			this.setId(bean.getId());
			this.setType(bean.getType());
			this.setTitle(bean.getTitle());
			this.setContent(bean.getContent());
			this.setKeyword(bean.getKeyword());
     	this.setAttr1(bean.getAttr1());
     	this.setAttr2(bean.getAttr2());
     	this.setAttr3(bean.getAttr3());
     	this.setCreateDate(bean.getCreateDate());
     	this.setModifyDate(bean.getModifyDate());
     	this.setIsDelete(bean.getIsDelete());
     	}
 	 }
}
