fix
This commit is contained in:
69
README.md
69
README.md
@@ -7,8 +7,8 @@
|
|||||||
本插件为 MyBatis Generator 提供了以下增强功能:
|
本插件为 MyBatis Generator 提供了以下增强功能:
|
||||||
|
|
||||||
1. **TapeMybatisGeneratorPlugin** - 扩展 MyBatis Mapper,添加 `selectPrimaryKeyByExample`, `batchInsert` 方法,拓展查询分页支持
|
1. **TapeMybatisGeneratorPlugin** - 扩展 MyBatis Mapper,添加 `selectPrimaryKeyByExample`, `batchInsert` 方法,拓展查询分页支持
|
||||||
2. **TapeRepositoryGeneratorPlugin** - 为非视图表自动生成 Repository 接口和实现类,提供完整的 CRUD 和软删除功能
|
2. **TapeTableRepositoryGeneratorPlugin** - 为非视图表自动生成 Repository 接口和实现类,提供完整的 CRUD 和软删除功能
|
||||||
3. **TapeRepoviewGeneratorPlugin** - 为视图表自动生成 RepoView 接口和实现类,提供查询功能
|
3. **TapeViewRepositoryGeneratorPlugin** - 为视图表自动生成 ViewRepository 接口和实现类,提供查询功能
|
||||||
|
|
||||||
## 插件说明
|
## 插件说明
|
||||||
|
|
||||||
@@ -19,13 +19,12 @@
|
|||||||
- 在 Mapper 接口中添加 `selectPrimaryKeyByExample` 方法
|
- 在 Mapper 接口中添加 `selectPrimaryKeyByExample` 方法
|
||||||
- 在 Mapper XML 中生成对应的 SQL 查询语句
|
- 在 Mapper XML 中生成对应的 SQL 查询语句
|
||||||
|
|
||||||
### TapeRepositoryGeneratorPlugin
|
### TapeTableRepositoryGeneratorPlugin
|
||||||
|
|
||||||
为非视图表生成 Repository 层代码:
|
为非视图表生成 Repository 层代码:
|
||||||
|
|
||||||
- **接口位置**: `{facadeRepositoryPackage}.I{TableName}Repository`
|
- **接口位置**: `{facadeRepositoryPackage}.I{TableName}Repository`
|
||||||
- **实现类位置**: `{domainRepositoryPackage}.{TableName}RepositoryImpl`
|
- **实现类位置**: `{domainRepositoryPackage}.{TableName}RepositoryImpl`
|
||||||
- **视图表过滤**: 根据 `viewKeyWords` 配置自动识别并跳过视图表
|
|
||||||
|
|
||||||
**生成的方法**:
|
**生成的方法**:
|
||||||
|
|
||||||
@@ -45,7 +44,7 @@
|
|||||||
- `updateByExampleSelective({Model} record, {Example} example)` - 按条件更新记录
|
- `updateByExampleSelective({Model} record, {Example} example)` - 按条件更新记录
|
||||||
- `update({Model} record)` - 更新记录(支持乐观锁)
|
- `update({Model} record)` - 更新记录(支持乐观锁)
|
||||||
|
|
||||||
### TapeRepoviewGeneratorPlugin
|
### TapeViewRepositoryGeneratorPlugin
|
||||||
|
|
||||||
为视图表生成 RepoView 层代码:
|
为视图表生成 RepoView 层代码:
|
||||||
|
|
||||||
@@ -145,39 +144,39 @@
|
|||||||
```xml
|
```xml
|
||||||
|
|
||||||
<context id="Mysql" targetRuntime="MyBatis3">
|
<context id="Mysql" targetRuntime="MyBatis3">
|
||||||
<!-- 配置属性 -->
|
<!-- 配置属性 -->
|
||||||
<property name="targetProject" value="src/main/java"/>
|
<property name="targetProject" value="src/main/java"/>
|
||||||
<property name="mapperPackage" value="com.iqudoo.platform.application.database.mapper"/>
|
<property name="mapperPackage" value="com.iqudoo.platform.application.database.mapper"/>
|
||||||
<property name="modelPackage" value="com.iqudoo.platform.application.database.model"/>
|
<property name="modelPackage" value="com.iqudoo.platform.application.database.model"/>
|
||||||
<property name="facadeRepositoryPackage" value="com.iqudoo.platform.application.facade.repository"/>
|
<property name="facadeRepositoryPackage" value="com.iqudoo.platform.application.facade.repository"/>
|
||||||
<property name="domainRepositoryPackage" value="com.iqudoo.platform.application.domain.repository"/>
|
<property name="domainRepositoryPackage" value="com.iqudoo.platform.application.domain.repository"/>
|
||||||
<property name="domainRepositoryType" value="Repository"/>
|
<property name="domainRepositoryType" value="Repository"/>
|
||||||
<property name="facadeViewRepositoryPackage" value="com.iqudoo.platform.application.facade.repoview"/>
|
<property name="facadeViewRepositoryPackage" value="com.iqudoo.platform.application.facade.repoview"/>
|
||||||
<property name="domainViewRepositoryPackage" value="com.iqudoo.platform.application.domain.repoview"/>
|
<property name="domainViewRepositoryPackage" value="com.iqudoo.platform.application.domain.repoview"/>
|
||||||
<property name="domainViewRepositoryType" value="Repository"/>
|
<property name="domainViewRepositoryType" value="Repository"/>
|
||||||
<property name="guidGeneratorClass" value="com.iqudoo.framework.tape.modules.utils.SnowflakeUtil"/>
|
<property name="guidGeneratorClass" value="com.iqudoo.framework.tape.modules.utils.SnowflakeUtil"/>
|
||||||
<property name="guidGeneratorCode" value="SnowflakeUtil.nextId()"/>
|
<property name="guidGeneratorCode" value="SnowflakeUtil.nextId()"/>
|
||||||
<property name="changeLogContextClassPackage" value="com.iqudoo.platform.application.domain.changeLog"/>
|
<property name="changeLogContextClassPackage" value="com.iqudoo.platform.application.domain.changeLog"/>
|
||||||
<property name="changeLogContextClassName" value="ChangeLogContext"/>
|
<property name="changeLogContextClassName" value="ChangeLogContext"/>
|
||||||
<property name="changeLogEnable" value="false"/>
|
<property name="changeLogEnable" value="false"/>
|
||||||
<property name="slowQueryLoggerTime" value="300"/>
|
<property name="slowQueryLoggerTime" value="300"/>
|
||||||
<property name="slowQueryLoggerLevel" value="error"/>
|
<property name="slowQueryLoggerLevel" value="error"/>
|
||||||
<property name="optimisticLockEnable" value="true"/>
|
<property name="optimisticLockEnable" value="true"/>
|
||||||
<property name="ignorePageSize" value="10000"/>
|
<property name="ignorePageSize" value="10000"/>
|
||||||
<property name="startPageNum" value="1"/>
|
<property name="startPageNum" value="1"/>
|
||||||
<property name="maxPageSize" value="100"/>
|
<property name="maxPageSize" value="100"/>
|
||||||
|
|
||||||
<!-- 添加插件 -->
|
<!-- 添加插件 -->
|
||||||
<plugin type="com.iqudoo.framework.mybatis.TapeMybatisGeneratorPlugin"/>
|
<plugin type="com.iqudoo.framework.mybatis.TapeMybatisGeneratorPlugin"/>
|
||||||
<plugin type="com.iqudoo.framework.mybatis.TapeRepositoryGeneratorPlugin"/>
|
<plugin type="com.iqudoo.framework.mybatis.TapeTableRepositoryGeneratorPlugin"/>
|
||||||
<plugin type="com.iqudoo.framework.mybatis.TapeRepoviewGeneratorPlugin"/>
|
<plugin type="com.iqudoo.framework.mybatis.TapeViewRepositoryGeneratorPlugin"/>
|
||||||
|
|
||||||
<!-- 搭配使用 -->
|
<!-- 搭配使用 -->
|
||||||
<plugin type="org.mybatis.generator.plugins.SerializablePlugin"/>
|
<plugin type="org.mybatis.generator.plugins.SerializablePlugin"/>
|
||||||
<plugin type="org.mybatis.generator.plugins.ToStringPlugin"/>
|
<plugin type="org.mybatis.generator.plugins.ToStringPlugin"/>
|
||||||
<plugin type="org.mybatis.generator.plugins.UnmergeableXmlMappersPlugin"/>
|
<plugin type="org.mybatis.generator.plugins.UnmergeableXmlMappersPlugin"/>
|
||||||
|
|
||||||
<!-- 其他配置... -->
|
<!-- 其他配置... -->
|
||||||
</context>
|
</context>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -15,7 +15,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@SuppressWarnings({"DuplicatedCode", "unused", "SpellCheckingInspection", "ExtractMethodRecommender"})
|
@SuppressWarnings({"DuplicatedCode", "unused", "SpellCheckingInspection", "ExtractMethodRecommender"})
|
||||||
public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
public class TapeTableRepositoryGeneratorPlugin extends PluginAdapter {
|
||||||
|
|
||||||
// 固定配置项
|
// 固定配置项
|
||||||
private String slowQueryLoggerTime = "300";
|
private String slowQueryLoggerTime = "300";
|
||||||
@@ -18,7 +18,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@SuppressWarnings({"DuplicatedCode", "SpellCheckingInspection", "ExtractMethodRecommender"})
|
@SuppressWarnings({"DuplicatedCode", "SpellCheckingInspection", "ExtractMethodRecommender"})
|
||||||
public class TapeRepoviewGeneratorPlugin extends PluginAdapter {
|
public class TapeViewRepositoryGeneratorPlugin extends PluginAdapter {
|
||||||
|
|
||||||
// 视图Repo包配置(可通过配置文件自定义)
|
// 视图Repo包配置(可通过配置文件自定义)
|
||||||
private String slowQueryLoggerTime = "300";
|
private String slowQueryLoggerTime = "300";
|
||||||
@@ -111,7 +111,7 @@ public class TapeRepoviewGeneratorPlugin extends PluginAdapter {
|
|||||||
String exampleClassName = domainObjectName + "Example";
|
String exampleClassName = domainObjectName + "Example";
|
||||||
String mapperClassName = domainObjectName + "Mapper";
|
String mapperClassName = domainObjectName + "Mapper";
|
||||||
String repoInterfaceName = "I" + domainObjectName + domainViewRepositoryType;
|
String repoInterfaceName = "I" + domainObjectName + domainViewRepositoryType;
|
||||||
String repoImplName = domainObjectName +domainViewRepositoryType+ "Impl";
|
String repoImplName = domainObjectName + domainViewRepositoryType + "Impl";
|
||||||
|
|
||||||
boolean hasBLOBColumns = ElementTools.hasBLOBColumns(introspectedTable);
|
boolean hasBLOBColumns = ElementTools.hasBLOBColumns(introspectedTable);
|
||||||
|
|
||||||
Reference in New Issue
Block a user