--- a/.agents/skills/forge-codegen-crud/SKILL.md +++ b/.agents/skills/forge-codegen-crud/SKILL.md @@ -25,6 +25,12 @@ - Put query SQL in Mapper XML. Do not generate Service-layer `LambdaQueryWrapper` query chains except MyBatis-Plus built-in `selectById`, `insert`, `updateById`, and `deleteById` style operations. - Use `pageNum` and `pageSize`; never generate backend `page` as the page parameter. - Use AiCrudPage URL placeholders with `:id` or `:${rowKey}`. Do not generate `{id}` placeholders. +- Generated CRUD controllers and frontend API configs must use Forge's POST-safe codegen contract for detail, create, update, and delete: + - detail: `POST /getById` + - create: `POST /add` + - update: `POST /edit` + - delete: `POST /remove/{id}` and `post@.../remove/:id` + Do not generate `PUT` or `DELETE` endpoints for generated CRUD modules. - Use `DictSelect`, `DictTag`, and `useDict()` for dictionary fields. Do not hardcode frontend options or status label maps. - Generate `sys_dict_type` and `sys_dict_data` seed SQL for new dictionaries, or explicitly reuse an existing dictionary type discovered in migrations. - Generate `sys_excel_export_config` and `sys_excel_column_config` seed SQL when import/export is enabled. --- a/.agents/skills/forge-codegen-crud/references/single-table-crud.md +++ b/.agents/skills/forge-codegen-crud/references/single-table-crud.md @@ -56,7 +56,7 @@ ## Controller Contract -Generate standard endpoints: +Generate Forge codegen-safe endpoints. Do not use `PUT` or `DELETE` for generated CRUD modules because project gateway and security policies expect POST for detail, update, and delete operations. ```java @Slf4j @@ -73,26 +73,26 @@ return RespInfo.success(exampleService.page(pageQuery, query)); } - @GetMapping("/{id}") + @PostMapping("/getById") @OperationLog(module = "示例管理", type = OperationType.QUERY, desc = "查询示例详情") - public RespInfo detail(@PathVariable Long id) { + public RespInfo detail(@RequestParam Long id) { return RespInfo.success(exampleService.getDetail(id)); } - @PostMapping + @PostMapping("/add") @OperationLog(module = "示例管理", type = OperationType.ADD, desc = "新增示例") public RespInfo create(@RequestBody BizExampleDTO dto) { return RespInfo.success(exampleService.create(dto)); } - @PutMapping + @PostMapping("/edit") @OperationLog(module = "示例管理", type = OperationType.UPDATE, desc = "修改示例") public RespInfo update(@RequestBody BizExampleDTO dto) { exampleService.update(dto); return RespInfo.success(); } - @DeleteMapping("/{id}") + @PostMapping("/remove/{id}") @OperationLog(module = "示例管理", type = OperationType.DELETE, desc = "删除示例") public RespInfo delete(@PathVariable Long id) { exampleService.delete(id); @@ -146,10 +146,10 @@