Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mybatis-generator-plugin
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
mybatis-generator-plugin
Commits
3464bc28
Commit
3464bc28
authored
Aug 31, 2017
by
hewei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
V1.0.18
parent
1589709d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
README.md
README.md
+13
-6
No files found.
README.md
View file @
3464bc28
...
...
@@ -27,7 +27,7 @@ Maven引用:
<dependency>
<groupId>
com.itfsw
</groupId>
<artifactId>
mybatis-generator-plugin
</artifactId>
<version>
1.0.1
7
</version>
<version>
1.0.1
8
</version>
</dependency>
```
---------------------------------------
...
...
@@ -348,8 +348,10 @@ public class Test {
```
### 7. 逻辑删除插件
因为很多实际项目数据都不允许物理删除,多采用逻辑删除,所以单独为逻辑删除做了一个插件,方便使用。
-
增加logicalDeleteByExample和logicalDeleteByPrimaryKey方法;
-
查询构造工具中增加逻辑删除条件andDeleted(boolean);
-
增加logicalDeleteByExample和logicalDeleteByPrimaryKey方法;
-
增加selectByPrimaryKeyWithLogicalDelete方法(
[
[pull#12
]
](https://github.com/itfsw/mybatis-generator-plugin/pull/12));
-
查询构造工具中增加逻辑删除条件andLogicalDeleted(boolean);
-
数据Model增加逻辑删除条件andLogicalDeleted(boolean);
-
增加逻辑删除常量IS_DELETED(已删除 默认值)、NOT_DELETED(未删除 默认值)(
[
[issues#11
]
](https://github.com/itfsw/mybatis-generator-plugin/issues/11));
插件:
...
...
@@ -399,7 +401,7 @@ public class Test {
.
createCriteria
()
.
andField1EqualTo
(
1
)
// 新增了一个andDeleted方法过滤逻辑删除数据
.
andDeleted
(
true
)
.
and
Logical
Deleted
(
true
)
// 当然也可直接使用逻辑删除列的查询方法,我们数据Model中定义了一个逻辑删除常量DEL_FLAG
.
andDelFlagEqualTo
(
Tb
.
IS_DELETED
)
.
example
()
...
...
@@ -409,7 +411,12 @@ public class Test {
Tb
tb
=
new
Tb
.
Builder
()
.
delFlag
(
Tb
.
IS_DELETED
)
// 删除
.
delFlag
(
Tb
.
NOT_DELETED
)
// 未删除
.
build
();
.
build
()
.
andLogicalDeleted
(
true
);
// 也可以在这里使用true|false设置逻辑删除
// 5. selectByPrimaryKeyWithLogicalDelete V1.0.18 版本增加
// 因为之前觉得既然拿到了主键这种查询没有必要,但是实际使用中可能存在根据主键判断是否逻辑删除的情况,这种场景还是有用的
this
.
tbMapper
.
selectByPrimaryKeyWithLogicalDelete
(
1
,
true
);
}
}
```
...
...
@@ -689,7 +696,7 @@ Mybatis Generator是原生支持自定义注释的(commentGenerator配置type
>warning: 请注意拷贝参考模板注释前方空格,idea等工具拷贝进去后自动格式化会造成格式错乱。
>warning: 模板引擎采用的是freemarker所以一些freemarker指令参数(如:<#if xx></#if>、${.now?string("yyyy-MM-dd HH:mm:ss")})都是可以使用的,请自己尝试。
>warning: 模板引擎采用的是freemarker所以一些freemarker指令参数(如:<#if xx></#if>、${.now?string("yyyy-MM-dd HH:mm:ss")})都是可以使用的,请自己尝试。
| 注释ID | 传入参数 | 备注 |
| ----- | ----- | ---- |
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment