This commit is contained in:
2025-11-03 11:54:11 +08:00
parent 5f75603532
commit 6b36f0ee52
9 changed files with 741 additions and 2 deletions

View File

@@ -0,0 +1,67 @@
package cn.van.business.model.pl;
import jakarta.persistence.*;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 图片转换记录实体类
* 用于记录webp格式图片转换为jpg格式的映射关系
*
* @author System
* @version 1.0
*/
@Entity
@Table(name = "image_conversions", indexes = {
@Index(name = "idx_original_url", columnList = "originalUrl"),
@Index(name = "idx_converted_url", columnList = "convertedUrl")
})
@Data
public class ImageConversion {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
/**
* 原始webp图片URL
*/
@Column(name = "original_url", nullable = false, length = 2048, unique = true)
private String originalUrl;
/**
* 转换后的jpg图片URL或本地路径
*/
@Column(name = "converted_url", nullable = false, length = 2048)
private String convertedUrl;
/**
* 转换时间
*/
@Column(name = "converted_at", nullable = false)
private LocalDateTime convertedAt;
/**
* 文件大小(字节)
*/
@Column(name = "file_size")
private Long fileSize;
/**
* 创建时间
*/
@Column(name = "created_at", nullable = false, updatable = false)
private LocalDateTime createdAt;
@PrePersist
protected void onCreate() {
if (createdAt == null) {
createdAt = LocalDateTime.now();
}
if (convertedAt == null) {
convertedAt = LocalDateTime.now();
}
}
}