package com.ssj.bean.weixin.story.bean;

import com.ssj.bean.common.framework.core.domain.BaseEntity;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;


/** 
 * @author  ZhangCaibao 
 * @version 2018年3月20日 下午5:25:55 
 * 类说明 打卡获取的勋章
 */
@Entity
@Table(name = "tb_story_task_integral")
public class StoryTaskIntegral  extends BaseEntity{

	/**
	 * 
	 */
	private static final long serialVersionUID = 2132650307191249440L;
	
	/**
	 * 答对数
	 */
	private Integer num;
	/**
	 * 答题次数
	 */
	private Integer total;
	/**
	 * 题目标签1记忆2文字3鉴赏4运用
	 */
	private Integer type;
	/**
	 * 用户ID
	 */
	private String userId;
	/**
	 * 得分
	 */
	private Integer score;
	/**
	 * 百分比
	 */
	private String percentage ="0";
	
	public StoryTaskIntegral(){};
	public StoryTaskIntegral(Integer total,Integer type,String userId){
		this.total=total;
		this.type=type;
		this.userId=userId;
		this.num =0;
	};
	
	
	public Integer getNum() {
		return num;
	}
	public void setNum(Integer num) {
		this.num = num;
	}
	public Integer getTotal() {
		return total;
	}
	public void setTotal(Integer total) {
		this.total = total;
	}
	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;
	}
	@Transient
	public Integer getScore() {
		if(score!=null){
			return score;
		}
		if(num!=null){
			score =num*25;
			return score;
		}
		return 0;
	}
	public void setScore(Integer score) {
		this.score = score;
	}
	@Transient
	public String getPercentage() {
		return percentage;
	}
	public void setPercentage(String percentage) {
		this.percentage = percentage;
	}
	
	
	
	
	

}
