package com.ifish.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.ifish.serializer.CustomDateSerializer;

/**
 * 等级经验值获取记录
 * @author Administrator
 *
 */
@Entity
@Table(name="tbl_grade_record")
public class GradeRecord implements Serializable{

	private static final long serialVersionUID = 4877610293427598136L;
	/**
	 * 记录ID
	 */
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="record_id")
	private Integer recordId;
	/**
	 * 用户ID
	 */
	@Column(name="user_id",nullable=false)
	private Integer userId;
	/**
	 * 规则类型
	 */
	@Column(name="task_type",nullable=false,length=20)
	private String ruleType;
	/**
	 * 增加经验值
	 */
	@Column(name="add_value",nullable=false)
	private Integer addValue;
	/**
	 * 记录描述
	 */
	@Column(name="record_remark",nullable=false,length=50)
	private String recordRemark;
	/**
	 * 创建时间
	 */
	@JsonSerialize(using = CustomDateSerializer.class)
	@Column(name="create_time",nullable=true)
	@Temporal(TemporalType.TIMESTAMP)
	private Date createTime;
	
	public GradeRecord() {}
	
	public GradeRecord(Integer userId, String ruleType, Integer addValue,
			String recordRemark) {
		this.userId = userId;
		this.ruleType = ruleType;
		this.addValue = addValue;
		this.recordRemark = recordRemark;
		this.createTime = new Date();
	}

	public Integer getRecordId() {
		return recordId;
	}
	public void setRecordId(Integer recordId) {
		this.recordId = recordId;
	}
	public Integer getUserId() {
		return userId;
	}
	public void setUserId(Integer userId) {
		this.userId = userId;
	}
	public Date getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	public String getRecordRemark() {
		return recordRemark;
	}
	public void setRecordRemark(String recordRemark) {
		this.recordRemark = recordRemark;
	}

	public String getRuleType() {
		return ruleType;
	}

	public void setRuleType(String ruleType) {
		this.ruleType = ruleType;
	}

	public Integer getAddValue() {
		return addValue;
	}

	public void setAddValue(Integer addValue) {
		this.addValue = addValue;
	}
	
}
