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
f62d78d1
Commit
f62d78d1
authored
Jun 21, 2017
by
hewei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix: Selective增强插件在对于 #{xxx,jdbcType=INTEGER},这种节点处理时之前采用正则取column名称是错误的,这里取得的其实是model的属性名称
parent
24368c58
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
src/main/java/com/itfsw/mybatis/generator/plugins/SelectiveEnhancedPlugin.java
...sw/mybatis/generator/plugins/SelectiveEnhancedPlugin.java
+9
-6
No files found.
src/main/java/com/itfsw/mybatis/generator/plugins/SelectiveEnhancedPlugin.java
View file @
f62d78d1
...
...
@@ -219,15 +219,20 @@ public class SelectiveEnhancedPlugin extends BasePlugin {
// 找出field 名称
String
text
=
((
TextElement
)
xmlElement
.
getElements
().
get
(
0
)).
getContent
();
String
field
=
""
;
String
columnName
=
""
;
if
(
text
.
matches
(
"#\\{.*\\},?"
))
{
Pattern
pattern
=
Pattern
.
compile
(
"#\\{(.*?),.*\\},?"
);
Matcher
matcher
=
pattern
.
matcher
(
text
);
if
(
matcher
.
find
()){
field
=
matcher
.
group
(
1
);
String
field
=
matcher
.
group
(
1
);
// 查找对应column
for
(
IntrospectedColumn
column
:
introspectedTable
.
getAllColumns
())
{
if
(
column
.
getJavaProperty
().
equals
(
field
))
{
columnName
=
column
.
getActualColumnName
();
}
}
}
}
else
{
String
columnName
;
if
(
text
.
matches
(
".*=.*"
)){
columnName
=
text
.
split
(
"="
)[
0
];
}
else
{
...
...
@@ -235,13 +240,11 @@ public class SelectiveEnhancedPlugin extends BasePlugin {
}
// bug fixed: 修正使用autoDelimitKeywords过滤关键词造成的field前后加了特殊字符的问题
columnName
=
columnName
.
trim
().
replaceAll
(
"`"
,
""
).
replaceAll
(
"\""
,
""
).
replaceAll
(
"'"
,
""
);
IntrospectedColumn
column
=
introspectedTable
.
getColumn
(
columnName
);
field
=
MyBatis3FormattingUtilities
.
getEscapedColumnName
(
column
);
}
XmlElement
ifEle
=
new
XmlElement
(
"if"
);
ifEle
.
addAttribute
(
new
Attribute
(
"test"
,
prefix
+
"isSelective(\'"
+
field
+
"\')"
));
ifEle
.
addAttribute
(
new
Attribute
(
"test"
,
prefix
+
"isSelective(\'"
+
MyBatis3FormattingUtilities
.
getEscapedColumnName
(
introspectedTable
.
getColumn
(
columnName
))
+
"\')"
));
for
(
Element
ifChild
:
xmlElement
.
getElements
()){
ifEle
.
addElement
(
ifChild
);
}
...
...
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