package com.ruoyi.web.work.domain;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.Version;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.web.work.domain.base.BaseData;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;

/**
 * @author lsw
 * @date 2024-04-17
 */
@Data
@TableName(value = "tb_recharge")
@Accessors(chain = true)
public class Recharge extends BaseData {
    private static final long serialVersionUID = 1L;

    private Long id;

    @ApiModelProperty(value = "关联企业")
    private Long companyId;

    @ApiModelProperty(value = "充值人id")
    private Long userId;

    @ApiModelProperty(value = "充值编号")
    @Excel(name = "充值编号", width = 30, sort = 1)
    private String nums;

    @NotNull(message = "充值金额不能为空")
    @DecimalMin(value = "1", inclusive = false, message = "充值金额不能小于1")
    @ApiModelProperty(value = "充值金额")
    @Excel(name = "充值金额", sort = 2)
    private BigDecimal money;

    @NotBlank(message = "充值凭证不能为空")
    @ApiModelProperty(value = "充值凭证")
    private String certificate;

    @ApiModelProperty(value = "状态:0=正常,1=停用")
    @Excel(name = "充值状态", readConverterExp = "0=待充值,1=充值成功,2=充值失败", sort = 3)
    private Integer state;

    @ApiModelProperty(value = "充值无效原因")
    private String msg;

    @Excel(name = "申请人", sort = 4)
    private String opBy;

    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "申请时间", dateFormat = "yyyy-MM-dd HH:mm:ss", width = 30, sort = 5)
    private Date createTime;

    @TableField(fill = FieldFill.UPDATE)
    private String updateBy;

    @TableField(fill = FieldFill.UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    //乐观锁
    @JsonIgnore
    @Version
    private Long version;

    @ApiModelProperty(value = "企业名称")
    @TableField(exist = false)
    @Excel(name = "企业名称", sort = 0, width = 40)
    private String companyName;

}
