-- 项目证据表
CREATE TABLE IF NOT EXISTS ccdi_evidence (
    evidence_id BIGINT NOT NULL AUTO_INCREMENT COMMENT '证据ID',
    project_id BIGINT NOT NULL COMMENT '项目ID',
    evidence_type VARCHAR(32) NOT NULL COMMENT '证据类型：FLOW/MODEL/ASSET',
    related_person_name VARCHAR(100) NOT NULL COMMENT '关联人员姓名',
    related_person_id VARCHAR(64) DEFAULT NULL COMMENT '关联人员标识，优先存身份证号或员工号',
    evidence_title VARCHAR(255) NOT NULL COMMENT '证据标题',
    evidence_summary VARCHAR(1000) NOT NULL COMMENT '证据摘要',
    source_type VARCHAR(64) NOT NULL COMMENT '来源类型：BANK_STATEMENT/MODEL_DETAIL/ASSET_DETAIL',
    source_record_id VARCHAR(128) DEFAULT NULL COMMENT '来源记录ID',
    source_page VARCHAR(100) DEFAULT NULL COMMENT '来源页面名称',
    snapshot_json LONGTEXT DEFAULT NULL COMMENT '证据快照JSON',
    confirm_reason VARCHAR(1000) NOT NULL COMMENT '确认理由/备注',
    confirm_by VARCHAR(64) DEFAULT NULL COMMENT '确认人',
    confirm_time DATETIME DEFAULT NULL COMMENT '确认时间',
    create_by VARCHAR(64) DEFAULT '' COMMENT '创建者',
    create_time DATETIME DEFAULT NULL COMMENT '创建时间',
    update_by VARCHAR(64) DEFAULT '' COMMENT '更新者',
    update_time DATETIME DEFAULT NULL COMMENT '更新时间',
    PRIMARY KEY (evidence_id),
    KEY idx_ccdi_evidence_project (project_id),
    KEY idx_ccdi_evidence_type (evidence_type),
    KEY idx_ccdi_evidence_person (related_person_id),
    KEY idx_ccdi_evidence_source (source_type, source_record_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='项目证据表';
