import { BaseEntity } from '../../base/entity/base'; import { Column, Entity, Index } from 'typeorm'; import { HandoverLeadAction, HandoverRedirectType, HandoverStatus, TeamHandoverLog, } from '../../../comm/types/omni'; /** * 离职资产安全交接工单历史表 * 表名: team_handover_log */ @Entity('team_handover_log') export class TeamHandoverLogEntity extends BaseEntity implements TeamHandoverLog { @Index({ unique: true }) @Column({ name: 'handover_no', comment: '不可逆工单流水号 (如 HO20260920xxxx)', length: 64, }) handoverNo: string; @Index() @Column({ name: 'from_user_id', comment: '离职员工用户 ID', }) fromUserId: number; @Index() @Column({ name: 'to_user_id', comment: '接任人用户 ID (若仅划入公海则可为空)', nullable: true, }) toUserId?: number | null; @Index() @Column({ name: 'card_id', comment: '交接的原名片 ID', nullable: true, }) cardId?: number | null; @Column({ name: 'redirect_type', comment: '短链重定向策略 (none/card/portal)', length: 20, default: 'none', }) redirectType: HandoverRedirectType; @Column({ name: 'redirect_target', comment: '重定向目标 (接替人名片标识或微官网URL)', length: 500, nullable: true, }) redirectTarget?: string | null; @Column({ name: 'lead_action', comment: '历史线索处理策略 (none/transfer/pool)', length: 20, default: 'none', }) leadAction: HandoverLeadAction; @Column({ name: 'migrated_lead_count', comment: '实际迁移或划入公海的线索数量', default: 0, }) migratedLeadCount: number; @Column({ name: 'operator_id', comment: '操作人/管理员 ID', nullable: true, }) operatorId?: number | null; @Column({ name: 'status', comment: '工单状态 (completed: 已完成, failed: 失败)', length: 20, default: 'completed', }) status: HandoverStatus; @Column({ name: 'remark', comment: '交接事由与操作说明', length: 500, nullable: true, }) remark?: string | null; @Column({ name: 'snapshot', comment: '资产交接前安全快照 (不可逆审计防篡改存证)', type: 'text', nullable: true, }) snapshot?: string | null; }