update docs

This commit is contained in:
开源海哥 2023-04-17 17:06:31 +08:00
parent da1add5bbf
commit 90b04302b1
2 changed files with 24 additions and 5 deletions

View File

@ -53,12 +53,26 @@ processor.tablesClassName = your-class-name
processor.mappersPackage = com.your-package
```
## 自定义 Mapper 的父类
默认情况下,生成的所有 Mapper 是都继承 `com.mybatisflex.core.BaseMapper` 接口,但是在某些场景下(比如:新增更多的通用方法等),用户可以自定义自己的
`BaseMapper`,然后通过 APT 配置生成。
```properties
processor.baseMapperClass=com.domain.mapper.MyBaseMapper
```
## APT 关闭 Mapper 生成
在某些情况下,我们可能需要手写 Mapper不需要 APT 生成,可以通过如下配置关闭 APT 的生成功能。
```properties
processor.mappersGenerateEnable = false
```
以上的配置,会关闭整个项目的 APT 生成,若我们只想关闭某一个 Entity 的 APT 生成,那么可以通过配置注解 `@Table(mapperGenerateEnable = false)` 进行关闭。
## 开发工具无法导入生成的代码?
如下图所示,点击项目目录(注意是项目的根目录),右键 > Maven

View File

@ -19,16 +19,16 @@ public @interface Table {
*/
String schema() default "";
/**
* 默认使用哪个数据源,若系统找不到该指定的数据源时,默认使用第一个数据源
*/
String dataSource() default "";
/**
* 默认为 驼峰属性 转换为 下划线字段
*/
boolean camelToUnderline() default true;
/**
* 默认使用哪个数据源,若系统找不到该指定的数据源时,默认使用第一个数据源
*/
String dataSource() default "";
/**
* 监听 entity 的 insert 行为
*/
@ -43,6 +43,11 @@ public @interface Table {
* 监听 entity 的查询数据的 set 行为,用户主动 set 不会触发
*/
Class<? extends SetListener> onSet() default NoneListener.class;
/**
* 在某些场景下,我们需要手动编写 Mapper可以通过这个注解来关闭 APT 的 Mapper 生成
*/
boolean mapperGenerateEnable() default true;
}
```