This commit is contained in:
Rao 2025-04-21 15:46:52 +08:00
parent 3ad10be5ca
commit bfc595d843
2 changed files with 69 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import React, {
// import { useDebounce } from "use-debounce";
import { Form, FormInstance } from 'antd';
import { api } from "@nice/client";
import { TaxonomySlug } from "packages/common/dist";
interface AssessmentStandardContextType {
form: FormInstance;

View File

@ -45,6 +45,10 @@ model Term {
depts Department[] @relation("department_term")
hasChildren Boolean? @default(false) @map("has_children")
posts Post[] @relation("post_term")
Plan Plan? @relation(fields: [planId], references: [id])
planId String?
Subject Subject? @relation(fields: [subjectId], references: [id])
subjectId String?
@@index([name]) // 对name字段建立索引以加快基于name的查找速度
@@index([parentId]) // 对parentId字段建立索引以加快基于parentId的查找速度
@ -420,6 +424,9 @@ model Department {
// watchedPost Post[] @relation("post_watch_dept")
hasChildren Boolean? @default(false) @map("has_children")
planId String?
Plan Plan? @relation(fields: [planId], references: [id])
@@index([parentId])
@@index([isDomain])
@@index([name])
@ -466,6 +473,7 @@ model Staff {
enrollments Enrollment[]
teachedPosts PostInstructor[]
ownedResources Resource[]
Plan Plan[]
@@index([officerId])
@@index([deptId])
@ -537,3 +545,63 @@ model SportStandard {
model Plan {
id String @id @default(cuid())
authorId String? @map("author_id")
author Staff? @relation(fields: [authorId], references: [id]) // 帖子作者,关联 Staff 模型
createdAt DateTime @default(now()) @map("created_at")
publishedAt DateTime? @map("published_at") // 发布时间
updatedAt DateTime @map("updated_at")
deletedAt DateTime? @map("deleted_at") // 删除时间,可为空
terms Term[] @relation("plan_term")
month DateTime @map("month")
week DateTime @map("week")
checked Boolean @default(false) @map("checked")
depts Department[] @relation("plan_dept")
meta Json? @map("meta") // 计划表
@@map("plan")
}
model Subject {
id String @id @default(cuid())
name String @map("name")
terms Term[] @relation("subject_term")
parentId String? @map("parent_id")
parent Subject? @relation("SubjectChildren", fields: [parentId], references: [id]) // 父级帖子,关联 Post 模型
children Subject[] @relation("SubjectChildren") // 子级帖子列表,关联 Post 模型
ancestors SubjectAncestry[] @relation("DescendantToAncestor")
descendants SubjectAncestry[] @relation("AncestorToDescendant")
@@map("subject")
}
model SubjectAncestry {
id String @id @default(cuid())
relDepth Int @map("rel_depth")
ancestorId String? @map("ancestor_id")
ancestor Subject? @relation("DescendantToAncestor", fields: [ancestorId], references: [id])
descendantId String @map("descendant_id")
descendant Subject @relation("AncestorToDescendant", fields: [descendantId], references: [id])
@@index([ancestorId])
@@index([descendantId])
@@index([ancestorId, descendantId])
@@map("subject_ancestry")
}