package cn.pluss.platform.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

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

/**
 * <p>
 * 用户区域流水
 * </p>
 *
 * @author bzg
 * @since 2022-03-01
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@NoArgsConstructor
@TableName("tb_pluss_user_area_reward_flow")
public class UserAreaRewardFlow implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;


    /**
     * 用户ID
     */
    @TableField("userId")
    private Long userId;


    /**
     * 角色类型
     */
    @TableField("roleCode")
    private String roleCode;


    /**
     * 区域流水
     */
    @TableField("areaFlow")
    private BigDecimal areaFlow;


    /**
     * 区域奖励
     */
    @TableField("rewardAmt")
    private BigDecimal rewardAmt;


    /**
     * 创建时间
     */
    @TableField(value = "createTime", fill = FieldFill.INSERT)
    private Date createTime;

    /**
     * 创建时间 开始时间
     */
    @TableField(exist = false, condition = "createTime &gt; #{%s}")
    private Date createTimeStart;

    /**
     * 创建时间 截止时间
     */
    @TableField(exist = false, condition = "createTime &lt; #{%s}")
    private Date createTimeEnd;

    @TableField("createDate")
    private Date createDate;

    @TableField("profitDate")
    private Date profitDate;

    /**
     *  开始时间
     */
    @TableField(exist = false, condition = "createDate &gt; #{%s}")
    private Date createDateStart;

    /**
     *  截止时间
     */
    @TableField(exist = false, condition = "createDate &lt; #{%s}")
    private Date createDateEnd;

    public UserAreaRewardFlow(UserApp app, BigDecimal flow,BigDecimal rewardAmt) {
        this.areaFlow = flow;
        this.userId = app.getUserId();
        this.roleCode = app.getRoleCode();
        this.rewardAmt = rewardAmt;
    }
}