diff --git a/src/commands/form/create.ts b/src/commands/form/create.ts index 382549d..12f63f8 100644 --- a/src/commands/form/create.ts +++ b/src/commands/form/create.ts @@ -130,6 +130,19 @@ export function buildFormCreateCommand(): Command { }, ] + // 2026-06-27 B-9 修复: tables 推导后, 自动给第一个表加 typeId='1' (主表标识) + // 后端 jnpf/.../FlowFormDataUtil.java:831 查 typeId='1' 找主表, 找不到抛 MsgCode.COD001 + // ("集合条件过滤获得目标为空"). 即使用户 --tables 显式传了, 也可能漏 typeId. + // 兜底 schema 已有 typeId='1' (line 124), 这里统一保护用户传入路径. + // 用户 --tables 显式指定 typeId 不受影响 (先检查 !t.typeId). + if (Array.isArray(tables) && tables.length > 0) { + tables.forEach((t: any, idx: number) => { + if (t && typeof t === 'object' && !t.typeId) { + t.typeId = idx === 0 ? '1' : '0' + } + }) + } + const body: Record = { fullName: opts.fullName, enCode: opts.enCode,