package com.ssj.bean.sys.codeexchange;

import com.ssj.bean.common.framework.core.domain.BaseEntity;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;

/**
 * @author Mount Liu
 * @date 2019/5/9
 */
@Entity
@Table(name = "tb_code_exchange")
public class CodeExchange extends BaseEntity {
    private static final long serialVersionUID = 890135943022798129L;
    /**
     * 兑换码
     */
    private String code;
    /**
     * 模块（1：作业吧赠送服务，2：电商优惠券兑换）
     */
    private int module;
    /**
     * 具体兑换类型（0：无，1：兑换月，2：兑换天）
     */
    private int type;
    /**
     * 兑换月数
     */
    private int months;
    /**
     * 兑换天数
     */
    private int days;
    /**
     * 有效开始时间
     */
    private Date startTime;
    /**
     * 有效结束时间
     */
    private Date endTime;
    /**
     * 创建时间
     */
    private Date createTime;
    /**
     * 是否有效 1:有效，0:无效
     */
    private int isValid;
    /**
     * 受益者
     */
    private String userId;
    /**
     * 受益者名字
     */
    private String userName;
    /**
     * 生成兑换码数量
     */
    private int number;
    /**
     * 是否被锁定，下单却未支付成功会被锁定（0：未锁定，1：锁定）
     */
    private int isLock;

    public int getIsLock() {
        return isLock;
    }

    public void setIsLock(int isLock) {
        this.isLock = isLock;
    }

    @Transient
    public int getNumber() {
        return number;
    }

    public void setNumber(int number) {
        this.number = number;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public int getModule() {
        return module;
    }

    public void setModule(int module) {
        this.module = module;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public int getMonths() {
        return months;
    }

    public void setMonths(int months) {
        this.months = months;
    }

    public int getDays() {
        return days;
    }

    public void setDays(int days) {
        this.days = days;
    }
    @DateTimeFormat(pattern="yyyy-MM-dd")
    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }
    @DateTimeFormat(pattern="yyyy-MM-dd")
    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public int getIsValid() {
        return isValid;
    }

    public void setIsValid(int isValid) {
        this.isValid = isValid;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }
}
