update 新增公共基础模块文档,明确增量修改原则与接口规范

This commit is contained in:
AprilWind
2026-05-15 13:59:44 +08:00
parent fe3f388ebd
commit 14e444e4bd
6 changed files with 119 additions and 2 deletions
+8
View File
@@ -15,9 +15,11 @@ description: 标准后端 CRUD 专家。用于当前项目中的新增单表 CRU
## 结构约定
- entity 默认继承 `BaseEntity`
- entity 使用 `@TableName`,主键使用 `@TableId`;存在 `delFlag`、乐观锁字段时保留 `@TableLogic``@Version`
- mapper 默认继承 `BaseMapperPlus<Entity, Vo>`
- BO 使用 `@AutoMapper(target = Entity.class, reverseConvertGenerate = false)`
- VO 使用 `@AutoMapper(target = Entity.class)`
- BO/VO/Entity 职责分离:请求、查询扩展字段放 BO;展示派生字段和 `@Translation` 放 VO
- 代码生成器模板按类名首字母小写命名 Mapper 字段,例如 `SysRoleMapper` -> `sysRoleMapper`;手写业务代码可使用具体业务短名
## 默认方法集合
@@ -32,8 +34,11 @@ description: 标准后端 CRUD 专家。用于当前项目中的新增单表 CRU
## 查询规则
- 单表查询优先用 `LambdaQueryWrapper`
- 项目公共链式查询可使用 `BaseMapperPlus#lambda()``LambdaCrudChainWrapper``LambdaQueryCondition``IfPresent` / `IfText` / `IfNotEmpty` 风格
- 日期范围默认从 `bo.getParams()` 中读取 begin/end
- 分页优先返回 `PageResult<Vo>`
- BO 转实体使用 `MapstructUtils.convert(bo, Entity.class)`
- 写入前校验优先放在 `validEntityBeforeSave(...)`
## 接口规则
@@ -47,6 +52,8 @@ description: 标准后端 CRUD 专家。用于当前项目中的新增单表 CRU
`PUT`
`DELETE /{ids}`
- 默认检查是否需要 `@SaCheckPermission``@Log``@RepeatSubmit`
- 权限标识遵循 `${module}:${business}:${action}`
- 导出接口通常保持 `POST /export`
## 自检
@@ -54,3 +61,4 @@ description: 标准后端 CRUD 专家。用于当前项目中的新增单表 CRU
- BO / VO / Entity 是否职责分离
- 导出、分页、删除前校验是否齐全
- 是否只是 generator 裸产物,如果是要继续补齐项目约定
- 前端 `api/types/index.vue` 如需同步,接口路径、返回结构、日期范围参数要与后端一致