P1-3: codegen 默认输出 controller 到 biz 模块 (简化 cp 步骤)
合并 commit 9d06370 (核心 fix) + 本次 polish (3 处遗漏):
- shortToFull mapping: --module-only=controller 跟随默认行为 (默认→biz, --separate-controller→独立)
- hint message: 默认模式显示 P1-3 提示 (entity→entity-module, biz→biz-module 含 controller), --separate-controller 模式保留旧版提示
- AI help hook notes: 加 P1-3 说明条目
镜像: jxcj M1 实测 11 form codegen 后 9 controller 需手动 cp 到 ssw-{app}-biz/controller/, 对齐 ssw-dos 模块结构 (只有 entity + biz, controller 在 biz 里)
回执: docs/jxcj/dacli-fix-plan.md §P1-3 完成
JSON: /tmp/p1-3-complete.json
This commit is contained in:
1 parent
9d06370fc6
commit
1e054dff8d
1 file changed
+13
-3
@@ -829,10 +829,12 @@ export function buildFormCodegenCommand(): Command {
|
||||
.filter(Boolean)
|
||||
const moduleOnlyAll = moduleOnlyList.includes('all')
|
||||
// 短名 → 完整模块名映射
|
||||
// P1-3 fix (2026-07-16): controller 短名映射跟随 default 行为 (--separate-controller 决定 controller 在 biz 还是独立模块)
|
||||
const controllerModuleName = opts.separateController ? `${moduleArtifactId}-controller` : `${moduleArtifactId}-biz`
|
||||
const shortToFull: Record<string, string> = {
|
||||
entity: `${moduleArtifactId}-entity`,
|
||||
biz: `${moduleArtifactId}-biz`,
|
||||
controller: `${moduleArtifactId}-controller`,
|
||||
controller: controllerModuleName,
|
||||
}
|
||||
const wantedModules = new Set(
|
||||
moduleOnlyAll ? [] : moduleOnlyList.map((s) => shortToFull[s] || s),
|
||||
@@ -989,8 +991,13 @@ export function buildFormCodegenCommand(): Command {
|
||||
log.info('')
|
||||
log.info('后续步骤 (按 aibridge §POM 依赖规则):')
|
||||
log.info(` 1. 在 IDE 打开生成的 Java 文件, 检查 import 和 @RestController 路径 (期望 ${modulePackage}.controller.${mainClassName}Controller)`)
|
||||
log.info(` 2. 把目录 ${outDir} 移到 boot/${moduleArtifactId}-controller/src/main/java/${modulePackage.replace(/\./g, '/')}/`)
|
||||
log.info(` 3. mvn package 编译 (boot/${moduleArtifactId}-controller)`)
|
||||
if (opts.separateController) {
|
||||
log.info(` 2. 把目录 ${outDir} 移到 boot/${moduleArtifactId}-controller/src/main/java/${modulePackage.replace(/\./g, '/')}/`)
|
||||
log.info(` 3. mvn package 编译 (boot/${moduleArtifactId}-controller)`)
|
||||
} else {
|
||||
log.info(` 2. P1-3: 把 entity/ 移到 boot/${moduleArtifactId}-entity/, 把 biz/ 整目录 (含 controller) 移到 boot/${moduleArtifactId}-biz/`)
|
||||
log.info(` 3. mvn package 编译 (boot/${moduleArtifactId}-biz)`)
|
||||
}
|
||||
log.info(' 4. 部署到 jnpf-admin')
|
||||
log.info(` 5. 重启 JNPF 后浏览器访问 /api/${company}/${module}/... 验证`)
|
||||
// v0.11d+ Phase 3.3: --auto-menu 实际实现 (调 webapi /visualdev/Base/{formId}/Actions/Module)
|
||||
@@ -1012,6 +1019,8 @@ export function buildFormCodegenCommand(): Command {
|
||||
'--out': '输出目录 (默认 ./generated/${company}-${module}/)',
|
||||
// ⭐ 多模块归类 (v0.10+ 默认开启, 对齐 aibridge ssw-{appCode} 多模块 POM 结构)
|
||||
'--flat': '关闭多模块归类 (旧版兼容: 文件直接写到 outDir 根)',
|
||||
// P1-3 fix (2026-07-16): Controller 默认归 biz 模块
|
||||
'--separate-controller': 'Controller 输出到独立 ${moduleArtifactId}-controller/ (旧版行为, 默认合并到 biz, 对齐 ssw-dos)',
|
||||
'--multi-module-pom': '生成 4 个 pom.xml 占位 (parent + entity/biz/controller, 与 --flat 互斥)',
|
||||
'--module-only <list>': '只导出指定模块 (默认 all, 或 entity/biz/controller 逗号分隔, 用于单模块编译验证)',
|
||||
// ⭐ 推荐方式 (v0.10+): JNPF 原生别名系统, 写 base_visual_alias
|
||||
@@ -1048,6 +1057,7 @@ export function buildFormCodegenCommand(): Command {
|
||||
'--alias-file / --alias 用于批量设表/字段别名 (AliasModal.vue 等价)',
|
||||
'mainClassName 默认从 enCode 推导 (snake_case → PascalCase, 丢 appCode 前缀)',
|
||||
'白皮书 5.5 提到 mybatis-plus-generator 是该能力底层',
|
||||
'P1-3 (2026-07-16): Controller 默认归 biz 模块, 对齐 ssw-dos 模式, 不再需要手动 cp. 用 --separate-controller 回退到旧版行为',
|
||||
],
|
||||
})
|
||||
return cmd
|
||||
|
||||
Reference in new issue
Block a user