feat(G2-1,G2-2,G2-3): 扩展预算编号与工作流跨域桥接

这个提交包含在:
2026-03-07 18:59:44 +08:00
父节点 09b6f4fbb0
当前提交 52558f22c3
共修改 12 个文件,包含 1211 行新增和 175 行删除
+24 -12
查看文件
@@ -410,6 +410,7 @@ model LegalEntity {
employees Employee[]
holiday_calendars HolidayCalendar[] @relation("HolidayCalendarLegalEntity")
suppliers Supplier[]
budget_pools BudgetPool[] @relation("BudgetPoolLegalEntity")
@@index([enabled, archived_at], map: "idx_legal_entities_status")
@@index([default_holiday_calendar_id], map: "idx_legal_entities_default_calendar")
@@ -435,6 +436,7 @@ model CostCenter {
parent CostCenter? @relation("CostCenterToParent", fields: [parent_id], references: [id], onDelete: Restrict)
children CostCenter[] @relation("CostCenterToParent")
owner_employee Employee? @relation("CostCenterOwner", fields: [owner_employee_id], references: [id], onDelete: SetNull)
budget_pools BudgetPool[] @relation("BudgetPoolCostCenter")
@@unique([legal_entity_id, code], map: "legal_entity_cost_center_code_ux")
@@index([legal_entity_id, enabled, archived_at], map: "idx_cost_centers_legal_entity_status")
@@ -824,6 +826,8 @@ model BudgetPool {
code String @unique
name String
department_id String? @db.Uuid
legal_entity_id String? @db.Uuid
cost_center_id String? @db.Uuid
status String @default("active") @db.VarChar(16)
period_start DateTime @db.Date
period_end DateTime @db.Date
@@ -838,9 +842,12 @@ model BudgetPool {
updated_by String? @db.Uuid
department Department? @relation(fields: [department_id], references: [id], onDelete: SetNull)
legal_entity LegalEntity? @relation("BudgetPoolLegalEntity", fields: [legal_entity_id], references: [id], onDelete: SetNull)
cost_center CostCenter? @relation("BudgetPoolCostCenter", fields: [cost_center_id], references: [id], onDelete: SetNull)
ledger_entries BudgetLedgerEntry[]
@@index([department_id, status], map: "idx_budget_pools_department_status")
@@index([legal_entity_id, cost_center_id, status], map: "idx_budget_pools_scope_status")
@@index([status, period_start, period_end], map: "idx_budget_pools_period")
@@map("budget_pools")
}
@@ -849,6 +856,8 @@ model BudgetLedgerEntry {
id String @id @default(uuid()) @db.Uuid
budget_pool_id String @db.Uuid
reimbursement_id String? @db.Uuid
entity_type String? @db.VarChar(32)
entity_id String? @db.Uuid
kind String @db.VarChar(32)
amount Decimal @db.Decimal(14, 2)
note String?
@@ -860,6 +869,7 @@ model BudgetLedgerEntry {
@@index([budget_pool_id, created_at], map: "idx_budget_ledger_pool_created_at")
@@index([reimbursement_id])
@@index([entity_type, entity_id], map: "idx_budget_ledger_entity")
@@map("budget_ledger_entries")
}
@@ -969,18 +979,19 @@ model WorkflowDefinition {
}
model WorkflowInstance {
id String @id @default(uuid()) @db.Uuid
workflow_id String @db.Uuid
entity_type String
entity_id String @db.Uuid
reimbursement_id String? @db.Uuid
leave_request_id String? @db.Uuid
submitter_id String @db.Uuid
current_status WorkflowInstanceStatus @default(pending)
current_step_id String
context_data Json
started_at DateTime @default(now())
completed_at DateTime?
id String @id @default(uuid()) @db.Uuid
workflow_id String @db.Uuid
entity_type String
entity_id String @db.Uuid
reimbursement_id String? @db.Uuid
leave_request_id String? @db.Uuid
purchase_request_id String? @db.Uuid
submitter_id String @db.Uuid
current_status WorkflowInstanceStatus @default(pending)
current_step_id String
context_data Json
started_at DateTime @default(now())
completed_at DateTime?
created_at DateTime @default(now())
created_by String? @db.Uuid
@@ -1003,6 +1014,7 @@ model WorkflowInstance {
@@index([entity_type, entity_id])
@@index([reimbursement_id])
@@index([leave_request_id])
@@index([purchase_request_id])
@@index([current_status])
@@index([submitter_id])
@@index([context_department_id])