插件更新

This commit is contained in:
iqudoo
2026-04-12 13:08:20 +08:00
parent e6ccd3bc34
commit a2e1fdd8e3
6 changed files with 399 additions and 264 deletions

View File

@@ -39,6 +39,8 @@
- `getTrashList({Example} example)` - 获取回收站记录列表(支持分页)
- `countByValid({Example} example)` - 统计有效记录数
- `countByTrash({Example} example)` - 统计回收站记录数
- `countByValidWithPage({Example} example)` - 统计有效记录数
- `countByTrashWithPage({Example} example)` - 统计回收站记录数
- `insert({Model} record)` - 插入记录(自动生成 GUID、设置默认值
- `updateByExampleSelective({Model} record, {Example} example)` - 按条件更新记录
- `update({Model} record)` - 更新记录(支持乐观锁)
@@ -60,9 +62,8 @@
**添加的字段**
- `offset` - 偏移量
- `rows` - 每页数量
- `minPageNum` - 最小页码(默认 1
- `startPageNum` - 最小页码(默认 1
- `ignorePageSize` - 忽略分页数量(默认 10000每页数量大于10000时忽略分页
- `defaultPageSize` - 默认每页数量(默认 20
- `maxPageSize` - 最大每页数量(默认 100
- `withBLOBs` - 是否返回BLOBs列的数据
@@ -70,10 +71,12 @@
- `limit(int rows)` - 设置每页数量
- `limit(int offset, int rows)` - 设置偏移量和每页数量
- `usePage(int pageNum, int pageSize)` - 使用页码和每页数量(自动计算 offset
- `getPageNum()` - 获取当前页码
- `getPageSize()` - 获取当前每页数量
- `setWithBLOBs(boolean withBLOBs)` - 设置是否返回BLOBs列的数据
- `isWithBLOBs()` - 是否返回BLOBs列的数据
- `getPageNum()` - 获取当前页码
- `getPageSize()` - 获取当前每页数量
- `getOffset()` - 获取当前分页limit的offset
- `getRows()` - 获取当前分页limit的rows
## 使用方法
### 1. 在 `pom.xml` 中配置插件
@@ -138,9 +141,11 @@
<property name="snowflakeUtilClass" value="com.iqudoo.framework.tape.modules.utils.SnowflakeUtil"/>
<property name="snowflakeUtilGenId" value="SnowflakeUtil.nextId()"/>
<property name="slowQueryLoggerTime" value="300"/>
<property name="slowQueryLoggerLevel" value="error"/>
<property name="priorityPrimaryKeyOffset" value="100"/>
<property name="ignorePageSize" value="10000"/>
<property name="defaultPageSize" value="20"/>
<property name="startPage" value="1"/>
<property name="startPageNum" value="1"/>
<property name="maxPageSize" value="100"/>
<!-- 添加插件 -->
<plugin type="com.iqudoo.framework.mybatis.TapeMybatisGeneratorPlugin"/>
@@ -153,21 +158,23 @@
### 3. 配置参数说明
| 参数名 | 说明 | 默认值 | 必需 |
|--------|---------------------|---------------------------------------------------------|------|
| `viewKeyWords` | 视图表关键字(逗号分隔,不区分大小写) | `VIEW_,V_` | 否 |
| `targetProject` | 生成代码的目标项目路径 | `src/main/java` | 否 |
| `modelPackage` | Model 类的包路径 | `com.iqudoo.platform.application.database.model` | 是 |
| `mapperPackage` | Mapper 接口的包路径 | `com.iqudoo.platform.application.database.mapper` | 是 |
| `facadeRepositoryPackage` | Repository 接口的包路径 | `com.iqudoo.platform.application.facade.repository` | 否 |
| `domainRepositoryPackage` | Repository 实现类的包路径 | `com.iqudoo.platform.application.domain.repository` | 否 |
| `facadeRepoviewPackage` | RepoView 接口的包路径 | `com.iqudoo.platform.application.facade.repoview` | 否 |
| `snowflakeUtilClass` | 雪花算法ID生成工具类 | `com.iqudoo.framework.tape.modules.utils.SnowflakeUtil` | 否 |
| `snowflakeUtilGenId` | 雪花算法ID生成方法 | `SnowflakeUtil.nextId()` | 否 |
| `slowQueryLoggerTime` | 慢查询日志时间阈值 | `200` | 否 |
| `ignorePageSize` | 忽略分页阈值 | `10000` | 否 |
| `defaultPageSize` | 默认分页数量 | `20` | 否 |
| `startPage` | 开始页码 | `1` | 否 |
| 参数名 | 说明 | 默认值 | 必需 |
|----------------------------|-------------------------------|-------------------------------------------------------|------|
| `viewKeyWords` | 视图表关键字(逗号分隔,不区分大小写) | `VIEW_,V_` | 否 |
| `targetProject` | 生成代码的目标项目路径 | `src/main/java` | 否 |
| `modelPackage` | Model 类的包路径 | `com.iqudoo.platform.application.database.model` | 是 |
| `mapperPackage` | Mapper 接口的包路径 | `com.iqudoo.platform.application.database.mapper` | 是 |
| `facadeRepositoryPackage` | Repository 接口的包路径 | `com.iqudoo.platform.application.facade.repository` | 否 |
| `domainRepositoryPackage` | Repository 实现类的包路径 | `com.iqudoo.platform.application.domain.repository` | 否 |
| `facadeRepoviewPackage` | RepoView 接口的包路径 | `com.iqudoo.platform.application.facade.repoview` | 否 |
| `snowflakeUtilClass` | 雪花算法ID生成工具类 | `com.iqudoo.framework.tape.modules.utils.SnowflakeUtil` | 否 |
| `snowflakeUtilGenId` | 雪花算法ID生成方法 | `SnowflakeUtil.nextId()` | 否 |
| `slowQueryLoggerTime` | 慢查询日志时间阈值 | `300` | 否 |
| `slowQueryLoggerLevel` | 慢查询日志类型errorwarndebuginfo | `error` | 否 |
| `priorityPrimaryKeyOffset` | 优先查询主键偏移阈值 | `0` | 否 |
| `ignorePageSize` | 忽略分页阈值 | `10000` | 否 |
| `startPageNum` | 分页开始页码 | `1` | 否 |
| `maxPageSize` | 最大每页数量 | `100` | 否 |
**视图表识别规则**
- 表名包含 `viewKeyWords` 中任一关键字的表将被识别为视图表,大小写不敏感
@@ -180,7 +187,7 @@
为了使用完整的 Repository 功能(软删除、回收站等),表结构需要包含以下标准字段:
```sql
```mysql
DROP TABLE IF EXISTS `your_table_name`;
CREATE TABLE `your_table_name` (
`guid` bigint(0) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'GUID',
@@ -193,7 +200,15 @@ CREATE TABLE `your_table_name` (
`data_version` int(0) NOT NULL DEFAULT 0 COMMENT '数据版本',
`create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',
`update_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '更新时间',
PRIMARY KEY (`guid`) USING BTREE
PRIMARY KEY (`guid`) USING BTREE,
-- UNIQUE KEY `idx_unique_key` (`you unique key`,`delete_token`) USING BTREE,
-- KEY `idx_common_query` (
-- 等值查询字段,
-- `is_hidden`,`is_delete`,
-- 其他参与排序字段,
-- `create_time` desc,
-- `guid`) USING BTREE
KEY `idx_common_query` (`is_hidden`,`is_delete`,`create_time` desc,`guid`) USING BTREE
) ENGINE = InnoDB COMMENT = '你的表格备注' ROW_FORMAT = Dynamic;
```