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
51b8abee
Commit
51b8abee
authored
Jan 16, 2017
by
hewei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
版本说明
parent
5662c7f9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
23 deletions
+24
-23
README.md
README.md
+24
-23
No files found.
README.md
View file @
51b8abee
...
@@ -174,12 +174,13 @@ public class Test {
...
@@ -174,12 +174,13 @@ public class Test {
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
// -----------------------------------example-----------------------------------
// -----------------------------------example-----------------------------------
// 表Example.Criteria增加了工厂方法example()支持,使用后可链式构建查询条件使用example()返回Example对象
// 表Example.Criteria增加了工厂方法example()支持,使用后可链式构建查询条件使用example()返回Example对象
TbExample
ex
=
new
TbExample
()
this
.
tbMapper
.
selectByExample
(
.
createCriteria
()
new
TbExample
()
.
andField1EqualTo
(
1
)
.
createCriteria
()
.
andField2EqualTo
(
"xxx"
)
.
andField1EqualTo
(
1
)
.
example
();
.
andField2EqualTo
(
"xxx"
)
this
.
tbMapper
.
selectByExample
(
ex
);
.
example
()
);
// -----------------------------------andIf-----------------------------------
// -----------------------------------andIf-----------------------------------
// Criteria增强了链式调用,现在一些按条件增加的查询条件不会打乱链式调用了
// Criteria增强了链式调用,现在一些按条件增加的查询条件不会打乱链式调用了
...
@@ -199,23 +200,23 @@ public class Test {
...
@@ -199,23 +200,23 @@ public class Test {
// new
// new
this
.
tbMapper
.
selectByExample
(
this
.
tbMapper
.
selectByExample
(
new
TbExample
()
new
TbExample
()
.
createCriteria
()
.
createCriteria
()
.
andField1EqualTo
(
1
)
.
andField1EqualTo
(
1
)
.
andField2EqualTo
(
"xxx"
)
.
andField2EqualTo
(
"xxx"
)
// 如果随机数大于0.5,附加Field3查询条件
// 如果随机数大于0.5,附加Field3查询条件
.
andIf
(
Math
.
random
()
>
0.5
,
new
TbExample
.
Criteria
.
ICriteriaAdd
()
{
.
andIf
(
Math
.
random
()
>
0.5
,
new
TbExample
.
Criteria
.
ICriteriaAdd
()
{
@Override
@Override
public
TbExample
.
Criteria
add
(
TbExample
.
Criteria
add
)
{
public
TbExample
.
Criteria
add
(
TbExample
.
Criteria
add
)
{
return
add
.
andField3EqualTo
(
2
)
return
add
.
andField3EqualTo
(
2
)
.
andField4EqualTo
(
new
Date
());
.
andField4EqualTo
(
new
Date
());
}
}
})
})
// 当然最简洁的写法是采用java8的Lambda表达式,当然你的项目是Java8+
// 当然最简洁的写法是采用java8的Lambda表达式,当然你的项目是Java8+
.
andIf
(
Math
.
random
()
>
0.5
,
add
->
add
.
andIf
(
Math
.
random
()
>
0.5
,
add
->
add
.
andField3EqualTo
(
2
)
.
andField3EqualTo
(
2
)
.
andField4EqualTo
(
new
Date
())
.
andField4EqualTo
(
new
Date
())
)
)
.
example
()
.
example
()
);
);
// -----------------------------------orderBy-----------------------------------
// -----------------------------------orderBy-----------------------------------
...
...
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