mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 09:08:24 +08:00
update docs
This commit is contained in:
parent
6c740d0e36
commit
d4941cd3fb
@ -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'}
|
||||
]
|
||||
|
||||
@ -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 生成
|
||||
|
||||
|
||||
@ -270,3 +270,10 @@ mybatis-flex 内置的扩展 typeHandler 还有:
|
||||
- JacksonTypeHandler
|
||||
|
||||
当然,我们也可以写一个自己的类,实现 `TypeHandler` 接口,然后通过 `@Column(typeHandler = YourHandler.class)` 注释给需要的字段。
|
||||
|
||||
## 全局配置
|
||||
|
||||
在某些场景下,我们的 entity 可能会有通用的字段以及配置,这种场景如果我们要为每个 entity 去设置,这会相对麻烦。
|
||||
在这种场景下,我们可以建立一个通用的 BaseEntity 类,然后让所有的 Entity 都继承是该类。
|
||||
|
||||
Entity 一般是通过代码生成器生成的,我们通过 `GlobalConfig.entitySupperClass` 可以为代码生成器配置全局的 Entity 父类,更多关于代码生成器可以请访问 [这里](./codegen.md)。
|
||||
@ -202,3 +202,23 @@ Db.insert("tb_account",row);
|
||||
- `RowUtil.toEntity(row, entityClass)`
|
||||
- `RowUtil.toEntityList(rows, entityClass)`
|
||||
- `RowUtil.registerMapping(clazz, columnSetterMapping)` 用于注册数据库 `字段` 名称和 Class 属性的映射关系。
|
||||
- `RowUtil.printPretty(rows)` 打印 `Row` 或者 `List<Row>` 数据到控制台,一般用户调试。
|
||||
|
||||
|
||||
`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 |
|
||||
```
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user