1
This commit is contained in:
67
src/main/java/cn/van/business/model/pl/ImageConversion.java
Normal file
67
src/main/java/cn/van/business/model/pl/ImageConversion.java
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user