package cn.pluss.platform.entity;

import com.alibaba.fastjson.annotation.JSONField;
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.util.Date;

/**
 * <p>
 * 缴费通商户费率表(新)
 * </p>
 *
 * @author Djh
 * @since 2022-06-21
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("tb_pluss_jft_merchant_rate_record")
public class JftMerchantRateRecord implements Serializable {

    private static final long serialVersionUID = 1L;

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


    /**
     * 通道id
     */
    @TableField("channel")
    private Integer channel;


    /**
     * 商户编码
     */
    @TableField("merchantId")
    private String merchantId;


    /**
     * 支付宝费率等级，费率参考字典表ali_rate
     */
    @TableField("aliRate")
    private Integer aliRate;


    /**
     * 状态，0：费率变更未完成，1：费率变更成功，2：费率变更失败 
     */
    @TableField("status")
    private String status;

    @TableField(exist = false)
    private String statusDesc;

    public String getStatusDesc() {
        switch (status) {
            case "0":
                statusDesc = "审核中";
                break;
            case "1":
                statusDesc = "变更成功";
                break;
            case "2":
                statusDesc = "变更失败";
                break;
            default:
                break;
        }

        return statusDesc;
    }

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


    /**
     * 创建时间
     */
    @TableField(value = "createTime", fill = FieldFill.INSERT)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

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

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

    /**
     * 更新时间
     */
    @TableField(value = "updateTime", fill = FieldFill.INSERT_UPDATE)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

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

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

    /**
     * 操作日期
     */
    @TableField(value = "operationDate", insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER)
    private String operationDate;


}