package org.cs.mgr.product.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Transient;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
import javax.persistence.Version;
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: MgmProduct 
 * @Description:  
 * @author: sunny_shi
 * @date: 2018-06-09 13:29:09
 */
@Table(name = "mgm_product")
@Entity
@DynamicInsert
@DynamicUpdate
public class MgmProduct extends  BaseEntity {

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

	@Id
	@SequenceGenerator(name="TB_MGM_PRODUCT",sequenceName="PRODUCT_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;
	}
	
	/** 产品名称  */
	private String productName;  
	/** 产品说明  */
	private String productMsg;  
	
	/** 产品标示  */
	private String productRemark;
	
	/** 一级分类  */
	private Integer gcId;  
	/** 二级分类  */
	private Integer gcParentId;  
	/** 三级级分类  */
	private Integer gcThreeId;  
	/** 四级分类  */
	private Integer gcFourId; 
	/** 分类  */
	private String gc;  
	/** 产品型号  */
	private String productModel;  
	/** 产品类型  */
	private String productType;  //1地产项目 2产品
	/** 产品主图  */
	private String productImg;  
	/** 产品组图  */
	private String productGroupImg;//以逗号分割
	/** 产品参数 */
	private String productAttr;  
	/** 产品详情  */
	private String productBody;  
	/** 佣金比例  */
	private String commissionRate;  
	/** 佣金说明  */
	private String commissionRemark;  
	/** 优惠政策  */
	private String policy;
	/** 联系电话 */
	private String hotline;
	/** 状态  */
	private String productState;  //1上架中 2已下架
	/** 添加时间  */
	private java.util.Date productAddtime;  
	/** 上架时间  */
	private java.util.Date onsaleTime;
	/** 下架时间  */
	private java.util.Date unsaleTime;
	/** 产品价格  */
	private String productPrice;  
	/** 是否推介首页  */
	private String isHome;  
	/** 权重  */
	private Integer weight;  
	/** 省  */
	private String province;  
	/** 市  */
	private String city;  
	/** 省  */
	private String provinceCode;  
	/** 市  */
	private String cityCode;  
	
	/** 项目分类名称  */
	private String xmType;  
	/** 项目分类code  */
	private String xmCode; 
	/** 单位  */
	private String unit;  
	
	private Integer viewTotal;//浏览量
	
	private Integer followTotal;//关注量

	/**是否公开*/
	private Boolean openFlag;
	
	@Column(name = "view_total", columnDefinition="NUMBER" )
	public Integer getViewTotal() {
		return viewTotal;
	}

	public void setViewTotal(Integer viewTotal) {
		this.viewTotal = viewTotal;
	}
	
	@Column(name = "follow_total", columnDefinition="NUMBER" )
	public Integer getFollowTotal() {
		return followTotal;
	}

	public void setFollowTotal(Integer followTotal) {
		this.followTotal = followTotal;
	}

	@Column(name = "xm_type", columnDefinition="VARCHAR2(50)" )
	public String getXmType() {
		return xmType;
	}

	public void setXmType(String xmType) {
		this.xmType = xmType;
	}

	@Column(name = "xm_code", columnDefinition="VARCHAR2(50)" )
	public String getXmCode() {
		return xmCode;
	}

	public void setXmCode(String xmCode) {
		this.xmCode = xmCode;
	}

	@Column(name = "product_remark", columnDefinition="VARCHAR2(300)" )
	public String getProductRemark() {
		return productRemark;
	}

	public void setProductRemark(String productRemark) {
		this.productRemark = productRemark;
	}

	@Column(name = "product_name", columnDefinition="VARCHAR2(100)" )
	public String getProductName()
	{
		return productName;
	}
	
	public void setProductName(String productName)
	{
		this.productName= productName;
	}


	
	@Column(name = "gc_three_id", columnDefinition="NUMBER" )
	public Integer getGcThreeId() {
		return gcThreeId;
	}

	public void setGcThreeId(Integer gcThreeId) {
		this.gcThreeId = gcThreeId;
	}

	@Column(name = "gc_four_id", columnDefinition="NUMBER" )
	public Integer getGcFourId() {
		return gcFourId;
	}

	public void setGcFourId(Integer gcFourId) {
		this.gcFourId = gcFourId;
	}

	@Column(name = "product_msg", columnDefinition="CLOB" )
	public String getProductMsg()
	{
		return productMsg;
	}
	
	public void setProductMsg(String productMsg)
	{
		this.productMsg= productMsg;
	}
	
	
	@Column(name = "gc_id", columnDefinition="NUMBER" )
	public Integer getGcId()
	{
		return gcId;
	}
	
	public void setGcId(Integer gcId)
	{
		this.gcId= gcId;
	}


	@Column(name = "gc_parent_id", columnDefinition="NUMBER" )
	public Integer getGcParentId()
	{
		return gcParentId;
	}
	
	public void setGcParentId(Integer gcParentId)
	{
		this.gcParentId= gcParentId;
	}
	
	
	@Column(name = "gc", columnDefinition="VARCHAR2(300)" )
	public String getGc()
	{
		return gc;
	}
	
	public void setGc(String gc)
	{
		this.gc= gc;
	}
	
	
	@Column(name = "product_model", columnDefinition="VARCHAR2(50)" )
	public String getProductModel()
	{
		return productModel;
	}
	
	public void setProductModel(String productModel)
	{
		this.productModel= productModel;
	}
	
	
	@Column(name = "product_type", columnDefinition="CHAR(1)" )
	public String getProductType()
	{
		return productType;
	}
	
	public void setProductType(String productType)
	{
		this.productType= productType;
	}
	
	@Column(name = "product_group_img", columnDefinition="VARCHAR2(1000)" )
	public String getProductGroupImg() {
		return productGroupImg;
	}

	public void setProductGroupImg(String productGroupImg) {
		this.productGroupImg = productGroupImg;
	}

	@Column(name = "product_img", columnDefinition="VARCHAR2(100)" )
	public String getProductImg()
	{
		return productImg;
	}
	
	public void setProductImg(String productImg)
	{
		this.productImg= productImg;
	}
	
	
	@Column(name = "product_attr", columnDefinition="CLOB" )
	public String getProductAttr()
	{
		return productAttr;
	}
	
	public void setProductAttr(String productAttr)
	{
		this.productAttr= productAttr;
	}
	
	
	@Column(name = "product_body", columnDefinition="CLOB" )
	public String getProductBody()
	{
		return productBody;
	}
	
	public void setProductBody(String productBody)
	{
		this.productBody= productBody;
	}
	
	
	@Column(name = "commission_rate", columnDefinition="VARCHAR2(300)" )
	public String getCommissionRate()
	{
		return commissionRate;
	}
	
	public void setCommissionRate(String commissionRate)
	{
		this.commissionRate= commissionRate;
	}
	
	
	@Column(name = "commission_remark", columnDefinition="CLOB" )
	public String getCommissionRemark()
	{
		return commissionRemark;
	}
	
	public void setCommissionRemark(String commissionRemark)
	{
		this.commissionRemark= commissionRemark;
	}
	
	
	@Column(name = "policy", columnDefinition="CLOB" )
	public String getPolicy()
	{
		return policy;
	}
	
	public void setPolicy(String policy)
	{
		this.policy= policy;
	}

	@Column(name = "hotline", columnDefinition="VARCHAR2(30)" )
	public String getHotline() {
		return hotline;
	}

	public void setHotline(String hotline) {
		this.hotline = hotline;
	}

	@Column(name = "product_state", columnDefinition="CHAR(1)" )
	public String getProductState()
	{
		return productState;
	}
	
	public void setProductState(String productState)
	{
		this.productState= productState;
	}
	
	
	@Column(name = "product_addtime", columnDefinition="DATE" )
	public java.util.Date getProductAddtime()
	{
		return productAddtime;
	}
	
	public void setProductAddtime(java.util.Date productAddtime)
	{
		this.productAddtime= productAddtime;
	}
	
	
	@Column(name = "onsaleTime", columnDefinition="DATE" )
	public java.util.Date getOnsaleTime()
	{
		return onsaleTime;
	}

	public void setOnsaleTime(java.util.Date onsaleTime)
	{
		this.onsaleTime= onsaleTime;
	}


	@Column(name = "unsaleTime", columnDefinition="DATE" )
	public java.util.Date getUnsaleTime()
	{
		return unsaleTime;
	}

	public void setUnsaleTime(java.util.Date unsaleTime)
	{
		this.unsaleTime= unsaleTime;
	}


	@Column(name = "product_price", columnDefinition="VARCHAR2(100)" )
	public String getProductPrice()
	{
		return productPrice;
	}
	
	public void setProductPrice(String productPrice)
	{
		this.productPrice= productPrice;
	}
	
	
	@Column(name = "is_home", columnDefinition="CHAR(1)" )
	public String getIsHome()
	{
		return isHome;
	}
	
	public void setIsHome(String isHome)
	{
		this.isHome= isHome;
	}
	
	
	@Column(name = "weight", columnDefinition="NUMBER" )
	public Integer getWeight()
	{
		return weight;
	}
	
	public void setWeight(Integer weight)
	{
		this.weight= weight;
	}
	
	
	@Column(name = "province_code", columnDefinition="VARCHAR2(18)" )
	public String getProvinceCode() {
		return provinceCode;
	}

	public void setProvinceCode(String provinceCode) {
		this.provinceCode = provinceCode;
	}

	@Column(name = "city_code", columnDefinition="VARCHAR2(18)" )
	public String getCityCode() {
		return cityCode;
	}

	public void setCityCode(String cityCode) {
		this.cityCode = cityCode;
	}

	@Column(name = "province", columnDefinition="VARCHAR2(10)" )
	public String getProvince()
	{
		return province;
	}
	
	public void setProvince(String province)
	{
		this.province= province;
	}
	
	
	@Column(name = "city", columnDefinition="VARCHAR2(10)" )
	public String getCity()
	{
		return city;
	}
	
	public void setCity(String city)
	{
		this.city= city;
	}
	
	
	@Column(name = "unit", columnDefinition="VARCHAR2(10)" )
	public String getUnit()
	{
		return unit;
	}
	
	public void setUnit(String unit)
	{
		this.unit= unit;
	}
	
	@Column(name="open_flag", nullable = false, columnDefinition="number(1) default 1")
	public Boolean getOpenFlag() {
		return openFlag;
	}

	public void setOpenFlag(Boolean openFlag) {
		this.openFlag = openFlag;
	}
	 
	public Class entityClass()
	{
		return ENTITY_CLASS;
	}
	
	
 	protected StringBuilder toStringBuilder(StringBuilder sb)
 	{
 		return sb 
		.append(",id=").append(this.id)
		.append(",productName=").append(this.productName)
		.append(",productMsg=").append(this.productMsg)
		.append(",gcId=").append(this.gcId)
		.append(",gcParentId=").append(this.gcParentId)
		.append(",gc=").append(this.gc)
		.append(",productModel=").append(this.productModel)
		.append(",productType=").append(this.productType)
		.append(",productImg=").append(this.productImg)
		.append(",productAttr=").append(this.productAttr)
		.append(",productBody=").append(this.productBody)
		.append(",commissionRate=").append(this.commissionRate)
		.append(",commissionRemark=").append(this.commissionRemark)
		.append(",policy=").append(this.policy)
		.append(",productState=").append(this.productState)
		.append(",productAddtime=").append(this.productAddtime)
		.append(",onsaleTime=").append(this.onsaleTime)
		.append(",unsaleTime=").append(this.unsaleTime)
		.append(",productPrice=").append(this.productPrice)
		.append(",isHome=").append(this.isHome)
		.append(",weight=").append(this.weight)
		.append(",province=").append(this.province)
		.append(",city=").append(this.city)
		.append(",unit=").append(this.unit)
		.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(",openFlag=").append(this.getOpenFlag())
		;
 	}
 	
 	
 	@Override
	public String toString()
	{
		return toStringBuilder(new StringBuilder().append("MgmProduct[")).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.productName!=null){ map.put("productName",this.productName);}
	     if(this.productMsg!=null){ map.put("productMsg",this.productMsg);}
	     if(this.gcId!=null){ map.put("gcId",this.gcId);}
	     if(this.gcParentId!=null){ map.put("gcParentId",this.gcParentId);}
	     if(this.gc!=null){ map.put("gc",this.gc);}
	     if(this.productModel!=null){ map.put("productModel",this.productModel);}
	     if(this.productType!=null){ map.put("productType",this.productType);}
	     if(this.productImg!=null){ map.put("productImg",this.productImg);}
	     if(this.productAttr!=null){ map.put("productAttr",this.productAttr);}
	     if(this.productBody!=null){ map.put("productBody",this.productBody);}
	     if(this.commissionRate!=null){ map.put("commissionRate",this.commissionRate);}
	     if(this.commissionRemark!=null){ map.put("commissionRemark",this.commissionRemark);}
	     if(this.policy!=null){ map.put("policy",this.policy);}
	     if(this.productState!=null){ map.put("productState",this.productState);}
	     if(this.productAddtime!=null){ map.put("productAddtime",this.productAddtime);}
	     if(this.onsaleTime!=null){ map.put("onsaleTime",this.onsaleTime);}
	     if(this.unsaleTime!=null){ map.put("unsaleTime",this.unsaleTime);}
	     if(this.productPrice!=null){ map.put("productPrice",this.productPrice);}
	     if(this.isHome!=null){ map.put("isHome",this.isHome);}
	     if(this.weight!=null){ map.put("weight",this.weight);}
	     if(this.province!=null){ map.put("province",this.province);}
	     if(this.city!=null){ map.put("city",this.city);}
	     if(this.unit!=null){ map.put("unit",this.unit);}
		 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.openFlag!=null){map.put("openFlag", this.openFlag);}
		return map;
	}
	
	public void mergeTo(MgmProduct en)
	{
		  if(this.id !=null){ en.setId(this.id);}
		  if(this.productName !=null){ en.setProductName(this.productName);}
		  if(this.productMsg !=null){ en.setProductMsg(this.productMsg);}
		  if(this.gcId !=null){ en.setGcId(this.gcId);}
		  if(this.gcParentId !=null){ en.setGcParentId(this.gcParentId);}
		  if(this.gc !=null){ en.setGc(this.gc);}
		  if(this.productModel !=null){ en.setProductModel(this.productModel);}
		  if(this.productType !=null){ en.setProductType(this.productType);}
		  if(this.productImg !=null){ en.setProductImg(this.productImg);}
		  if(this.productAttr !=null){ en.setProductAttr(this.productAttr);}
		  if(this.productBody !=null){ en.setProductBody(this.productBody);}
		  if(this.commissionRate !=null){ en.setCommissionRate(this.commissionRate);}
		  if(this.commissionRemark !=null){ en.setCommissionRemark(this.commissionRemark);}
		  if(this.policy !=null){ en.setPolicy(this.policy);}
		  if(this.productState !=null){ en.setProductState(this.productState);}
		  if(this.productAddtime !=null){ en.setProductAddtime(this.productAddtime);}
		  if(this.onsaleTime !=null){ en.setOnsaleTime(this.onsaleTime);}
		  if(this.unsaleTime !=null){ en.setUnsaleTime(this.unsaleTime);}
		  if(this.productPrice !=null){ en.setProductPrice(this.productPrice);}
		  if(this.isHome !=null){ en.setIsHome(this.isHome);}
		  if(this.weight !=null){ en.setWeight(this.weight);}
		  if(this.province !=null){ en.setProvince(this.province);}
		  if(this.city !=null){ en.setCity(this.city);}
		  if(this.unit !=null){ en.setUnit(this.unit);}
		  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.openFlag !=null){en.setOpenFlag(this.openFlag);}
	}
	
  	@Override
  	public void copyFrom(Object obj)
  	{  
  		 if(!(obj instanceof MgmProduct)) {
  	 		super.copyFrom(obj);
  	 	}else {
  	  		MgmProduct bean=(MgmProduct)obj;
			this.setId(bean.getId());
			this.setProductName(bean.getProductName());
			this.setProductMsg(bean.getProductMsg());
			this.setGcId(bean.getGcId());
			this.setGcParentId(bean.getGcParentId());
			this.setGc(bean.getGc());
			this.setProductModel(bean.getProductModel());
			this.setProductType(bean.getProductType());
			this.setProductImg(bean.getProductImg());
			this.setProductAttr(bean.getProductAttr());
			this.setProductBody(bean.getProductBody());
			this.setCommissionRate(bean.getCommissionRate());
			this.setCommissionRemark(bean.getCommissionRemark());
			this.setPolicy(bean.getPolicy());
			this.setProductState(bean.getProductState());
			this.setProductAddtime(bean.getProductAddtime());
			this.setOnsaleTime(bean.getOnsaleTime());
			this.setUnsaleTime(bean.getUnsaleTime());
			this.setProductPrice(bean.getProductPrice());
			this.setIsHome(bean.getIsHome());
			this.setWeight(bean.getWeight());
			this.setProvince(bean.getProvince());
			this.setCity(bean.getCity());
			this.setUnit(bean.getUnit());
	     	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.setOpenFlag(bean.getOpenFlag());
     	}
 	 }

	
}
