This commit is contained in:
iqudoo
2026-05-23 19:34:44 +08:00
parent 88fa1c88dd
commit c27a2433be
4 changed files with 37 additions and 38 deletions

View File

@@ -7,8 +7,8 @@
本插件为 MyBatis Generator 提供了以下增强功能:
1. **TapeMybatisGeneratorPlugin** - 扩展 MyBatis Mapper添加 `selectPrimaryKeyByExample`, `batchInsert` 方法,拓展查询分页支持
2. **TapeRepositoryGeneratorPlugin** - 为非视图表自动生成 Repository 接口和实现类,提供完整的 CRUD 和软删除功能
3. **TapeRepoviewGeneratorPlugin** - 为视图表自动生成 RepoView 接口和实现类,提供查询功能
2. **TapeTableRepositoryGeneratorPlugin** - 为非视图表自动生成 Repository 接口和实现类,提供完整的 CRUD 和软删除功能
3. **TapeViewRepositoryGeneratorPlugin** - 为视图表自动生成 ViewRepository 接口和实现类,提供查询功能
## 插件说明
@@ -19,13 +19,12 @@
- 在 Mapper 接口中添加 `selectPrimaryKeyByExample` 方法
- 在 Mapper XML 中生成对应的 SQL 查询语句
### TapeRepositoryGeneratorPlugin
### TapeTableRepositoryGeneratorPlugin
为非视图表生成 Repository 层代码:
- **接口位置**: `{facadeRepositoryPackage}.I{TableName}Repository`
- **实现类位置**: `{domainRepositoryPackage}.{TableName}RepositoryImpl`
- **视图表过滤**: 根据 `viewKeyWords` 配置自动识别并跳过视图表
**生成的方法**
@@ -45,7 +44,7 @@
- `updateByExampleSelective({Model} record, {Example} example)` - 按条件更新记录
- `update({Model} record)` - 更新记录(支持乐观锁)
### TapeRepoviewGeneratorPlugin
### TapeViewRepositoryGeneratorPlugin
为视图表生成 RepoView 层代码:
@@ -169,8 +168,8 @@
<!-- 添加插件 -->
<plugin type="com.iqudoo.framework.mybatis.TapeMybatisGeneratorPlugin"/>
<plugin type="com.iqudoo.framework.mybatis.TapeRepositoryGeneratorPlugin"/>
<plugin type="com.iqudoo.framework.mybatis.TapeRepoviewGeneratorPlugin"/>
<plugin type="com.iqudoo.framework.mybatis.TapeTableRepositoryGeneratorPlugin"/>
<plugin type="com.iqudoo.framework.mybatis.TapeViewRepositoryGeneratorPlugin"/>
<!-- 搭配使用 -->
<plugin type="org.mybatis.generator.plugins.SerializablePlugin"/>

View File

@@ -15,7 +15,7 @@ import java.util.ArrayList;
import java.util.List;
@SuppressWarnings({"DuplicatedCode", "unused", "SpellCheckingInspection", "ExtractMethodRecommender"})
public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
public class TapeTableRepositoryGeneratorPlugin extends PluginAdapter {
// 固定配置项
private String slowQueryLoggerTime = "300";

View File

@@ -18,7 +18,7 @@ import java.util.ArrayList;
import java.util.List;
@SuppressWarnings({"DuplicatedCode", "SpellCheckingInspection", "ExtractMethodRecommender"})
public class TapeRepoviewGeneratorPlugin extends PluginAdapter {
public class TapeViewRepositoryGeneratorPlugin extends PluginAdapter {
// 视图Repo包配置可通过配置文件自定义
private String slowQueryLoggerTime = "300";