diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 764f5f75..0bd20fed 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -14,10 +14,14 @@ export default defineConfig({ nav: [ {text: '首页', link: '/'}, {text: '帮助文档', link: '/zh/what-is-mybatisflex'}, - {text: '更新日志', link: 'https://gitee.com/mybatis-flex/mybatis-flex/releases'}, - {text: '示例代码', link: 'https://gitee.com/mybatis-flex/mybatis-flex-samples'}, { - text: '源码', items: [ + text: '周边', items: [ + {text: '示例代码', link: 'https://gitee.com/mybatis-flex/mybatis-flex-samples'}, + {text: '更新日志', link: 'https://gitee.com/mybatis-flex/mybatis-flex/releases'}, + ] + }, + { + text: '获取源码', items: [ {text: 'Gitee', link: 'https://gitee.com/mybatis-flex/mybatis-flex'}, {text: 'Github', link: 'https://github.com/mybatis-flex/mybatis-flex'} ] diff --git a/docs/zh/apt.md b/docs/zh/apt.md index aee60c44..456a2324 100644 --- a/docs/zh/apt.md +++ b/docs/zh/apt.md @@ -35,6 +35,14 @@ processor.tablesPackage = com.your-package processor.tablesClassName = your-class-name ``` +## APT 过滤 Entity 后缀 +在某些情况下,Entity 类可能会有某些通用的后缀,比如 `AccountModel` 或者 `AccountDto` 等,我们希望生成的代码, +不包含 `Model` `Dto` 等后缀,可以添加如下的配置: + +```properties +processor.entity.ignoreSuffixes = Model, Dto +``` + ## APT 开启 Mapper 生成 diff --git a/docs/zh/column.md b/docs/zh/column.md index b07a3663..52d8bfe7 100644 --- a/docs/zh/column.md +++ b/docs/zh/column.md @@ -269,4 +269,11 @@ mybatis-flex 内置的扩展 typeHandler 还有: - GsonTypeHandler - JacksonTypeHandler -当然,我们也可以写一个自己的类,实现 `TypeHandler` 接口,然后通过 `@Column(typeHandler = YourHandler.class)` 注释给需要的字段。 \ No newline at end of file +当然,我们也可以写一个自己的类,实现 `TypeHandler` 接口,然后通过 `@Column(typeHandler = YourHandler.class)` 注释给需要的字段。 + +## 全局配置 + +在某些场景下,我们的 entity 可能会有通用的字段以及配置,这种场景如果我们要为每个 entity 去设置,这会相对麻烦。 +在这种场景下,我们可以建立一个通用的 BaseEntity 类,然后让所有的 Entity 都继承是该类。 + +Entity 一般是通过代码生成器生成的,我们通过 `GlobalConfig.entitySupperClass` 可以为代码生成器配置全局的 Entity 父类,更多关于代码生成器可以请访问 [这里](./codegen.md)。 \ No newline at end of file diff --git a/docs/zh/db-row.md b/docs/zh/db-row.md index 0a5627e5..ada74ad3 100644 --- a/docs/zh/db-row.md +++ b/docs/zh/db-row.md @@ -201,4 +201,24 @@ Db.insert("tb_account",row); - `RowUtil.toObjectList(rows, objectClass)` - `RowUtil.toEntity(row, entityClass)` - `RowUtil.toEntityList(rows, entityClass)` -- `RowUtil.registerMapping(clazz, columnSetterMapping)` 用于注册数据库 `字段` 名称和 Class 属性的映射关系。 \ No newline at end of file +- `RowUtil.registerMapping(clazz, columnSetterMapping)` 用于注册数据库 `字段` 名称和 Class 属性的映射关系。 +- `RowUtil.printPretty(rows)` 打印 `Row` 或者 `List` 数据到控制台,一般用户调试。 + + +`RowUtil.printPretty` 输入内容如下: +``` +Total Count: 12 +|ID |USER_NAME |AGE |SEX |BIRTHDAY |IS_DELETE | +|1 |张三 |18 |0 |2020-01-1... |0 | +|2 |王麻子叔叔 |19 |1 |2021-03-2... |0 | +|3 |zhang0 |18 |null |2023-04-2... |null | +|4 |zhang1 |18 |null |2023-04-2... |null | +|5 |zhang2 |18 |null |2023-04-2... |null | +|6 |zhang3 |18 |null |2023-04-2... |null | +|7 |zhang4 |18 |null |2023-04-2... |null | +|8 |zhang5 |18 |null |2023-04-2... |null | +|9 |zhang6 |18 |null |2023-04-2... |null | +|10 |zhang7 |18 |null |2023-04-2... |null | +|11 |zhang8 |18 |null |2023-04-2... |null | +|12 |zhang9 |18 |null |2023-04-2... |null | +```