generator client { provider = "prisma-client-js" output = "../generated/prisma" } datasource db { provider = "mysql" url = env("DATABASE_URL") } /// 申请单(“易耗品临时申请”) model v2_ConsumableTempRequest { id String @id @default(cuid()) applicantName String? applicantPhone String department String? reason String? neededAt DateTime? status v2_ConsumableTempRequestStatus @default(PENDING) approverId String? approvedAt DateTime? remark String? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt items v2_ConsumableTempRequestItem[] @@index([applicantPhone, createdAt]) @@index([status, createdAt]) @@map("易耗品临时申请") } /// 申请明细(易耗品条目) model v2_ConsumableTempRequestItem { id String @id @default(cuid()) requestId String name String spec String? quantity Int unit String? estimatedUnitCost Decimal? remark String? catalogId String? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt request v2_ConsumableTempRequest @relation(fields: [requestId], references: [id], onDelete: Cascade) @@index([requestId]) @@index([name]) @@index([catalogId], map: "易耗品临时申请_易耗品条目_catalogId_fkey") @@map("易耗品临时申请_易耗品条目") } model tb_consumable_goods { id BigInt @id @default(autoincrement()) goods_name String @db.VarChar(100) category_id BigInt? brand String? @db.VarChar(50) status Int? @default(0) @db.TinyInt create_time DateTime? @default(now()) @db.Timestamp(0) update_time DateTime? @default(now()) @db.Timestamp(0) delete_flag Boolean? @default(false) hosp_id String? @db.VarChar(32) // 关联 SKU tb_consumable_sku tb_consumable_sku[] @@index([category_id], map: "idx_goods_category") } model tb_consumable_sku { id BigInt @id @default(autoincrement()) goods_id BigInt sku_code String? @unique(map: "uk_sku_code") @db.VarChar(50) specification String? @db.VarChar(200) barcode String @unique(map: "uk_sku_barcode") @db.VarChar(50) supplier_id BigInt? purchase_price Decimal? @db.Decimal(10, 2) selling_price Decimal? @db.Decimal(10, 2) unit String? @db.VarChar(20) min_stock Int? @default(0) max_stock Int? status Int? @default(0) @db.TinyInt create_time DateTime? @default(now()) @db.Timestamp(0) update_time DateTime? @default(now()) @db.Timestamp(0) delete_flag Boolean? @default(false) hosp_id String? @db.VarChar(32) // 关联商品 tb_consumable_goods tb_consumable_goods @relation(fields: [goods_id], references: [id]) @@index([goods_id], map: "idx_sku_goods") @@index([supplier_id], map: "idx_sku_supplier") } enum v2_ConsumableTempRequestStatus { PENDING APPROVED REJECTED CANCELLED COMPLETED }