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
79b36e8a
Commit
79b36e8a
authored
Jun 21, 2017
by
hewei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
upsert和增量插件整合
parent
fbecf4ce
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
340 additions
and
195 deletions
+340
-195
src/main/java/com/itfsw/mybatis/generator/plugins/IncrementsPlugin.java
...com/itfsw/mybatis/generator/plugins/IncrementsPlugin.java
+11
-85
src/main/java/com/itfsw/mybatis/generator/plugins/ModelBuilderPlugin.java
...m/itfsw/mybatis/generator/plugins/ModelBuilderPlugin.java
+69
-78
src/main/java/com/itfsw/mybatis/generator/plugins/SelectiveEnhancedPlugin.java
...sw/mybatis/generator/plugins/SelectiveEnhancedPlugin.java
+1
-0
src/main/java/com/itfsw/mybatis/generator/plugins/UpsertPlugin.java
...ava/com/itfsw/mybatis/generator/plugins/UpsertPlugin.java
+72
-16
src/main/java/com/itfsw/mybatis/generator/plugins/utils/IncrementsPluginTools.java
...ybatis/generator/plugins/utils/IncrementsPluginTools.java
+171
-0
src/main/java/com/itfsw/mybatis/generator/plugins/utils/XmlElementGeneratorTools.java
...tis/generator/plugins/utils/XmlElementGeneratorTools.java
+16
-16
No files found.
src/main/java/com/itfsw/mybatis/generator/plugins/IncrementsPlugin.java
View file @
79b36e8a
...
...
@@ -17,17 +17,15 @@
package
com
.
itfsw
.
mybatis
.
generator
.
plugins
;
import
com.itfsw.mybatis.generator.plugins.utils.BasePlugin
;
import
com.itfsw.mybatis.generator.plugins.utils.IncrementsPluginTools
;
import
com.itfsw.mybatis.generator.plugins.utils.PluginTools
;
import
com.itfsw.mybatis.generator.plugins.utils.XmlElementGeneratorTools
;
import
org.mybatis.generator.api.IntrospectedColumn
;
import
org.mybatis.generator.api.IntrospectedTable
;
import
org.mybatis.generator.api.dom.java.TopLevelClass
;
import
org.mybatis.generator.api.dom.xml.Attribute
;
import
org.mybatis.generator.api.dom.xml.Element
;
import
org.mybatis.generator.api.dom.xml.TextElement
;
import
org.mybatis.generator.api.dom.xml.XmlElement
;
import
org.mybatis.generator.codegen.mybatis3.MyBatis3FormattingUtilities
;
import
org.mybatis.generator.internal.util.StringUtility
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -42,7 +40,7 @@ import java.util.List;
*/
public
class
IncrementsPlugin
extends
BasePlugin
{
public
static
final
String
PRE_INCREMENTS_COLUMNS
=
"incrementsColumns"
;
// incrementsColumns property
private
List
<
IntrospectedColumn
>
columns
;
// 需要进行自增的字段
private
IncrementsPluginTools
incTools
;
// 增量插件工具
/**
* 具体执行顺序 http://www.mybatis.org/generator/reference/pluggingIn.html
...
...
@@ -67,22 +65,7 @@ public class IncrementsPlugin extends BasePlugin {
*/
@Override
public
void
initialized
(
IntrospectedTable
introspectedTable
)
{
this
.
columns
=
new
ArrayList
<>();
// 获取表配置信息
String
incrementsColumns
=
introspectedTable
.
getTableConfigurationProperty
(
IncrementsPlugin
.
PRE_INCREMENTS_COLUMNS
);
if
(
StringUtility
.
stringHasValue
(
incrementsColumns
))
{
// 切分
String
[]
incrementsColumnsStrs
=
incrementsColumns
.
split
(
","
);
List
<
IntrospectedColumn
>
columns
=
introspectedTable
.
getAllColumns
();
for
(
String
incrementsColumnsStr
:
incrementsColumnsStrs
)
{
IntrospectedColumn
column
=
introspectedTable
.
getColumn
(
incrementsColumnsStr
);
if
(
column
==
null
)
{
logger
.
warn
(
"itfsw:插件"
+
this
.
getClass
().
getTypeName
()
+
"插件没有找到column为"
+
incrementsColumnsStr
+
"的字段!"
);
}
else
if
(
columns
.
indexOf
(
column
)
!=
-
1
)
{
this
.
columns
.
add
(
column
);
}
}
}
this
.
incTools
=
IncrementsPluginTools
.
getTools
(
context
,
introspectedTable
);
}
/**
...
...
@@ -181,26 +164,13 @@ public class IncrementsPlugin extends BasePlugin {
return
true
;
}
/**
* 是否需要替换
* @param columnName
* @return
*/
private
boolean
needReplace
(
String
columnName
)
{
for
(
IntrospectedColumn
introspectedColumn
:
this
.
columns
)
{
if
(
introspectedColumn
.
getActualColumnName
().
equals
(
columnName
))
{
return
true
;
}
}
return
false
;
}
/**
* 有Selective代码生成
* @param element
*/
private
void
generatedWithSelective
(
XmlElement
element
,
IntrospectedTable
introspectedTable
,
boolean
hasPrefix
)
{
if
(
columns
.
size
()
>
0
)
{
if
(
incTools
.
support
()
)
{
// 查找 set->if->text
List
<
XmlElement
>
sets
=
XmlElementGeneratorTools
.
findXmlElements
(
element
,
"set"
);
if
(
sets
.
size
()
>
0
)
{
...
...
@@ -212,11 +182,11 @@ public class IncrementsPlugin extends BasePlugin {
TextElement
textEle
=
(
TextElement
)
textEles
.
get
(
0
);
String
[]
strs
=
textEle
.
getContent
().
split
(
"="
);
String
columnName
=
strs
[
0
].
trim
();
IntrospectedColumn
introspectedColumn
=
introspectedTable
.
getColumn
(
columnName
);
// 查找是否需要进行增量操作
if
(
needReplace
(
columnName
))
{
IntrospectedColumn
introspectedColumn
=
introspectedTable
.
getColumn
(
columnName
);
if
(
incTools
.
supportColumn
(
introspectedColumn
))
{
xmlElement
.
getElements
().
clear
();
xmlElement
.
getElements
().
addAll
(
generatedIncrementsElement
(
xmlElement
,
introspectedColumn
,
hasPrefix
,
true
));
xmlElement
.
getElements
().
addAll
(
incTools
.
generatedIncrementsElement
(
introspectedColumn
,
hasPrefix
,
true
));
}
}
}
...
...
@@ -231,7 +201,7 @@ public class IncrementsPlugin extends BasePlugin {
* @param hasPrefix
*/
private
void
generatedWithoutSelective
(
XmlElement
xmlElement
,
IntrospectedTable
introspectedTable
,
boolean
hasPrefix
)
{
if
(
columns
.
size
()
>
0
)
{
if
(
incTools
.
support
()
)
{
List
<
Element
>
newEles
=
new
ArrayList
<>();
for
(
Element
ele
:
xmlElement
.
getElements
())
{
// 找到text节点且格式为 set xx = xx 或者 xx = xx
...
...
@@ -241,11 +211,10 @@ public class IncrementsPlugin extends BasePlugin {
// 清理 set 操作
text
=
text
.
replaceFirst
(
"set\\s"
,
""
).
trim
();
String
columnName
=
text
.
split
(
"="
)[
0
].
trim
();
IntrospectedColumn
introspectedColumn
=
introspectedTable
.
getColumn
(
columnName
);
// 查找判断是否需要进行节点替换
if
(
needReplace
(
columnName
))
{
IntrospectedColumn
introspectedColumn
=
introspectedTable
.
getColumn
(
columnName
);
newEles
.
addAll
(
generatedIncrementsElement
(
xmlElement
,
introspectedColumn
,
hasPrefix
,
text
.
endsWith
(
","
)));
if
(
incTools
.
supportColumn
(
introspectedColumn
))
{
newEles
.
addAll
(
incTools
.
generatedIncrementsElement
(
introspectedColumn
,
hasPrefix
,
text
.
endsWith
(
","
)));
continue
;
}
...
...
@@ -259,47 +228,4 @@ public class IncrementsPlugin extends BasePlugin {
xmlElement
.
getElements
().
addAll
(
newEles
);
}
}
/**
* 生成增量操作节点
* @param element
* @param introspectedColumn
* @param hasPrefix
* @param hasComma
*/
private
List
<
Element
>
generatedIncrementsElement
(
XmlElement
element
,
IntrospectedColumn
introspectedColumn
,
boolean
hasPrefix
,
boolean
hasComma
)
{
List
<
Element
>
list
=
new
ArrayList
<>();
// 1. column = 节点
list
.
add
(
new
TextElement
(
MyBatis3FormattingUtilities
.
getEscapedColumnName
(
introspectedColumn
)
+
" = "
));
// 2. 选择节点
// 条件
XmlElement
choose
=
new
XmlElement
(
"choose"
);
// 没有启用增量操作
XmlElement
when
=
new
XmlElement
(
"when"
);
when
.
addAttribute
(
new
Attribute
(
"test"
,
(
hasPrefix
?
"record"
:
"_parameter"
)
+
".incs.isEmpty()"
));
TextElement
normal
=
new
TextElement
(
MyBatis3FormattingUtilities
.
getParameterClause
(
introspectedColumn
,
hasPrefix
?
"record."
:
null
));
when
.
addElement
(
normal
);
choose
.
addElement
(
when
);
// 启用了增量操作
XmlElement
otherwise
=
new
XmlElement
(
"otherwise"
);
TextElement
spec
=
new
TextElement
(
MyBatis3FormattingUtilities
.
getEscapedColumnName
(
introspectedColumn
)
+
" ${"
+
(
hasPrefix
?
"record"
:
"_parameter"
)
+
".incs."
+
MyBatis3FormattingUtilities
.
getEscapedColumnName
(
introspectedColumn
)
+
".value} "
+
MyBatis3FormattingUtilities
.
getParameterClause
(
introspectedColumn
,
hasPrefix
?
"record."
:
null
));
otherwise
.
addElement
(
spec
);
choose
.
addElement
(
otherwise
);
list
.
add
(
choose
);
// 3. 结尾逗号
if
(
hasComma
)
{
list
.
add
(
new
TextElement
(
","
));
}
return
list
;
}
}
src/main/java/com/itfsw/mybatis/generator/plugins/ModelBuilderPlugin.java
View file @
79b36e8a
This diff is collapsed.
Click to expand it.
src/main/java/com/itfsw/mybatis/generator/plugins/SelectiveEnhancedPlugin.java
View file @
79b36e8a
...
...
@@ -211,6 +211,7 @@ public class SelectiveEnhancedPlugin extends BasePlugin {
XmlElement
whenEle
=
new
XmlElement
(
"when"
);
whenEle
.
addAttribute
(
new
Attribute
(
"test"
,
prefix
+
"isSelective()"
));
for
(
Element
ele
:
element
.
getElements
())
{
logger
.
warn
(
ele
.
getFormattedContent
(
0
));
// 对于字符串主键,是没有if判断节点的
if
(
ele
instanceof
XmlElement
){
// if的text节点
...
...
src/main/java/com/itfsw/mybatis/generator/plugins/UpsertPlugin.java
View file @
79b36e8a
This diff is collapsed.
Click to expand it.
src/main/java/com/itfsw/mybatis/generator/plugins/utils/IncrementsPluginTools.java
0 → 100644
View file @
79b36e8a
/*
* Copyright (c) 2017.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com
.
itfsw
.
mybatis
.
generator
.
plugins
.
utils
;
import
com.itfsw.mybatis.generator.plugins.IncrementsPlugin
;
import
com.itfsw.mybatis.generator.plugins.ModelBuilderPlugin
;
import
org.mybatis.generator.api.IntrospectedColumn
;
import
org.mybatis.generator.api.IntrospectedTable
;
import
org.mybatis.generator.api.dom.java.FullyQualifiedJavaType
;
import
org.mybatis.generator.api.dom.xml.Attribute
;
import
org.mybatis.generator.api.dom.xml.Element
;
import
org.mybatis.generator.api.dom.xml.TextElement
;
import
org.mybatis.generator.api.dom.xml.XmlElement
;
import
org.mybatis.generator.codegen.mybatis3.MyBatis3FormattingUtilities
;
import
org.mybatis.generator.config.Context
;
import
org.mybatis.generator.internal.util.StringUtility
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* ---------------------------------------------------------------------------
* 增量插件工具
* ---------------------------------------------------------------------------
* @author: hewei
* @time:2017/6/21 16:12
* ---------------------------------------------------------------------------
*/
public
class
IncrementsPluginTools
{
private
final
static
Logger
logger
=
LoggerFactory
.
getLogger
(
IncrementsPluginTools
.
class
);
private
Context
context
;
// 上下文
private
IntrospectedTable
introspectedTable
;
// 表
private
List
<
IntrospectedColumn
>
columns
=
new
ArrayList
<>();
// 表启用增量操作的字段
/**
* 构造函数
* @param context
* @param introspectedTable
*/
private
IncrementsPluginTools
(
Context
context
,
IntrospectedTable
introspectedTable
)
{
this
.
context
=
context
;
this
.
introspectedTable
=
introspectedTable
;
}
/**
* 获取工具
* @param context
* @param introspectedTable
* @return
*/
public
static
IncrementsPluginTools
getTools
(
Context
context
,
IntrospectedTable
introspectedTable
)
{
IncrementsPluginTools
tools
=
new
IncrementsPluginTools
(
context
,
introspectedTable
);
// 判断是否启用了插件
if
(
PluginTools
.
getPluginConfiguration
(
context
,
IncrementsPlugin
.
class
)
!=
null
)
{
String
incrementsColumns
=
introspectedTable
.
getTableConfigurationProperty
(
IncrementsPlugin
.
PRE_INCREMENTS_COLUMNS
);
if
(
StringUtility
.
stringHasValue
(
incrementsColumns
))
{
// 切分
String
[]
incrementsColumnsStrs
=
incrementsColumns
.
split
(
","
);
for
(
String
incrementsColumnsStr
:
incrementsColumnsStrs
)
{
IntrospectedColumn
column
=
introspectedTable
.
getColumn
(
incrementsColumnsStr
.
trim
());
if
(
column
==
null
)
{
logger
.
warn
(
"itfsw:插件"
+
IncrementsPlugin
.
class
.
getTypeName
()
+
"插件没有找到column为"
+
incrementsColumnsStr
.
trim
()
+
"的字段!"
);
}
else
{
tools
.
columns
.
add
(
column
);
}
}
}
}
return
tools
;
}
/**
* 获取INC Enum
* @return
*/
public
FullyQualifiedJavaType
getIncEnum
()
{
return
new
FullyQualifiedJavaType
(
this
.
introspectedTable
.
getFullyQualifiedTable
().
getDomainObjectName
()
+
"."
+
ModelBuilderPlugin
.
BUILDER_CLASS_NAME
+
".Inc"
);
}
/**
* 是否启用了
*
* @return
*/
public
boolean
support
(){
return
this
.
columns
.
size
()
>
0
;
}
/**
* Getter method for property <tt>columns</tt>.
* @return property value of columns
* @author hewei
*/
public
List
<
IntrospectedColumn
>
getColumns
()
{
return
columns
;
}
/**
* 判断是否为需要进行增量操作的column
*
* @param searchColumn
* @return
*/
public
boolean
supportColumn
(
IntrospectedColumn
searchColumn
){
for
(
IntrospectedColumn
column:
this
.
columns
){
if
(
column
.
getActualColumnName
().
equals
(
searchColumn
.
getActualColumnName
())){
return
true
;
}
}
return
false
;
}
/**
* 生成增量操作节点
*
* @param introspectedColumn
* @param hasPrefix
* @param hasComma
*/
public
List
<
Element
>
generatedIncrementsElement
(
IntrospectedColumn
introspectedColumn
,
boolean
hasPrefix
,
boolean
hasComma
)
{
List
<
Element
>
list
=
new
ArrayList
<>();
// 1. column = 节点
list
.
add
(
new
TextElement
(
MyBatis3FormattingUtilities
.
getEscapedColumnName
(
introspectedColumn
)
+
" = "
));
// 2. 选择节点
// 条件
XmlElement
choose
=
new
XmlElement
(
"choose"
);
// 没有启用增量操作
XmlElement
when
=
new
XmlElement
(
"when"
);
when
.
addAttribute
(
new
Attribute
(
"test"
,
(
hasPrefix
?
"record"
:
"_parameter"
)
+
".incs.isEmpty()"
));
TextElement
normal
=
new
TextElement
(
MyBatis3FormattingUtilities
.
getParameterClause
(
introspectedColumn
,
hasPrefix
?
"record."
:
null
));
when
.
addElement
(
normal
);
choose
.
addElement
(
when
);
// 启用了增量操作
XmlElement
otherwise
=
new
XmlElement
(
"otherwise"
);
TextElement
spec
=
new
TextElement
(
MyBatis3FormattingUtilities
.
getEscapedColumnName
(
introspectedColumn
)
+
" ${"
+
(
hasPrefix
?
"record"
:
"_parameter"
)
+
".incs."
+
MyBatis3FormattingUtilities
.
getEscapedColumnName
(
introspectedColumn
)
+
".value} "
+
MyBatis3FormattingUtilities
.
getParameterClause
(
introspectedColumn
,
hasPrefix
?
"record."
:
null
));
otherwise
.
addElement
(
spec
);
choose
.
addElement
(
otherwise
);
list
.
add
(
choose
);
// 3. 结尾逗号
if
(
hasComma
)
{
list
.
add
(
new
TextElement
(
","
));
}
return
list
;
}
}
src/main/java/com/itfsw/mybatis/generator/plugins/utils/XmlElementGeneratorTools.java
View file @
79b36e8a
...
...
@@ -137,7 +137,7 @@ public class XmlElementGeneratorTools {
* @param columns
* @return
*/
public
static
List
<
Element
>
generateKeys
(
List
<
IntrospectedColumn
>
columns
)
{
public
static
List
<
Text
Element
>
generateKeys
(
List
<
IntrospectedColumn
>
columns
)
{
return
generateKeys
(
columns
,
true
);
}
...
...
@@ -147,7 +147,7 @@ public class XmlElementGeneratorTools {
* @param bracket
* @return
*/
public
static
List
<
Element
>
generateKeys
(
List
<
IntrospectedColumn
>
columns
,
boolean
bracket
)
{
public
static
List
<
Text
Element
>
generateKeys
(
List
<
IntrospectedColumn
>
columns
,
boolean
bracket
)
{
return
generateCommColumns
(
columns
,
null
,
bracket
,
1
);
}
...
...
@@ -177,7 +177,7 @@ public class XmlElementGeneratorTools {
* @param bracket
* @return
*/
public
static
Element
generateKeysSelective
(
List
<
IntrospectedColumn
>
columns
,
String
prefix
,
boolean
bracket
)
{
public
static
Xml
Element
generateKeysSelective
(
List
<
IntrospectedColumn
>
columns
,
String
prefix
,
boolean
bracket
)
{
return
generateCommColumnsSelective
(
columns
,
prefix
,
bracket
,
1
);
}
...
...
@@ -186,7 +186,7 @@ public class XmlElementGeneratorTools {
* @param columns
* @return
*/
public
static
List
<
Element
>
generateValues
(
List
<
IntrospectedColumn
>
columns
)
{
public
static
List
<
Text
Element
>
generateValues
(
List
<
IntrospectedColumn
>
columns
)
{
return
generateValues
(
columns
,
null
);
}
...
...
@@ -196,7 +196,7 @@ public class XmlElementGeneratorTools {
* @param prefix
* @return
*/
public
static
List
<
Element
>
generateValues
(
List
<
IntrospectedColumn
>
columns
,
String
prefix
)
{
public
static
List
<
Text
Element
>
generateValues
(
List
<
IntrospectedColumn
>
columns
,
String
prefix
)
{
return
generateValues
(
columns
,
prefix
,
true
);
}
...
...
@@ -207,7 +207,7 @@ public class XmlElementGeneratorTools {
* @param bracket
* @return
*/
public
static
List
<
Element
>
generateValues
(
List
<
IntrospectedColumn
>
columns
,
String
prefix
,
boolean
bracket
)
{
public
static
List
<
Text
Element
>
generateValues
(
List
<
IntrospectedColumn
>
columns
,
String
prefix
,
boolean
bracket
)
{
return
generateCommColumns
(
columns
,
prefix
,
bracket
,
2
);
}
...
...
@@ -237,7 +237,7 @@ public class XmlElementGeneratorTools {
* @param bracket
* @return
*/
public
static
Element
generateValuesSelective
(
List
<
IntrospectedColumn
>
columns
,
String
prefix
,
boolean
bracket
)
{
public
static
Xml
Element
generateValuesSelective
(
List
<
IntrospectedColumn
>
columns
,
String
prefix
,
boolean
bracket
)
{
return
generateCommColumnsSelective
(
columns
,
prefix
,
bracket
,
2
);
}
...
...
@@ -246,7 +246,7 @@ public class XmlElementGeneratorTools {
* @param columns
* @return
*/
public
static
List
<
Element
>
generateSets
(
List
<
IntrospectedColumn
>
columns
)
{
public
static
List
<
Text
Element
>
generateSets
(
List
<
IntrospectedColumn
>
columns
)
{
return
generateSets
(
columns
,
null
,
false
);
}
...
...
@@ -256,7 +256,7 @@ public class XmlElementGeneratorTools {
* @param prefix
* @return
*/
public
static
List
<
Element
>
generateSets
(
List
<
IntrospectedColumn
>
columns
,
String
prefix
)
{
public
static
List
<
Text
Element
>
generateSets
(
List
<
IntrospectedColumn
>
columns
,
String
prefix
)
{
return
generateSets
(
columns
,
prefix
,
false
);
}
...
...
@@ -267,7 +267,7 @@ public class XmlElementGeneratorTools {
* @param bracket
* @return
*/
public
static
List
<
Element
>
generateSets
(
List
<
IntrospectedColumn
>
columns
,
String
prefix
,
boolean
bracket
)
{
public
static
List
<
Text
Element
>
generateSets
(
List
<
IntrospectedColumn
>
columns
,
String
prefix
,
boolean
bracket
)
{
return
generateCommColumns
(
columns
,
prefix
,
bracket
,
3
);
}
...
...
@@ -276,7 +276,7 @@ public class XmlElementGeneratorTools {
* @param columns
* @return
*/
public
static
Element
generateSetsSelective
(
List
<
IntrospectedColumn
>
columns
)
{
public
static
Xml
Element
generateSetsSelective
(
List
<
IntrospectedColumn
>
columns
)
{
return
generateSetsSelective
(
columns
,
null
,
false
);
}
...
...
@@ -286,7 +286,7 @@ public class XmlElementGeneratorTools {
* @param prefix
* @return
*/
public
static
Element
generateSetsSelective
(
List
<
IntrospectedColumn
>
columns
,
String
prefix
)
{
public
static
Xml
Element
generateSetsSelective
(
List
<
IntrospectedColumn
>
columns
,
String
prefix
)
{
return
generateSetsSelective
(
columns
,
prefix
,
false
);
}
...
...
@@ -297,7 +297,7 @@ public class XmlElementGeneratorTools {
* @param bracket
* @return
*/
public
static
Element
generateSetsSelective
(
List
<
IntrospectedColumn
>
columns
,
String
prefix
,
boolean
bracket
)
{
public
static
Xml
Element
generateSetsSelective
(
List
<
IntrospectedColumn
>
columns
,
String
prefix
,
boolean
bracket
)
{
return
generateCommColumnsSelective
(
columns
,
prefix
,
bracket
,
3
);
}
...
...
@@ -309,8 +309,8 @@ public class XmlElementGeneratorTools {
* @param type 1:key,2:value,3:set
* @return
*/
private
static
List
<
Element
>
generateCommColumns
(
List
<
IntrospectedColumn
>
columns
,
String
prefix
,
boolean
bracket
,
int
type
)
{
List
<
Element
>
list
=
new
ArrayList
<>();
private
static
List
<
Text
Element
>
generateCommColumns
(
List
<
IntrospectedColumn
>
columns
,
String
prefix
,
boolean
bracket
,
int
type
)
{
List
<
Text
Element
>
list
=
new
ArrayList
<>();
StringBuilder
sb
=
new
StringBuilder
(
bracket
?
"("
:
""
);
Iterator
<
IntrospectedColumn
>
columnIterator
=
columns
.
iterator
();
while
(
columnIterator
.
hasNext
())
{
...
...
@@ -361,7 +361,7 @@ public class XmlElementGeneratorTools {
* @param type 1:key,2:value,3:set
* @return
*/
private
static
Element
generateCommColumnsSelective
(
List
<
IntrospectedColumn
>
columns
,
String
prefix
,
boolean
bracket
,
int
type
)
{
private
static
Xml
Element
generateCommColumnsSelective
(
List
<
IntrospectedColumn
>
columns
,
String
prefix
,
boolean
bracket
,
int
type
)
{
XmlElement
eleTrim
=
new
XmlElement
(
"trim"
);
if
(
bracket
)
{
eleTrim
.
addAttribute
(
new
Attribute
(
"prefix"
,
"("
));
...
...
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