Skip to content

Commit 3464bc2

Browse files
author
hewei
committed
V1.0.18
1 parent 1589709 commit 3464bc2

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

README.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Maven引用:
2727
<dependency>
2828
<groupId>com.itfsw</groupId>
2929
<artifactId>mybatis-generator-plugin</artifactId>
30-
<version>1.0.17</version>
30+
<version>1.0.18</version>
3131
</dependency>
3232
```
3333
---------------------------------------
@@ -348,8 +348,10 @@ public class Test {
348348
```
349349
### 7. 逻辑删除插件
350350
因为很多实际项目数据都不允许物理删除,多采用逻辑删除,所以单独为逻辑删除做了一个插件,方便使用。
351-
- 增加logicalDeleteByExample和logicalDeleteByPrimaryKey方法;
352-
- 查询构造工具中增加逻辑删除条件andDeleted(boolean);
351+
- 增加logicalDeleteByExample和logicalDeleteByPrimaryKey方法;
352+
- 增加selectByPrimaryKeyWithLogicalDelete方法([[pull#12]](https://github.com/itfsw/mybatis-generator-plugin/pull/12));
353+
- 查询构造工具中增加逻辑删除条件andLogicalDeleted(boolean);
354+
- 数据Model增加逻辑删除条件andLogicalDeleted(boolean);
353355
- 增加逻辑删除常量IS_DELETED(已删除 默认值)、NOT_DELETED(未删除 默认值)([[issues#11]](https://github.com/itfsw/mybatis-generator-plugin/issues/11));
354356

355357
插件:
@@ -399,7 +401,7 @@ public class Test {
399401
.createCriteria()
400402
.andField1EqualTo(1)
401403
// 新增了一个andDeleted方法过滤逻辑删除数据
402-
.andDeleted(true)
404+
.andLogicalDeleted(true)
403405
// 当然也可直接使用逻辑删除列的查询方法,我们数据Model中定义了一个逻辑删除常量DEL_FLAG
404406
.andDelFlagEqualTo(Tb.IS_DELETED)
405407
.example()
@@ -409,7 +411,12 @@ public class Test {
409411
Tb tb = new Tb.Builder()
410412
.delFlag(Tb.IS_DELETED) // 删除
411413
.delFlag(Tb.NOT_DELETED) // 未删除
412-
.build();
414+
.build()
415+
.andLogicalDeleted(true); // 也可以在这里使用true|false设置逻辑删除
416+
417+
// 5. selectByPrimaryKeyWithLogicalDelete V1.0.18 版本增加
418+
// 因为之前觉得既然拿到了主键这种查询没有必要,但是实际使用中可能存在根据主键判断是否逻辑删除的情况,这种场景还是有用的
419+
this.tbMapper.selectByPrimaryKeyWithLogicalDelete(1, true);
413420
}
414421
}
415422
```
@@ -689,7 +696,7 @@ Mybatis Generator是原生支持自定义注释的(commentGenerator配置type
689696
690697
>warning: 请注意拷贝参考模板注释前方空格,idea等工具拷贝进去后自动格式化会造成格式错乱。
691698
692-
>warning: 模板引擎采用的是freemarker所以一些freemarker指令参数(如:<#if xx></#if>、${.now?string("yyyy-MM-dd HH:mm:ss")})都是可以使用的,请自己尝试。
699+
>warning: 模板引擎采用的是freemarker所以一些freemarker指令参数(如:<#if xx></#if>、${.now?string("yyyy-MM-dd HH:mm:ss")})都是可以使用的,请自己尝试。
693700
694701
| 注释ID | 传入参数 | 备注 |
695702
| ----- | ----- | ---- |

0 commit comments

Comments
 (0)