59 lines
1.5 KiB
Java
59 lines
1.5 KiB
Java
package com.aiteacher.document;
|
|
|
|
import jakarta.persistence.*;
|
|
import java.io.Serializable;
|
|
import java.util.Objects;
|
|
import java.util.UUID;
|
|
|
|
@Entity
|
|
@Table(name = "chunk_figure_ref")
|
|
@IdClass(ChunkFigureRefEntity.PK.class)
|
|
public class ChunkFigureRefEntity {
|
|
|
|
@Id
|
|
@Column(name = "chunk_id", nullable = false)
|
|
private UUID chunkId;
|
|
|
|
@Id
|
|
@Column(name = "figure_id", nullable = false, length = 200)
|
|
private String figureId;
|
|
|
|
@Column(name = "mention_page")
|
|
private Integer mentionPage;
|
|
|
|
public ChunkFigureRefEntity() {}
|
|
|
|
public ChunkFigureRefEntity(UUID chunkId, String figureId, Integer mentionPage) {
|
|
this.chunkId = chunkId;
|
|
this.figureId = figureId;
|
|
this.mentionPage = mentionPage;
|
|
}
|
|
|
|
public UUID getChunkId() { return chunkId; }
|
|
public String getFigureId() { return figureId; }
|
|
public Integer getMentionPage() { return mentionPage; }
|
|
|
|
public static class PK implements Serializable {
|
|
private UUID chunkId;
|
|
private String figureId;
|
|
|
|
public PK() {}
|
|
public PK(UUID chunkId, String figureId) {
|
|
this.chunkId = chunkId;
|
|
this.figureId = figureId;
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object o) {
|
|
if (this == o) return true;
|
|
if (!(o instanceof PK pk)) return false;
|
|
return Objects.equals(chunkId, pk.chunkId) && Objects.equals(figureId, pk.figureId);
|
|
}
|
|
|
|
@Override
|
|
public int hashCode() {
|
|
return Objects.hash(chunkId, figureId);
|
|
}
|
|
}
|
|
}
|