package com.gxwebsoft.common.system.entity;

import cn.hutool.core.util.DesensitizedUtil;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

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

/**
 * 文件上传记录
 *
 * @author WebSoft
 * @since 2021-08-29 12:36:32
 */
@Data
@Schema(description = "文件上传记录")
@TableName("sys_file_record")
public class FileRecord implements Serializable {
    private static final long serialVersionUID = 1L;

    @Schema(description = "主键id")
    @TableId(type = IdType.AUTO)
    private Integer id;

    @Schema(description = "文件类型, 0本地存储, 1阿里云oss, 2腾讯云cos，3七牛云，4其他")
    private Integer type;

    @Schema(description = "访问域名")
    @TableField(exist = false)
    private String domain;

    @Schema(description = "分组ID")
    private Integer groupId;

    @Schema(description = "文件名称")
    private String name;

    @Schema(description = "文件存储路径")
    private String path;

    @Schema(description = "文件大小")
    private Long length;

    @Schema(description = "文件类型")
    private String contentType;

    @Schema(description = "备注")
    private String comments;

    @Schema(description = "应用ID")
    private Integer appId;

    @Schema(description = "企业ID")
    private Integer companyId;

    @Schema(description = "商户ID")
    private Long merchantId;

    @Schema(description = "创建人")
    private Integer createUserId;

    @Schema(description = "是否删除, 0否, 1是")
    @TableLogic
    private Integer deleted;

    @Schema(description = "租户id")
    private Integer tenantId;

    @Schema(description = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @Schema(description = "修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    @Schema(description = "文件访问地址")
    @TableField(exist = false)
    private String url;

    @Schema(description = "文件缩略图访问地址")
    @TableField(exist = false)
    private String thumbnail;

    @Schema(description = "大图(用于PC端的banner等)")
    @TableField(exist = false)
    private String bigImage;

    @Schema(description = "文件下载地址")
    @TableField(exist = false)
    private String downloadUrl;

    @Schema(description = "创建人账号")
    @TableField(exist = false)
    private String createUsername;

    @Schema(description = "创建人名称")
    @TableField(exist = false)
    private String createNickname;

    @Schema(description = "用户头像")
    @TableField(exist = false)
    private String avatar;
}
