package com.ssj.bean.weixin.sales.domain;

import com.ssj.bean.common.framework.core.domain.BaseEntity;
import com.ssj.bean.weixin.user.domain.User;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import javax.persistence.*;
import java.util.Date;

/** 
 * @author  ZhangCaibao 
 * @version 2017年6月6日 下午4:01:30 
 * 类说明 
 */
@Entity
@Table(name = "tb_lib_vip_code")
public class LibVipCode extends BaseEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = 8435124153100506256L;
	/**
	 * 邀请码
	 */
	private String vipCode ;
	/**
	 * 图书馆id
	 */
	private String libId ;
	/**
	 * 折扣
	 */
	private String discount ;
	/**
	 * 1有效，2已使用
	 */
	private Integer  type;
	/**
	 * 使用人
	 */
	private String userId;
	
	private Date createTime;//生成时间
	/**
	 * 使用时间
	 */
	private Date updateTime;
	
	private User user = new User();
	
	public String getVipCode() {
		return vipCode;
	}
	public void setVipCode(String vipCode) {
		this.vipCode = vipCode;
	}
	public String getLibId() {
		return libId;
	}
	public void setLibId(String libId) {
		this.libId = libId;
	}
	public String getDiscount() {
		return discount;
	}
	public void setDiscount(String discount) {
		this.discount = discount;
	}
	public Integer getType() {
		return type;
	}
	public void setType(Integer type) {
		this.type = type;
	}
	public String getUserId() {
		return userId;
	}
	public void setUserId(String userId) {
		this.userId = userId;
	}
	@Column(updatable =false)
	public Date getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	@Column(insertable =false)
	public Date getUpdateTime() {
		return updateTime;
	}
	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}
	
	@OneToOne(cascade = { CascadeType.PERSIST}, fetch=FetchType.EAGER)
	@JoinColumn(name="userId",updatable =false,insertable =false)
	@Fetch(FetchMode.SELECT)
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	

}
