SysFile.java 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. package com.backendsys.modules.upload.entity;
  2. import com.backendsys.config.Mybatis.handler.timezone.LocalDateTimeAdapter;
  3. import com.baomidou.mybatisplus.annotation.*;
  4. import com.google.gson.annotations.JsonAdapter;
  5. import jakarta.validation.constraints.NotEmpty;
  6. import jakarta.validation.constraints.NotNull;
  7. import jakarta.validation.constraints.Size;
  8. import lombok.Data;
  9. import java.time.LocalDateTime;
  10. import java.util.List;
  11. @Data
  12. @TableName("sys_file")
  13. public class SysFile {
  14. public static interface Update{}
  15. public static interface UpdateBatch{}
  16. public static interface Delete{}
  17. public static interface DeleteBatch{}
  18. public static interface SelectByMd5{}
  19. @TableId(type = IdType.AUTO)
  20. @NotNull(message = "id 不能为空", groups = { Update.class })
  21. private Long id;
  22. @TableField(exist = false)
  23. @NotNull(message = "ids 不能为空", groups = { UpdateBatch.class })
  24. @Size(min = 1, message = "ids 的数量必须大于 0", groups = { UpdateBatch.class })
  25. private List<Long> ids;
  26. @TableField(updateStrategy = FieldStrategy.NOT_NULL)
  27. private Long category_id;
  28. @TableField(exist = false)
  29. private String category_name;
  30. private String request_id;
  31. private String upload_id;
  32. private Integer upload_chunk_count;
  33. private Integer upload_chunk_index;
  34. private Long user_id;
  35. @TableField(exist = false)
  36. private String username;
  37. @NotEmpty(message = "文件名不能为空", groups = { Update.class })
  38. @Size(max = 50, message = "文件名长度不超过 {max} 字符", groups = { Update.class })
  39. private String name;
  40. private String content_type;
  41. private String url;
  42. private String url_thumb;
  43. @NotEmpty(message = "object_key 不能为空", groups = { Delete.class })
  44. private String object_key;
  45. @TableField(exist = false)
  46. @NotNull(message = "object_keys 不能为空", groups = { DeleteBatch.class })
  47. @Size(min = 1, message = "object_keys 的数量必须大于 0", groups = { DeleteBatch.class })
  48. private List<String> object_keys;
  49. private Long size;
  50. @NotEmpty(message = "md5 不能为空", groups = { SelectByMd5.class })
  51. private String md5;
  52. private Integer target; // 上传目标 (-1:本地, 1:腾讯云, 2:阿里云, 3.抖音云)
  53. @TableField(exist = false)
  54. private String target_label;
  55. @TableField(exist = false)
  56. private Boolean is_exist;
  57. // "上传时间" 只有 秒传 和 合并重复MD5 的时候会更新,"编辑" 的时候不变
  58. @JsonAdapter(LocalDateTimeAdapter.class)
  59. private LocalDateTime upload_time;
  60. @JsonAdapter(LocalDateTimeAdapter.class)
  61. private LocalDateTime create_time;
  62. @JsonAdapter(LocalDateTimeAdapter.class)
  63. private LocalDateTime update_time;
  64. }