package org.springblade.file.pojo.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.format.annotation.DateTimeFormat;

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

/**
 * 业务附件信息表 实体类
 *
 * @author BladeX
 * @since 2024-09-04
 */
@Data
@TableName("blade_business_attachment")
@Schema(description = "BusinessAttachment对象")
public class BusinessAttachment implements Serializable {

	@Serial
	private static final long serialVersionUID = 1L;

	/**
	 * 业务id
	 */
	@Schema(description = "业务id")
	private Long bizId;
	/**
	 * 业务code
	 */
	@Schema(description = "业务code")
	private String bizCode;
	/**
	 * 附件id
	 */
	@Schema(description = "附件id")
	private Long attachmentId;
	/**
	 * 附件描述
	 */
	@Schema(description = "附件描述")
	@TableField(value = "`desc`")
	private String desc;
	/**
	 * 排序
	 */
	@Schema(description = "排序")
	private Integer sort;

	/**
	 * 租户ID
	 */
	@Schema(description = "租户ID")
	@TableField(fill = FieldFill.INSERT)
	private String tenantId;

	/**
	 * 主键id
	 */
	@JsonSerialize(using = ToStringSerializer.class)
	@Schema(description = "主键id")
	@TableId(value = "id", type = IdType.ASSIGN_ID)
	private Long id;

	/**
	 * 创建人
	 */
	@JsonSerialize(using = ToStringSerializer.class)
	@Schema(description = "创建人", hidden = true)
	@TableField(fill = FieldFill.INSERT)
	private Long createUser;

	/**
	 * 创建时间
	 */
	@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
	@JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
	@Schema(description = "创建时间", hidden = true)
	@TableField(fill = FieldFill.INSERT)
	private Date createTime;

	/**
	 * 更新人
	 */
	@JsonSerialize(using = ToStringSerializer.class)
	@Schema(description = "更新人", hidden = true)
	@TableField(fill = FieldFill.INSERT_UPDATE)
	private Long updateUser;

	/**
	 * 更新时间
	 */
	@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
	@JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
	@Schema(description = "更新时间", hidden = true)
	@TableField(fill = FieldFill.INSERT_UPDATE)
	private Date updateTime;

	/**
	 * 状态[0:未删除,1:删除]
	 */
	@TableLogic
	@Schema(description = "是否已删除", hidden = true)
	@TableField(fill = FieldFill.INSERT)
	private Integer isDeleted;
}
