From 2ba929c609381a95bb0d1b593ddb9807d29d46f9 Mon Sep 17 00:00:00 2001 From: Cheng Jinbao Date: Thu, 13 Aug 2026 20:49:45 +0800 Subject: [PATCH 01/12] =?UTF-8?q?refactor(core):=20=E5=B0=86=E5=85=B3?= =?UTF-8?q?=E7=B3=BB=E5=AD=97=E6=AE=B5=E9=87=8D=E5=91=BD=E5=90=8D=E4=B8=BA?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E5=BC=95=E7=94=A8=E5=AD=97=E6=AE=B5=E4=BB=A5?= =?UTF-8?q?=E6=8F=90=E9=AB=98=E8=AF=AD=E4=B9=89=E6=B8=85=E6=99=B0=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将 RelationField 重命名为 ModelRefField - 将 ModelRelation 注解重命名为 ModelRef - 将 ScalarType 中的 RELATION 类型重命名为 MODEL_REF - 更新所有相关字段、方法和变量名称以匹配新命名 - 修改测试资源文件中的类型定义以使用新命名约定 - 更新 Jackson 序列化配置以使用新的字段类型名称 --- .../DataModeling/components/FieldForm.tsx | 34 +++++++++---------- .../DataModeling/components/FieldList.tsx | 8 ++--- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/pages/DataModeling/components/FieldForm.tsx b/src/pages/DataModeling/components/FieldForm.tsx index bc17ba5..f8e0482 100644 --- a/src/pages/DataModeling/components/FieldForm.tsx +++ b/src/pages/DataModeling/components/FieldForm.tsx @@ -112,8 +112,8 @@ export const FieldInitialValues: any = { nullable: true, identity: false, }, - RELATION: { - type: 'Relation', + MODEL_REF: { + type: 'ModelRef', multiple: true, localField: null, foreignField: null, @@ -151,7 +151,7 @@ const FieldForm = React.forwardRef(({ validateFields: form.validateFields, })); const [modelList, setModelList] = useState([]); - const [RelationModel, setRelationModel] = useState(); + const [ModelRefModel, setModelRefModel] = useState(); const [tmpType, setTmpType] = useState(""); const reqModelList = React.useCallback(async () => { @@ -190,8 +190,8 @@ const FieldForm = React.forwardRef(({ }); let tmpTypeValue = currentValue.tmpType; if (!tmpTypeValue) { - if (currentValue.type === 'Relation' && currentValue.from) { - tmpTypeValue = `Relation:${currentValue.from}`; + if (currentValue.type === 'ModelRef' && currentValue.from) { + tmpTypeValue = `ModelRef:${currentValue.from}`; } else if (currentValue.type === 'Enum' && currentValue.from) { tmpTypeValue = `Enum:${currentValue.from}`; } else { @@ -206,23 +206,23 @@ const FieldForm = React.forwardRef(({ }, [currentValue, form, initialValues, reqModelList]); useEffect(() => { - if (tmpType?.startsWith("Relation:")) { - const relatedModelName = tmpType.replace("Relation:", ""); + if (tmpType?.startsWith("ModelRef:")) { + const relatedModelName = tmpType.replace("ModelRef:", ""); const relatedModel = modelList.find((m) => m.name === relatedModelName); - setRelationModel(relatedModel); + setModelRefModel(relatedModel); } else { - setRelationModel(null); + setModelRefModel(null); } }, [modelList, tmpType]); const handleTypeChange = (value: string) => { setTmpType(value); console.log("----"); - if (value.startsWith("Relation")) { + if (value.startsWith("ModelRef")) { form.setFieldsValue({ - ...FieldInitialValues["RELATION"], - type: "Relation", - from: value.replace("Relation:", ""), + ...FieldInitialValues["MODEL_REF"], + type: "ModelRef", + from: value.replace("ModelRef:", ""), multiple: false, defaultValue: { type: "fixed", value: null }, }); @@ -333,7 +333,7 @@ const FieldForm = React.forwardRef(({ .map((item) => ( {item.name} @@ -370,7 +370,7 @@ const FieldForm = React.forwardRef(({ )} - {form.getFieldValue("tmpType")?.startsWith("Relation") && ( + {form.getFieldValue("tmpType")?.startsWith("ModelRef") && ( <> (({ rules={[{ required: true }]} > -