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
7e403d1d
Commit
7e403d1d
authored
Jan 16, 2017
by
hewei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
统一插件调试日志格式
parent
38417972
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
43 additions
and
17 deletions
+43
-17
src/main/java/com/itfsw/mybatis/generator/plugins/BatchInsertPlugin.java
...om/itfsw/mybatis/generator/plugins/BatchInsertPlugin.java
+2
-1
src/main/java/com/itfsw/mybatis/generator/plugins/CriteriaBuilderPlugin.java
...tfsw/mybatis/generator/plugins/CriteriaBuilderPlugin.java
+14
-0
src/main/java/com/itfsw/mybatis/generator/plugins/ExampleEnhancedPlugin.java
...tfsw/mybatis/generator/plugins/ExampleEnhancedPlugin.java
+1
-1
src/main/java/com/itfsw/mybatis/generator/plugins/ExampleTargetPlugin.java
.../itfsw/mybatis/generator/plugins/ExampleTargetPlugin.java
+1
-1
src/main/java/com/itfsw/mybatis/generator/plugins/LimitPlugin.java
...java/com/itfsw/mybatis/generator/plugins/LimitPlugin.java
+7
-5
src/main/java/com/itfsw/mybatis/generator/plugins/LogicalDeletePlugin.java
.../itfsw/mybatis/generator/plugins/LogicalDeletePlugin.java
+11
-1
src/main/java/com/itfsw/mybatis/generator/plugins/ModelBuilderPlugin.java
...m/itfsw/mybatis/generator/plugins/ModelBuilderPlugin.java
+5
-5
src/main/java/com/itfsw/mybatis/generator/plugins/SelectOneByExamplePlugin.java
...w/mybatis/generator/plugins/SelectOneByExamplePlugin.java
+2
-3
No files found.
src/main/java/com/itfsw/mybatis/generator/plugins/BatchInsertPlugin.java
View file @
7e403d1d
...
@@ -79,7 +79,6 @@ public class BatchInsertPlugin extends PluginAdapter {
...
@@ -79,7 +79,6 @@ public class BatchInsertPlugin extends PluginAdapter {
*/
*/
@Override
@Override
public
boolean
clientGenerated
(
Interface
interfaze
,
TopLevelClass
topLevelClass
,
IntrospectedTable
introspectedTable
)
{
public
boolean
clientGenerated
(
Interface
interfaze
,
TopLevelClass
topLevelClass
,
IntrospectedTable
introspectedTable
)
{
logger
.
debug
(
"itfsw:生成"
+
interfaze
.
getType
()
+
"对应batchInsert方法..."
);
// 方法生成
// 方法生成
Method
method
=
new
Method
(
METHOD_BATCH_INSERT
);
Method
method
=
new
Method
(
METHOD_BATCH_INSERT
);
// 方法可见性 interface会忽略
// 方法可见性 interface会忽略
...
@@ -95,6 +94,7 @@ public class BatchInsertPlugin extends PluginAdapter {
...
@@ -95,6 +94,7 @@ public class BatchInsertPlugin extends PluginAdapter {
// interface 增加方法
// interface 增加方法
interfaze
.
addMethod
(
method
);
interfaze
.
addMethod
(
method
);
logger
.
debug
(
"itfsw(批量插入插件):"
+
interfaze
.
getType
().
getShortName
()
+
"增加batchInsert方法。"
);
return
true
;
return
true
;
}
}
...
@@ -190,6 +190,7 @@ public class BatchInsertPlugin extends PluginAdapter {
...
@@ -190,6 +190,7 @@ public class BatchInsertPlugin extends PluginAdapter {
if
(
context
.
getPlugins
().
sqlMapInsertElementGenerated
(
element
,
introspectedTable
))
{
if
(
context
.
getPlugins
().
sqlMapInsertElementGenerated
(
element
,
introspectedTable
))
{
document
.
getRootElement
().
addElement
(
element
);
document
.
getRootElement
().
addElement
(
element
);
logger
.
debug
(
"itfsw(批量插入插件):"
+
introspectedTable
.
getMyBatis3XmlMapperFileName
()
+
"增加batchInsert实现方法。"
);
}
}
}
}
}
}
src/main/java/com/itfsw/mybatis/generator/plugins/CriteriaBuilderPlugin.java
View file @
7e403d1d
...
@@ -16,6 +16,11 @@
...
@@ -16,6 +16,11 @@
package
com
.
itfsw
.
mybatis
.
generator
.
plugins
;
package
com
.
itfsw
.
mybatis
.
generator
.
plugins
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.util.List
;
/**
/**
* ---------------------------------------------------------------------------
* ---------------------------------------------------------------------------
* 增加Criteria Builder方法
* 增加Criteria Builder方法
...
@@ -26,5 +31,14 @@ package com.itfsw.mybatis.generator.plugins;
...
@@ -26,5 +31,14 @@ package com.itfsw.mybatis.generator.plugins;
*/
*/
@Deprecated
@Deprecated
public
class
CriteriaBuilderPlugin
extends
ExampleEnhancedPlugin
{
public
class
CriteriaBuilderPlugin
extends
ExampleEnhancedPlugin
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
CriteriaBuilderPlugin
.
class
);
/**
* {@inheritDoc}
*/
@Override
public
boolean
validate
(
List
<
String
>
warnings
)
{
logger
.
warn
(
"itfsw:插件"
+
this
.
getClass
().
getTypeName
()+
"插件已经过时,请使用com.itfsw.mybatis.generator.plugins.ExampleEnhancedPlugin插件替换!"
);
return
super
.
validate
(
warnings
);
}
}
}
src/main/java/com/itfsw/mybatis/generator/plugins/ExampleEnhancedPlugin.java
View file @
7e403d1d
...
@@ -21,7 +21,7 @@ import java.util.List;
...
@@ -21,7 +21,7 @@ import java.util.List;
* ---------------------------------------------------------------------------
* ---------------------------------------------------------------------------
*/
*/
public
class
ExampleEnhancedPlugin
extends
PluginAdapter
{
public
class
ExampleEnhancedPlugin
extends
PluginAdapter
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
CriteriaBuilder
Plugin
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ExampleEnhanced
Plugin
.
class
);
/**
/**
* {@inheritDoc}
* {@inheritDoc}
*/
*/
...
...
src/main/java/com/itfsw/mybatis/generator/plugins/ExampleTargetPlugin.java
View file @
7e403d1d
...
@@ -80,7 +80,7 @@ public class ExampleTargetPlugin extends PluginAdapter {
...
@@ -80,7 +80,7 @@ public class ExampleTargetPlugin extends PluginAdapter {
introspectedTable
.
setExampleType
(
newExampleType
);
introspectedTable
.
setExampleType
(
newExampleType
);
logger
.
debug
(
"itfsw
:修改"
+
exampleType
+
"的包到"
+
this
.
targetPackage
);
logger
.
debug
(
"itfsw
(Example 目标包修改插件):修改"
+
introspectedTable
.
getExampleType
()
+
"的包到"
+
this
.
targetPackage
);
}
}
}
}
src/main/java/com/itfsw/mybatis/generator/plugins/LimitPlugin.java
View file @
7e403d1d
...
@@ -82,7 +82,7 @@ public class LimitPlugin extends PluginAdapter {
...
@@ -82,7 +82,7 @@ public class LimitPlugin extends PluginAdapter {
rows
.
setType
(
integerWrapper
);
rows
.
setType
(
integerWrapper
);
CommentTools
.
addFieldComment
(
rows
,
introspectedTable
);
CommentTools
.
addFieldComment
(
rows
,
introspectedTable
);
topLevelClass
.
addField
(
rows
);
topLevelClass
.
addField
(
rows
);
logger
.
debug
(
"itfsw
:分页插件增加Example的
offset和rows字段"
);
logger
.
debug
(
"itfsw
(MySQL分页插件):"
+
topLevelClass
.
getType
().
getShortName
()+
"增加
offset和rows字段"
);
// 增加getter && setter 方法
// 增加getter && setter 方法
Method
setOffset
=
new
Method
();
Method
setOffset
=
new
Method
();
...
@@ -116,7 +116,7 @@ public class LimitPlugin extends PluginAdapter {
...
@@ -116,7 +116,7 @@ public class LimitPlugin extends PluginAdapter {
getRows
.
addBodyLine
(
"return rows;"
);
getRows
.
addBodyLine
(
"return rows;"
);
CommentTools
.
addGeneralMethodComment
(
getRows
,
introspectedTable
);
CommentTools
.
addGeneralMethodComment
(
getRows
,
introspectedTable
);
topLevelClass
.
addMethod
(
getRows
);
topLevelClass
.
addMethod
(
getRows
);
logger
.
debug
(
"itfsw
:分页插件增加Example的offset和rows的getter和setter
"
);
logger
.
debug
(
"itfsw
(MySQL分页插件):"
+
topLevelClass
.
getType
().
getShortName
()+
"增加offset和rows的getter和setter实现。
"
);
// 提供几个快捷方法
// 提供几个快捷方法
Method
setLimit
=
new
Method
();
Method
setLimit
=
new
Method
();
...
@@ -140,7 +140,7 @@ public class LimitPlugin extends PluginAdapter {
...
@@ -140,7 +140,7 @@ public class LimitPlugin extends PluginAdapter {
setLimit2
.
addBodyLine
(
"return this;"
);
setLimit2
.
addBodyLine
(
"return this;"
);
CommentTools
.
addGeneralMethodComment
(
setLimit2
,
introspectedTable
);
CommentTools
.
addGeneralMethodComment
(
setLimit2
,
introspectedTable
);
topLevelClass
.
addMethod
(
setLimit2
);
topLevelClass
.
addMethod
(
setLimit2
);
logger
.
debug
(
"itfsw
:分页插件增加Example的limit方法
"
);
logger
.
debug
(
"itfsw
(MySQL分页插件):"
+
topLevelClass
.
getType
().
getShortName
()+
"增加limit方法。
"
);
Method
setPage
=
new
Method
();
Method
setPage
=
new
Method
();
setPage
.
setVisibility
(
JavaVisibility
.
PUBLIC
);
setPage
.
setVisibility
(
JavaVisibility
.
PUBLIC
);
...
@@ -153,7 +153,7 @@ public class LimitPlugin extends PluginAdapter {
...
@@ -153,7 +153,7 @@ public class LimitPlugin extends PluginAdapter {
setPage
.
addBodyLine
(
"return this;"
);
setPage
.
addBodyLine
(
"return this;"
);
CommentTools
.
addGeneralMethodComment
(
setPage
,
introspectedTable
);
CommentTools
.
addGeneralMethodComment
(
setPage
,
introspectedTable
);
topLevelClass
.
addMethod
(
setPage
);
topLevelClass
.
addMethod
(
setPage
);
logger
.
debug
(
"itfsw
:分页插件增加Example的
page方法"
);
logger
.
debug
(
"itfsw
(MySQL分页插件):"
+
topLevelClass
.
getType
().
getShortName
()+
"增加
page方法"
);
// !!! clear 方法增加 offset 和 rows的清理
// !!! clear 方法增加 offset 和 rows的清理
List
<
Method
>
methodList
=
topLevelClass
.
getMethods
();
List
<
Method
>
methodList
=
topLevelClass
.
getMethods
();
...
@@ -161,7 +161,7 @@ public class LimitPlugin extends PluginAdapter {
...
@@ -161,7 +161,7 @@ public class LimitPlugin extends PluginAdapter {
if
(
method
.
getName
().
equals
(
"clear"
)){
if
(
method
.
getName
().
equals
(
"clear"
)){
method
.
addBodyLine
(
"rows = null;"
);
method
.
addBodyLine
(
"rows = null;"
);
method
.
addBodyLine
(
"offset = null;"
);
method
.
addBodyLine
(
"offset = null;"
);
logger
.
debug
(
"itfsw
:分页插件修正Example的
clear方法,增加rows和offset字段的清空"
);
logger
.
debug
(
"itfsw
(MySQL分页插件):"
+
topLevelClass
.
getType
().
getShortName
()+
"修改
clear方法,增加rows和offset字段的清空"
);
}
}
}
}
...
@@ -193,6 +193,8 @@ public class LimitPlugin extends PluginAdapter {
...
@@ -193,6 +193,8 @@ public class LimitPlugin extends PluginAdapter {
element
.
addElement
(
ifLimitNotNullElement
);
element
.
addElement
(
ifLimitNotNullElement
);
logger
.
debug
(
"itfsw(MySQL分页插件):"
+
introspectedTable
.
getMyBatis3XmlMapperFileName
()+
"selectByExample方法增加分页条件。"
);
return
true
;
return
true
;
}
}
...
...
src/main/java/com/itfsw/mybatis/generator/plugins/LogicalDeletePlugin.java
View file @
7e403d1d
...
@@ -116,10 +116,14 @@ public class LogicalDeletePlugin extends PluginAdapter {
...
@@ -116,10 +116,14 @@ public class LogicalDeletePlugin extends PluginAdapter {
||
JDBCType
.
VARCHAR
==
type
){
||
JDBCType
.
VARCHAR
==
type
){
this
.
logicalDeleteColumn
=
column
;
this
.
logicalDeleteColumn
=
column
;
}
else
{
}
else
{
logger
.
warn
(
"itfsw
:插件"
+
this
.
getClass
().
getTypeName
()+
"逻辑删除列的类型不支持
(请使用数字列,字符串列,布尔列)!"
);
logger
.
warn
(
"itfsw
(逻辑删除插件):"
+
introspectedTable
.
getFullyQualifiedTable
()+
"逻辑删除列("
+
introspectedTable
.
getTableConfigurationProperty
(
LOGICAL_DELETE_COLUMN_KEY
)+
")的类型不在支持范围
(请使用数字列,字符串列,布尔列)!"
);
}
}
}
}
}
}
if
(
introspectedTable
.
getTableConfigurationProperty
(
LOGICAL_DELETE_COLUMN_KEY
)
!=
null
&&
this
.
logicalDeleteColumn
==
null
){
logger
.
warn
(
"itfsw(逻辑删除插件):"
+
introspectedTable
.
getFullyQualifiedTable
()+
"没有找到您配置的逻辑删除列("
+
introspectedTable
.
getTableConfigurationProperty
(
LOGICAL_DELETE_COLUMN_KEY
)+
")!"
);
}
}
}
/**
/**
...
@@ -145,6 +149,7 @@ public class LogicalDeletePlugin extends PluginAdapter {
...
@@ -145,6 +149,7 @@ public class LogicalDeletePlugin extends PluginAdapter {
CommentTools
.
addGeneralMethodComment
(
mLogicalDeleteByExample
,
introspectedTable
);
CommentTools
.
addGeneralMethodComment
(
mLogicalDeleteByExample
,
introspectedTable
);
// interface 增加方法
// interface 增加方法
interfaze
.
addMethod
(
mLogicalDeleteByExample
);
interfaze
.
addMethod
(
mLogicalDeleteByExample
);
logger
.
debug
(
"itfsw(逻辑删除插件):"
+
interfaze
.
getType
().
getShortName
()+
"增加方法logicalDeleteByExample。"
);
// 2. 判断是否有主键,生成主键删除方法
// 2. 判断是否有主键,生成主键删除方法
if
(
introspectedTable
.
hasPrimaryKeyColumns
()){
if
(
introspectedTable
.
hasPrimaryKeyColumns
()){
...
@@ -190,6 +195,7 @@ public class LogicalDeletePlugin extends PluginAdapter {
...
@@ -190,6 +195,7 @@ public class LogicalDeletePlugin extends PluginAdapter {
// interface 增加方法
// interface 增加方法
interfaze
.
addImportedTypes
(
importedTypes
);
interfaze
.
addImportedTypes
(
importedTypes
);
interfaze
.
addMethod
(
mLogicalDeleteByPrimaryKey
);
interfaze
.
addMethod
(
mLogicalDeleteByPrimaryKey
);
logger
.
debug
(
"itfsw(逻辑删除插件):"
+
interfaze
.
getType
().
getShortName
()+
"增加方法logicalDeleteByPrimaryKey。"
);
}
}
}
}
return
true
;
return
true
;
...
@@ -241,6 +247,7 @@ public class LogicalDeletePlugin extends PluginAdapter {
...
@@ -241,6 +247,7 @@ public class LogicalDeletePlugin extends PluginAdapter {
logicalDeleteByExample
.
addElement
(
XmlElementGeneratorTools
.
getUpdateByExampleIncludeElement
(
introspectedTable
));
logicalDeleteByExample
.
addElement
(
XmlElementGeneratorTools
.
getUpdateByExampleIncludeElement
(
introspectedTable
));
document
.
getRootElement
().
addElement
(
logicalDeleteByExample
);
document
.
getRootElement
().
addElement
(
logicalDeleteByExample
);
logger
.
debug
(
"itfsw(逻辑删除插件):"
+
introspectedTable
.
getMyBatis3XmlMapperFileName
()+
"增加方法logicalDeleteByExample的实现。"
);
// 2. 判断是否有主键,生成主键删除方法
// 2. 判断是否有主键,生成主键删除方法
if
(
introspectedTable
.
hasPrimaryKeyColumns
()){
if
(
introspectedTable
.
hasPrimaryKeyColumns
()){
...
@@ -306,6 +313,7 @@ public class LogicalDeletePlugin extends PluginAdapter {
...
@@ -306,6 +313,7 @@ public class LogicalDeletePlugin extends PluginAdapter {
}
}
document
.
getRootElement
().
addElement
(
logicalDeleteByPrimaryKey
);
document
.
getRootElement
().
addElement
(
logicalDeleteByPrimaryKey
);
logger
.
debug
(
"itfsw(逻辑删除插件):"
+
introspectedTable
.
getMyBatis3XmlMapperFileName
()+
"增加方法logicalDeleteByPrimaryKey的实现。"
);
}
}
}
}
return
true
;
return
true
;
...
@@ -342,6 +350,7 @@ public class LogicalDeletePlugin extends PluginAdapter {
...
@@ -342,6 +350,7 @@ public class LogicalDeletePlugin extends PluginAdapter {
// 常量插入到第一位
// 常量插入到第一位
ArrayList
<
Field
>
fields
=
(
ArrayList
<
Field
>)
topLevelClass
.
getFields
();
ArrayList
<
Field
>
fields
=
(
ArrayList
<
Field
>)
topLevelClass
.
getFields
();
fields
.
add
(
0
,
field
);
fields
.
add
(
0
,
field
);
logger
.
debug
(
"itfsw(逻辑删除插件):"
+
topLevelClass
.
getType
().
getShortName
()+
"增加方法DEL_FLAG的常量。"
);
}
}
return
true
;
return
true
;
}
}
...
@@ -401,6 +410,7 @@ public class LogicalDeletePlugin extends PluginAdapter {
...
@@ -401,6 +410,7 @@ public class LogicalDeletePlugin extends PluginAdapter {
method
.
addBodyLine
(
sb
.
toString
());
method
.
addBodyLine
(
sb
.
toString
());
innerClass
.
addMethod
(
method
);
innerClass
.
addMethod
(
method
);
logger
.
debug
(
"itfsw(逻辑删除插件):"
+
topLevelClass
.
getType
().
getShortName
()+
"."
+
innerClass
.
getType
().
getShortName
()+
"增加andDeleted方法。"
);
}
}
}
}
}
}
...
...
src/main/java/com/itfsw/mybatis/generator/plugins/ModelBuilderPlugin.java
View file @
7e403d1d
...
@@ -70,7 +70,7 @@ public class ModelBuilderPlugin extends PluginAdapter {
...
@@ -70,7 +70,7 @@ public class ModelBuilderPlugin extends PluginAdapter {
innerClass
.
setVisibility
(
JavaVisibility
.
PUBLIC
);
innerClass
.
setVisibility
(
JavaVisibility
.
PUBLIC
);
innerClass
.
setStatic
(
true
);
innerClass
.
setStatic
(
true
);
CommentTools
.
addClassComment
(
innerClass
,
introspectedTable
);
CommentTools
.
addClassComment
(
innerClass
,
introspectedTable
);
logger
.
debug
(
"itfsw
:生成内部Builder类
"
);
logger
.
debug
(
"itfsw
(数据Model链式构建插件):"
+
topLevelClass
.
getType
().
getShortName
()+
"增加内部Builder类。
"
);
// 构建内部obj变量
// 构建内部obj变量
Field
f
=
new
Field
(
"obj"
,
topLevelClass
.
getType
());
Field
f
=
new
Field
(
"obj"
,
topLevelClass
.
getType
());
...
@@ -84,7 +84,7 @@ public class ModelBuilderPlugin extends PluginAdapter {
...
@@ -84,7 +84,7 @@ public class ModelBuilderPlugin extends PluginAdapter {
constructor
.
addBodyLine
(
new
StringBuilder
(
"this.obj = new "
)
constructor
.
addBodyLine
(
new
StringBuilder
(
"this.obj = new "
)
.
append
(
topLevelClass
.
getType
().
getShortName
()).
append
(
"();"
).
toString
());
.
append
(
topLevelClass
.
getType
().
getShortName
()).
append
(
"();"
).
toString
());
innerClass
.
addMethod
(
constructor
);
innerClass
.
addMethod
(
constructor
);
logger
.
debug
(
"itfsw
:生成内部Builder类构造方法
"
);
logger
.
debug
(
"itfsw
(数据Model链式构建插件):"
+
topLevelClass
.
getType
().
getShortName
()+
".Builder增加的构造方法。
"
);
// !!可能Model存在复合主键情况,字段要加上这些
// !!可能Model存在复合主键情况,字段要加上这些
if
(
topLevelClass
.
getSuperClass
()
!=
null
&&
topLevelClass
.
getSuperClass
().
compareTo
(
new
FullyQualifiedJavaType
(
introspectedTable
.
getPrimaryKeyType
()))
==
0
){
if
(
topLevelClass
.
getSuperClass
()
!=
null
&&
topLevelClass
.
getSuperClass
().
compareTo
(
new
FullyQualifiedJavaType
(
introspectedTable
.
getPrimaryKeyType
()))
==
0
){
...
@@ -101,7 +101,7 @@ public class ModelBuilderPlugin extends PluginAdapter {
...
@@ -101,7 +101,7 @@ public class ModelBuilderPlugin extends PluginAdapter {
method
.
addBodyLine
(
new
StringBuilder
().
append
(
"return this;"
).
toString
());
method
.
addBodyLine
(
new
StringBuilder
().
append
(
"return this;"
).
toString
());
CommentTools
.
addGeneralMethodComment
(
method
,
introspectedTable
);
CommentTools
.
addGeneralMethodComment
(
method
,
introspectedTable
);
innerClass
.
addMethod
(
method
);
innerClass
.
addMethod
(
method
);
logger
.
debug
(
"itfsw
:生成内部Builder类的复合主键字段对应方法"
+
field
.
getName
()
);
logger
.
debug
(
"itfsw
(数据Model链式构建插件):"
+
topLevelClass
.
getType
().
getShortName
()+
".Builder增加"
+
method
.
getName
()+
"方法(复合主键)。"
);
}
}
}
}
...
@@ -119,7 +119,7 @@ public class ModelBuilderPlugin extends PluginAdapter {
...
@@ -119,7 +119,7 @@ public class ModelBuilderPlugin extends PluginAdapter {
method
.
addBodyLine
(
new
StringBuilder
().
append
(
"return this;"
).
toString
());
method
.
addBodyLine
(
new
StringBuilder
().
append
(
"return this;"
).
toString
());
CommentTools
.
addGeneralMethodComment
(
method
,
introspectedTable
);
CommentTools
.
addGeneralMethodComment
(
method
,
introspectedTable
);
innerClass
.
addMethod
(
method
);
innerClass
.
addMethod
(
method
);
logger
.
debug
(
"itfsw
:生成内部Builder类的普通字段对应方法"
+
field
.
getName
()
);
logger
.
debug
(
"itfsw
(数据Model链式构建插件):"
+
topLevelClass
.
getType
().
getShortName
()+
".Builder增加"
+
method
.
getName
()+
"方法。"
);
}
}
Method
build
=
new
Method
(
"build"
);
Method
build
=
new
Method
(
"build"
);
...
@@ -128,7 +128,7 @@ public class ModelBuilderPlugin extends PluginAdapter {
...
@@ -128,7 +128,7 @@ public class ModelBuilderPlugin extends PluginAdapter {
build
.
addBodyLine
(
"return this.obj;"
);
build
.
addBodyLine
(
"return this.obj;"
);
CommentTools
.
addGeneralMethodComment
(
build
,
introspectedTable
);
CommentTools
.
addGeneralMethodComment
(
build
,
introspectedTable
);
innerClass
.
addMethod
(
build
);
innerClass
.
addMethod
(
build
);
logger
.
debug
(
"itfsw
:生成内部Builder类的build方法
"
);
logger
.
debug
(
"itfsw
(数据Model链式构建插件):"
+
topLevelClass
.
getType
().
getShortName
()+
".Builder增加build方法。
"
);
topLevelClass
.
addInnerClass
(
innerClass
);
topLevelClass
.
addInnerClass
(
innerClass
);
return
true
;
return
true
;
...
...
src/main/java/com/itfsw/mybatis/generator/plugins/SelectOneByExamplePlugin.java
View file @
7e403d1d
...
@@ -69,7 +69,6 @@ public class SelectOneByExamplePlugin extends PluginAdapter {
...
@@ -69,7 +69,6 @@ public class SelectOneByExamplePlugin extends PluginAdapter {
*/
*/
@Override
@Override
public
boolean
clientGenerated
(
Interface
interfaze
,
TopLevelClass
topLevelClass
,
IntrospectedTable
introspectedTable
)
{
public
boolean
clientGenerated
(
Interface
interfaze
,
TopLevelClass
topLevelClass
,
IntrospectedTable
introspectedTable
)
{
logger
.
debug
(
"itfsw:生成"
+
interfaze
.
getType
()+
"对应SelectOneByExample方法..."
);
// 方法生成
// 方法生成
Method
method
=
new
Method
(
METHOD_NAME
);
Method
method
=
new
Method
(
METHOD_NAME
);
// 方法可见性 interface会忽略
// 方法可见性 interface会忽略
...
@@ -85,6 +84,7 @@ public class SelectOneByExamplePlugin extends PluginAdapter {
...
@@ -85,6 +84,7 @@ public class SelectOneByExamplePlugin extends PluginAdapter {
// interface 增加方法
// interface 增加方法
interfaze
.
addMethod
(
method
);
interfaze
.
addMethod
(
method
);
logger
.
debug
(
"itfsw(查询单条数据插件):"
+
interfaze
.
getType
().
getShortName
()+
"增加SelectOneByExample方法。"
);
return
true
;
return
true
;
}
}
...
@@ -98,8 +98,6 @@ public class SelectOneByExamplePlugin extends PluginAdapter {
...
@@ -98,8 +98,6 @@ public class SelectOneByExamplePlugin extends PluginAdapter {
*/
*/
@Override
@Override
public
boolean
sqlMapDocumentGenerated
(
Document
document
,
IntrospectedTable
introspectedTable
)
{
public
boolean
sqlMapDocumentGenerated
(
Document
document
,
IntrospectedTable
introspectedTable
)
{
logger
.
debug
(
"itfsw:生成表"
+
introspectedTable
.
getAliasedFullyQualifiedTableNameAtRuntime
()+
"("
+
(
introspectedTable
.
hasBLOBColumns
()
?
"有"
:
"无"
)+
"Blob类型)的mapping.xml对应SelectOneByExample方法..."
);
//数据库表名
//数据库表名
String
tableName
=
introspectedTable
.
getAliasedFullyQualifiedTableNameAtRuntime
();
String
tableName
=
introspectedTable
.
getAliasedFullyQualifiedTableNameAtRuntime
();
...
@@ -178,6 +176,7 @@ public class SelectOneByExamplePlugin extends PluginAdapter {
...
@@ -178,6 +176,7 @@ public class SelectOneByExamplePlugin extends PluginAdapter {
// 添加到根节点
// 添加到根节点
document
.
getRootElement
().
addElement
(
selectOneElement
);
document
.
getRootElement
().
addElement
(
selectOneElement
);
logger
.
debug
(
"itfsw(查询单条数据插件):"
+
introspectedTable
.
getMyBatis3XmlMapperFileName
()+
"增加SelectOneByExample方法("
+(
introspectedTable
.
hasBLOBColumns
()
?
"有"
:
"无"
)+
"Blob类型))。"
);
return
true
;
return
true
;
}
}
...
...
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