kongdeqiang
2026-10-09 9af621d181217a03b1b3dce208a163915db974a3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package com.custom.webui.entity;
 
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
 
import java.time.LocalDateTime;
 
/**
 * RAG 文件与向量集合映射实体,对应表 {@code rag_collection}。
 *
 * <p>向量数据本身存放在 Chroma,本表只保存「文件 -> 集合名」的映射与入库状态,
 * 保证业务数据与向量数据分离(文档核心约束)。
 */
@Data
@TableName("rag_collection")
public class RagCollection {
 
    @TableId(type = IdType.AUTO)
    private Long id;
 
    private Long userId;
 
    /** 关联 upload_file.id */
    private Long fileId;
 
    /** Chroma / Qdrant 中的集合名称 */
    private String collectionName;
 
    /** 入库分块数量 */
    private Integer chunkCount;
 
    /** pending / ready / failed */
    private String status;
 
    /** 失败原因或状态说明 */
    private String message;
 
    private LocalDateTime createdAt;
 
    public static final String STATUS_PENDING = "pending";
    public static final String STATUS_READY = "ready";
    public static final String STATUS_FAILED = "failed";
}