import { BaseEntity } from '../../base/entity/base'; import { Column, Entity, Index } from 'typeorm'; import { NFCMaterial, NFCRecord, NFCSceneMode, NFCStatus, } from '../../../comm/types/omni'; /** * NFC 实体卡设备台账 * 表名: nfc_device */ @Entity('nfc_device') export class NfcDeviceEntity extends BaseEntity implements NFCRecord { @Index({ unique: true }) @Column({ name: 'uid', comment: '硬件唯一识别芯片 UID', length: 64, }) uid: string; @Index() @Column({ name: 'card_id', comment: '当前绑定的名片 ID', type: 'bigint', nullable: true, }) cardId?: number | null; @Column({ name: 'batch_no', comment: '硬件制造/下发批次号', length: 64, }) batchNo: string; @Column({ name: 'material', comment: '物理材质 wood/metal/pvc', length: 16, default: 'pvc', }) material: NFCMaterial; @Index() @Column({ name: 'status', comment: '设备状态 active/suspended/unbound', length: 16, default: 'unbound', }) status: NFCStatus; @Column({ name: 'scene_mode', comment: '场景模式 business/social', length: 16, default: 'business', }) sceneMode: NFCSceneMode; @Column({ name: 'last_scanned_at', comment: '最后一次被触碰扫描时间', type: 'varchar', length: 32, nullable: true, }) lastScannedAt?: string | Date | null; }