package cn.pluss.platform.entity;

import cn.pluss.platform.config.mybatis.SqlConditionExtra;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

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

/**
 * <p>
 * 会员消费日记录
 * </p>
 *
 * @author Djh
 * @since 2021-03-17
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("tb_pluss_member_trans_statistics")
public class MemberTransStatistics implements Serializable {

    private static final long serialVersionUID = 1L;

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


    /**
     * 用户id
     */
    @TableField("userId")
    private Integer userId;


    /**
     * 开始日期
     */
    @TableField("startDate")
    private LocalDate startDate;

    /**
     * 开始时间的查询开始时间
     */
    @TableField(exist = false, condition = "startDate &gt;= #{%s}")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private LocalDate startDateStart;

    /**
     * 开始时间的查询截止时间
     */
    @TableField(exist = false, condition = "startDate &lt; #{%s}")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private LocalDate startDateEnd;

    /**
     * 截止日期, 包含
     */
    @TableField("endDate")
    private LocalDate endDate;

    /**
     * 截止时间的查询开始时间
     */
    @TableField(exist = false, condition = "endDate &gt;= #{%s}")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private LocalDate endDateStart;

    /**
     * 截止时间的查询截止时间
     */
    @TableField(exist = false, condition = "endDate &lt; #{%s}")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private LocalDate endDateEnd;

    /**
     * 账单类型，1：日；2：周；3：月；4：年
     */
    @TableField("type")
    private Integer type;

    /**
     * 充值总额
     */
    @TableField("rechargeAmount")
    private BigDecimal rechargeAmount;


    /**
     * 消费总额
     */
    @TableField("consumeAmount")
    private BigDecimal consumeAmount;


    /**
     * 赠送总额
     */
    @TableField("giveAmount")
    private BigDecimal giveAmount;


    /**
     * 备注
     */
    @TableField("remark")
    private String remark;


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

    /**
     * 创建时间 开始时间
     */
    @TableField(select = false, value = "createTime", condition = SqlConditionExtra.GT)
    private Date createTimeStart;

    /**
     * 创建时间 截止时间
     */
    @TableField(select = false, value = "createTime", condition = SqlConditionExtra.LT)
    private Date createTimeEnd;

    /**
     * 更新时间
     */
    @TableField(value = "updateTime", fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    /**
     * 更新时间 开始时间
     */
    @TableField(select = false, value = "updateTime", condition = SqlConditionExtra.GT)
    private Date updateTimeStart;

    /**
     * 更新时间 截止时间
     */
    @TableField(select = false, value = "updateTime", condition = SqlConditionExtra.LT)
    private Date updateTimeEnd;

}