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
c485d7be
Commit
c485d7be
authored
Aug 17, 2017
by
hewei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
统一命名格式
parent
03116e71
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
41 additions
and
41 deletions
+41
-41
src/main/java/com/itfsw/mybatis/generator/plugins/CommentPlugin.java
...va/com/itfsw/mybatis/generator/plugins/CommentPlugin.java
+1
-1
src/main/java/com/itfsw/mybatis/generator/plugins/ExampleTargetPlugin.java
.../itfsw/mybatis/generator/plugins/ExampleTargetPlugin.java
+2
-2
src/main/java/com/itfsw/mybatis/generator/plugins/IncrementsPlugin.java
...com/itfsw/mybatis/generator/plugins/IncrementsPlugin.java
+1
-1
src/main/java/com/itfsw/mybatis/generator/plugins/LogicalDeletePlugin.java
.../itfsw/mybatis/generator/plugins/LogicalDeletePlugin.java
+15
-15
src/main/java/com/itfsw/mybatis/generator/plugins/TablePrefixPlugin.java
...om/itfsw/mybatis/generator/plugins/TablePrefixPlugin.java
+5
-5
src/main/java/com/itfsw/mybatis/generator/plugins/TableRenamePlugin.java
...om/itfsw/mybatis/generator/plugins/TableRenamePlugin.java
+10
-10
src/main/java/com/itfsw/mybatis/generator/plugins/UpsertPlugin.java
...ava/com/itfsw/mybatis/generator/plugins/UpsertPlugin.java
+2
-2
src/main/java/com/itfsw/mybatis/generator/plugins/utils/BasePlugin.java
...com/itfsw/mybatis/generator/plugins/utils/BasePlugin.java
+2
-2
src/main/java/com/itfsw/mybatis/generator/plugins/utils/IncrementsPluginTools.java
...ybatis/generator/plugins/utils/IncrementsPluginTools.java
+1
-1
src/main/java/com/itfsw/mybatis/generator/plugins/utils/IntrospectedTableTools.java
...batis/generator/plugins/utils/IntrospectedTableTools.java
+2
-2
No files found.
src/main/java/com/itfsw/mybatis/generator/plugins/CommentPlugin.java
View file @
c485d7be
...
@@ -29,7 +29,7 @@ import java.util.Properties;
...
@@ -29,7 +29,7 @@ import java.util.Properties;
* ---------------------------------------------------------------------------
* ---------------------------------------------------------------------------
*/
*/
public
class
CommentPlugin
extends
BasePlugin
{
public
class
CommentPlugin
extends
BasePlugin
{
public
static
final
String
PR
E
_TEMPLATE
=
"template"
;
// 模板 property
public
static
final
String
PR
O
_TEMPLATE
=
"template"
;
// 模板 property
/**
/**
* 插件具体实现查看BasePlugin
* 插件具体实现查看BasePlugin
...
...
src/main/java/com/itfsw/mybatis/generator/plugins/ExampleTargetPlugin.java
View file @
c485d7be
...
@@ -35,7 +35,7 @@ import java.util.Properties;
...
@@ -35,7 +35,7 @@ import java.util.Properties;
* ---------------------------------------------------------------------------
* ---------------------------------------------------------------------------
*/
*/
public
class
ExampleTargetPlugin
extends
BasePlugin
{
public
class
ExampleTargetPlugin
extends
BasePlugin
{
public
static
final
String
TARGET_PACKAGE_KEY
=
"targetPackage"
;
// 配置targetPackage名
public
static
final
String
PRO_TARGET_PACKAGE
=
"targetPackage"
;
// 配置targetPackage名
private
static
String
targetPackage
;
// 目标包
private
static
String
targetPackage
;
// 目标包
/**
/**
...
@@ -45,7 +45,7 @@ public class ExampleTargetPlugin extends BasePlugin {
...
@@ -45,7 +45,7 @@ public class ExampleTargetPlugin extends BasePlugin {
public
boolean
validate
(
List
<
String
>
warnings
)
{
public
boolean
validate
(
List
<
String
>
warnings
)
{
// 获取配置的目标package
// 获取配置的目标package
Properties
properties
=
getProperties
();
Properties
properties
=
getProperties
();
this
.
targetPackage
=
properties
.
getProperty
(
TARGET_PACKAGE_KEY
);
this
.
targetPackage
=
properties
.
getProperty
(
PRO_TARGET_PACKAGE
);
if
(
this
.
targetPackage
==
null
){
if
(
this
.
targetPackage
==
null
){
warnings
.
add
(
"请配置com.itfsw.mybatis.generator.plugins.ExampleTargetPlugin插件的目标包名(targetPackage)!"
);
warnings
.
add
(
"请配置com.itfsw.mybatis.generator.plugins.ExampleTargetPlugin插件的目标包名(targetPackage)!"
);
return
false
;
return
false
;
...
...
src/main/java/com/itfsw/mybatis/generator/plugins/IncrementsPlugin.java
View file @
c485d7be
...
@@ -36,7 +36,7 @@ import java.util.List;
...
@@ -36,7 +36,7 @@ import java.util.List;
* ---------------------------------------------------------------------------
* ---------------------------------------------------------------------------
*/
*/
public
class
IncrementsPlugin
extends
BasePlugin
{
public
class
IncrementsPlugin
extends
BasePlugin
{
public
static
final
String
PR
E
_INCREMENTS_COLUMNS
=
"incrementsColumns"
;
// incrementsColumns property
public
static
final
String
PR
O
_INCREMENTS_COLUMNS
=
"incrementsColumns"
;
// incrementsColumns property
public
static
final
String
FIELD_INC_MAP
=
"incrementsColumnsInfoMap"
;
// 为了防止和用户数据库字段冲突,特殊命名
public
static
final
String
FIELD_INC_MAP
=
"incrementsColumnsInfoMap"
;
// 为了防止和用户数据库字段冲突,特殊命名
public
static
final
String
METHOD_INC_CHECK
=
"hasIncsForColumn"
;
// inc 检查方法名称
public
static
final
String
METHOD_INC_CHECK
=
"hasIncsForColumn"
;
// inc 检查方法名称
private
IncrementsPluginTools
incTools
;
// 增量插件工具
private
IncrementsPluginTools
incTools
;
// 增量插件工具
...
...
src/main/java/com/itfsw/mybatis/generator/plugins/LogicalDeletePlugin.java
View file @
c485d7be
...
@@ -43,9 +43,9 @@ public class LogicalDeletePlugin extends BasePlugin {
...
@@ -43,9 +43,9 @@ public class LogicalDeletePlugin extends BasePlugin {
public
static
final
String
METHOD_LOGICAL_DELETE_BY_EXAMPLE
=
"logicalDeleteByExample"
;
// 方法名
public
static
final
String
METHOD_LOGICAL_DELETE_BY_EXAMPLE
=
"logicalDeleteByExample"
;
// 方法名
public
static
final
String
METHOD_LOGICAL_DELETE_BY_PRIMARY_KEY
=
"logicalDeleteByPrimaryKey"
;
// 方法名
public
static
final
String
METHOD_LOGICAL_DELETE_BY_PRIMARY_KEY
=
"logicalDeleteByPrimaryKey"
;
// 方法名
public
static
final
String
LOGICAL_DELETE_COLUMN_KEY
=
"logicalDeleteColumn"
;
// 逻辑删除列-Key
public
static
final
String
PRO_LOGICAL_DELETE_COLUMN
=
"logicalDeleteColumn"
;
// 逻辑删除列-Key
public
static
final
String
LOGICAL_DELETE_VALUE_KEY
=
"logicalDeleteValue"
;
// 逻辑删除值-Key
public
static
final
String
PRO_LOGICAL_DELETE_VALUE
=
"logicalDeleteValue"
;
// 逻辑删除值-Key
public
static
final
String
LOGICAL_UN_DELETE_VALUE_KEY
=
"logicalUnDeleteValue"
;
// 逻辑删除未删除值-Key
public
static
final
String
PRO_LOGICAL_UN_DELETE_VALUE
=
"logicalUnDeleteValue"
;
// 逻辑删除未删除值-Key
public
static
final
String
DEL_FLAG_NAME
=
"DEL_FLAG_OFF"
;
// 逻辑删除标志位常量名称
public
static
final
String
DEL_FLAG_NAME
=
"DEL_FLAG_OFF"
;
// 逻辑删除标志位常量名称
public
static
final
String
UN_DEL_FLAG_NAME
=
"DEL_FLAG_ON"
;
// 逻辑删除标志位常量名称(未删除)
public
static
final
String
UN_DEL_FLAG_NAME
=
"DEL_FLAG_ON"
;
// 逻辑删除标志位常量名称(未删除)
...
@@ -67,18 +67,18 @@ public class LogicalDeletePlugin extends BasePlugin {
...
@@ -67,18 +67,18 @@ public class LogicalDeletePlugin extends BasePlugin {
public
void
initialized
(
IntrospectedTable
introspectedTable
)
{
public
void
initialized
(
IntrospectedTable
introspectedTable
)
{
// 1. 首先获取全局配置
// 1. 首先获取全局配置
Properties
properties
=
getProperties
();
Properties
properties
=
getProperties
();
String
logicalDeleteColumn
=
properties
.
getProperty
(
LOGICAL_DELETE_COLUMN_KEY
);
String
logicalDeleteColumn
=
properties
.
getProperty
(
PRO_LOGICAL_DELETE_COLUMN
);
this
.
logicalDeleteValue
=
properties
.
getProperty
(
LOGICAL_DELETE_VALUE_KEY
);
this
.
logicalDeleteValue
=
properties
.
getProperty
(
PRO_LOGICAL_DELETE_VALUE
);
this
.
logicalUnDeleteValue
=
properties
.
getProperty
(
LOGICAL_UN_DELETE_VALUE_KEY
);
this
.
logicalUnDeleteValue
=
properties
.
getProperty
(
PRO_LOGICAL_UN_DELETE_VALUE
);
// 2. 获取表单独配置,如果有则覆盖全局配置
// 2. 获取表单独配置,如果有则覆盖全局配置
if
(
introspectedTable
.
getTableConfigurationProperty
(
LOGICAL_DELETE_COLUMN_KEY
)
!=
null
){
if
(
introspectedTable
.
getTableConfigurationProperty
(
PRO_LOGICAL_DELETE_COLUMN
)
!=
null
){
logicalDeleteColumn
=
introspectedTable
.
getTableConfigurationProperty
(
LOGICAL_DELETE_COLUMN_KEY
);
logicalDeleteColumn
=
introspectedTable
.
getTableConfigurationProperty
(
PRO_LOGICAL_DELETE_COLUMN
);
}
}
if
(
introspectedTable
.
getTableConfigurationProperty
(
LOGICAL_DELETE_VALUE_KEY
)
!=
null
){
if
(
introspectedTable
.
getTableConfigurationProperty
(
PRO_LOGICAL_DELETE_VALUE
)
!=
null
){
this
.
logicalDeleteValue
=
introspectedTable
.
getTableConfigurationProperty
(
LOGICAL_DELETE_VALUE_KEY
);
this
.
logicalDeleteValue
=
introspectedTable
.
getTableConfigurationProperty
(
PRO_LOGICAL_DELETE_VALUE
);
}
}
if
(
introspectedTable
.
getTableConfigurationProperty
(
LOGICAL_UN_DELETE_VALUE_KEY
)
!=
null
){
if
(
introspectedTable
.
getTableConfigurationProperty
(
PRO_LOGICAL_UN_DELETE_VALUE
)
!=
null
){
this
.
logicalUnDeleteValue
=
introspectedTable
.
getTableConfigurationProperty
(
LOGICAL_UN_DELETE_VALUE_KEY
);
this
.
logicalUnDeleteValue
=
introspectedTable
.
getTableConfigurationProperty
(
PRO_LOGICAL_UN_DELETE_VALUE
);
}
}
// 3. 判断该表是否存在逻辑删除列
// 3. 判断该表是否存在逻辑删除列
this
.
logicalDeleteColumn
=
null
;
this
.
logicalDeleteColumn
=
null
;
...
@@ -105,13 +105,13 @@ public class LogicalDeletePlugin extends BasePlugin {
...
@@ -105,13 +105,13 @@ public class LogicalDeletePlugin extends BasePlugin {
||
JDBCType
.
VARCHAR
==
type
){
||
JDBCType
.
VARCHAR
==
type
){
this
.
logicalDeleteColumn
=
column
;
this
.
logicalDeleteColumn
=
column
;
}
else
{
}
else
{
warnings
.
add
(
"itfsw(逻辑删除插件):"
+
introspectedTable
.
getFullyQualifiedTable
()+
"逻辑删除列("
+
introspectedTable
.
getTableConfigurationProperty
(
LOGICAL_DELETE_COLUMN_KEY
)+
")的类型不在支持范围(请使用数字列,字符串列,布尔列)!"
);
warnings
.
add
(
"itfsw(逻辑删除插件):"
+
introspectedTable
.
getFullyQualifiedTable
()+
"逻辑删除列("
+
introspectedTable
.
getTableConfigurationProperty
(
PRO_LOGICAL_DELETE_COLUMN
)+
")的类型不在支持范围(请使用数字列,字符串列,布尔列)!"
);
}
}
}
}
}
}
if
(
introspectedTable
.
getTableConfigurationProperty
(
LOGICAL_DELETE_COLUMN_KEY
)
!=
null
&&
this
.
logicalDeleteColumn
==
null
){
if
(
introspectedTable
.
getTableConfigurationProperty
(
PRO_LOGICAL_DELETE_COLUMN
)
!=
null
&&
this
.
logicalDeleteColumn
==
null
){
warnings
.
add
(
"itfsw(逻辑删除插件):"
+
introspectedTable
.
getFullyQualifiedTable
()+
"没有找到您配置的逻辑删除列("
+
introspectedTable
.
getTableConfigurationProperty
(
LOGICAL_DELETE_COLUMN_KEY
)+
")!"
);
warnings
.
add
(
"itfsw(逻辑删除插件):"
+
introspectedTable
.
getFullyQualifiedTable
()+
"没有找到您配置的逻辑删除列("
+
introspectedTable
.
getTableConfigurationProperty
(
PRO_LOGICAL_DELETE_COLUMN
)+
")!"
);
}
}
// 4. 判断逻辑删除值是否配置了
// 4. 判断逻辑删除值是否配置了
...
...
src/main/java/com/itfsw/mybatis/generator/plugins/TablePrefixPlugin.java
View file @
c485d7be
...
@@ -33,7 +33,7 @@ import java.util.List;
...
@@ -33,7 +33,7 @@ import java.util.List;
*/
*/
public
class
TablePrefixPlugin
extends
BasePlugin
{
public
class
TablePrefixPlugin
extends
BasePlugin
{
public
static
final
String
PR
E
_PREFIX
=
"prefix"
;
// 前缀 property
public
static
final
String
PR
O
_PREFIX
=
"prefix"
;
// 前缀 property
private
String
prefix
;
// 前缀
private
String
prefix
;
// 前缀
/**
/**
...
@@ -62,14 +62,14 @@ public class TablePrefixPlugin extends BasePlugin {
...
@@ -62,14 +62,14 @@ public class TablePrefixPlugin extends BasePlugin {
@Override
@Override
public
void
initialized
(
IntrospectedTable
introspectedTable
)
{
public
void
initialized
(
IntrospectedTable
introspectedTable
)
{
// 1. 首先获取全局配置
// 1. 首先获取全局配置
this
.
prefix
=
getProperties
().
getProperty
(
PR
E
_PREFIX
);
this
.
prefix
=
getProperties
().
getProperty
(
PR
O
_PREFIX
);
// 2. 获取每个table 具体的
// 2. 获取每个table 具体的
if
(
introspectedTable
.
getTableConfigurationProperty
(
PR
E
_PREFIX
)
!=
null
)
{
if
(
introspectedTable
.
getTableConfigurationProperty
(
PR
O
_PREFIX
)
!=
null
)
{
this
.
prefix
=
introspectedTable
.
getTableConfigurationProperty
(
PR
E
_PREFIX
);
this
.
prefix
=
introspectedTable
.
getTableConfigurationProperty
(
PR
O
_PREFIX
);
}
}
// 3. 判断是否配置了前缀
// 3. 判断是否配置了前缀
// !!! TableRenamePlugin 插件的 tableOverride 优先级最高
// !!! TableRenamePlugin 插件的 tableOverride 优先级最高
if
(
this
.
prefix
!=
null
&&
introspectedTable
.
getTableConfigurationProperty
(
TableRenamePlugin
.
PR
E
_TABLE_OVERRIDE
)
==
null
)
{
if
(
this
.
prefix
!=
null
&&
introspectedTable
.
getTableConfigurationProperty
(
TableRenamePlugin
.
PR
O
_TABLE_OVERRIDE
)
==
null
)
{
String
domainObjectName
=
introspectedTable
.
getFullyQualifiedTable
().
getDomainObjectName
();
String
domainObjectName
=
introspectedTable
.
getFullyQualifiedTable
().
getDomainObjectName
();
domainObjectName
=
prefix
+
domainObjectName
;
domainObjectName
=
prefix
+
domainObjectName
;
try
{
try
{
...
...
src/main/java/com/itfsw/mybatis/generator/plugins/TableRenamePlugin.java
View file @
c485d7be
...
@@ -34,9 +34,9 @@ import java.util.regex.Pattern;
...
@@ -34,9 +34,9 @@ import java.util.regex.Pattern;
* ---------------------------------------------------------------------------
* ---------------------------------------------------------------------------
*/
*/
public
class
TableRenamePlugin
extends
BasePlugin
{
public
class
TableRenamePlugin
extends
BasePlugin
{
public
static
final
String
PR
E
_SEARCH_STRING
=
"searchString"
;
// 查找 property
public
static
final
String
PR
O
_SEARCH_STRING
=
"searchString"
;
// 查找 property
public
static
final
String
PR
E
_REPLACE_STRING
=
"replaceString"
;
// 替换 property
public
static
final
String
PR
O
_REPLACE_STRING
=
"replaceString"
;
// 替换 property
public
static
final
String
PR
E
_TABLE_OVERRIDE
=
"tableOverride"
;
// table 重命名 property
public
static
final
String
PR
O
_TABLE_OVERRIDE
=
"tableOverride"
;
// table 重命名 property
/**
/**
* {@inheritDoc}
* {@inheritDoc}
...
@@ -45,8 +45,8 @@ public class TableRenamePlugin extends BasePlugin {
...
@@ -45,8 +45,8 @@ public class TableRenamePlugin extends BasePlugin {
public
boolean
validate
(
List
<
String
>
warnings
)
{
public
boolean
validate
(
List
<
String
>
warnings
)
{
// 如果配置了searchString 或者 replaceString,二者不允许单独存在
// 如果配置了searchString 或者 replaceString,二者不允许单独存在
if
((
getProperties
().
getProperty
(
PR
E_SEARCH_STRING
)
==
null
&&
getProperties
().
getProperty
(
PRE
_REPLACE_STRING
)
!=
null
)
if
((
getProperties
().
getProperty
(
PR
O_SEARCH_STRING
)
==
null
&&
getProperties
().
getProperty
(
PRO
_REPLACE_STRING
)
!=
null
)
||
(
getProperties
().
getProperty
(
PR
E_SEARCH_STRING
)
!=
null
&&
getProperties
().
getProperty
(
PRE
_REPLACE_STRING
)
==
null
))
{
||
(
getProperties
().
getProperty
(
PR
O_SEARCH_STRING
)
!=
null
&&
getProperties
().
getProperty
(
PRO
_REPLACE_STRING
)
==
null
))
{
warnings
.
add
(
"itfsw:插件"
+
this
.
getClass
().
getTypeName
()
+
"插件的searchString、replaceString属性需配合使用,不能单独存在!"
);
warnings
.
add
(
"itfsw:插件"
+
this
.
getClass
().
getTypeName
()
+
"插件的searchString、replaceString属性需配合使用,不能单独存在!"
);
return
false
;
return
false
;
}
}
...
@@ -71,16 +71,16 @@ public class TableRenamePlugin extends BasePlugin {
...
@@ -71,16 +71,16 @@ public class TableRenamePlugin extends BasePlugin {
@Override
@Override
public
void
initialized
(
IntrospectedTable
introspectedTable
)
{
public
void
initialized
(
IntrospectedTable
introspectedTable
)
{
// 1. 获取表单独配置
// 1. 获取表单独配置
if
(
introspectedTable
.
getTableConfigurationProperty
(
PR
E
_TABLE_OVERRIDE
)
!=
null
)
{
if
(
introspectedTable
.
getTableConfigurationProperty
(
PR
O
_TABLE_OVERRIDE
)
!=
null
)
{
String
override
=
introspectedTable
.
getTableConfigurationProperty
(
PR
E
_TABLE_OVERRIDE
);
String
override
=
introspectedTable
.
getTableConfigurationProperty
(
PR
O
_TABLE_OVERRIDE
);
try
{
try
{
IntrospectedTableTools
.
setDomainObjectName
(
introspectedTable
,
getContext
(),
override
);
IntrospectedTableTools
.
setDomainObjectName
(
introspectedTable
,
getContext
(),
override
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"itfsw:插件"
+
this
.
getClass
().
getTypeName
()
+
"使用tableOverride替换时异常!"
,
e
);
logger
.
error
(
"itfsw:插件"
+
this
.
getClass
().
getTypeName
()
+
"使用tableOverride替换时异常!"
,
e
);
}
}
}
else
if
(
getProperties
().
getProperty
(
PR
E
_SEARCH_STRING
)
!=
null
)
{
}
else
if
(
getProperties
().
getProperty
(
PR
O
_SEARCH_STRING
)
!=
null
)
{
String
searchString
=
getProperties
().
getProperty
(
PR
E
_SEARCH_STRING
);
String
searchString
=
getProperties
().
getProperty
(
PR
O
_SEARCH_STRING
);
String
replaceString
=
getProperties
().
getProperty
(
PR
E
_REPLACE_STRING
);
String
replaceString
=
getProperties
().
getProperty
(
PR
O
_REPLACE_STRING
);
String
domainObjectName
=
introspectedTable
.
getFullyQualifiedTable
().
getDomainObjectName
();
String
domainObjectName
=
introspectedTable
.
getFullyQualifiedTable
().
getDomainObjectName
();
Pattern
pattern
=
Pattern
.
compile
(
searchString
);
Pattern
pattern
=
Pattern
.
compile
(
searchString
);
...
...
src/main/java/com/itfsw/mybatis/generator/plugins/UpsertPlugin.java
View file @
c485d7be
...
@@ -46,7 +46,7 @@ public class UpsertPlugin extends BasePlugin {
...
@@ -46,7 +46,7 @@ public class UpsertPlugin extends BasePlugin {
public
static
final
String
METHOD_UPSERT_BY_EXAMPLE_SELECTIVE
=
"upsertByExampleSelective"
;
// 方法名
public
static
final
String
METHOD_UPSERT_BY_EXAMPLE_SELECTIVE
=
"upsertByExampleSelective"
;
// 方法名
public
static
final
String
PR
E
_ALLOW_MULTI_QUERIES
=
"allowMultiQueries"
;
// property allowMultiQueries
public
static
final
String
PR
O
_ALLOW_MULTI_QUERIES
=
"allowMultiQueries"
;
// property allowMultiQueries
private
boolean
allowMultiQueries
=
false
;
// 是否允许多sql提交
private
boolean
allowMultiQueries
=
false
;
// 是否允许多sql提交
/**
/**
...
@@ -63,7 +63,7 @@ public class UpsertPlugin extends BasePlugin {
...
@@ -63,7 +63,7 @@ public class UpsertPlugin extends BasePlugin {
// 插件是否开启了多sql提交
// 插件是否开启了多sql提交
Properties
properties
=
this
.
getProperties
();
Properties
properties
=
this
.
getProperties
();
String
allowMultiQueries
=
properties
.
getProperty
(
PR
E
_ALLOW_MULTI_QUERIES
);
String
allowMultiQueries
=
properties
.
getProperty
(
PR
O
_ALLOW_MULTI_QUERIES
);
this
.
allowMultiQueries
=
allowMultiQueries
==
null
?
false
:
StringUtility
.
isTrue
(
allowMultiQueries
);
this
.
allowMultiQueries
=
allowMultiQueries
==
null
?
false
:
StringUtility
.
isTrue
(
allowMultiQueries
);
if
(
this
.
allowMultiQueries
)
{
if
(
this
.
allowMultiQueries
)
{
// 提示用户注意信息
// 提示用户注意信息
...
...
src/main/java/com/itfsw/mybatis/generator/plugins/utils/BasePlugin.java
View file @
c485d7be
...
@@ -56,7 +56,7 @@ public class BasePlugin extends PluginAdapter {
...
@@ -56,7 +56,7 @@ public class BasePlugin extends PluginAdapter {
// 配置插件使用的模板引擎
// 配置插件使用的模板引擎
PluginConfiguration
cfg
=
PluginTools
.
getPluginConfiguration
(
context
,
CommentPlugin
.
class
);
PluginConfiguration
cfg
=
PluginTools
.
getPluginConfiguration
(
context
,
CommentPlugin
.
class
);
if
(
cfg
==
null
||
cfg
.
getProperty
(
CommentPlugin
.
PR
E
_TEMPLATE
)
==
null
){
if
(
cfg
==
null
||
cfg
.
getProperty
(
CommentPlugin
.
PR
O
_TEMPLATE
)
==
null
){
if
(
context
.
getCommentGenerator
()
instanceof
DefaultCommentGenerator
){
if
(
context
.
getCommentGenerator
()
instanceof
DefaultCommentGenerator
){
// 使用默认模板引擎
// 使用默认模板引擎
commentGenerator
=
new
TemplateCommentGenerator
(
"default-comment.ftl"
,
true
);
commentGenerator
=
new
TemplateCommentGenerator
(
"default-comment.ftl"
,
true
);
...
@@ -65,7 +65,7 @@ public class BasePlugin extends PluginAdapter {
...
@@ -65,7 +65,7 @@ public class BasePlugin extends PluginAdapter {
commentGenerator
=
context
.
getCommentGenerator
();
commentGenerator
=
context
.
getCommentGenerator
();
}
}
}
else
{
}
else
{
TemplateCommentGenerator
templateCommentGenerator
=
new
TemplateCommentGenerator
(
cfg
.
getProperty
(
CommentPlugin
.
PR
E
_TEMPLATE
),
false
);
TemplateCommentGenerator
templateCommentGenerator
=
new
TemplateCommentGenerator
(
cfg
.
getProperty
(
CommentPlugin
.
PR
O
_TEMPLATE
),
false
);
// ITFSW 插件使用的注释生成器
// ITFSW 插件使用的注释生成器
commentGenerator
=
templateCommentGenerator
;
commentGenerator
=
templateCommentGenerator
;
...
...
src/main/java/com/itfsw/mybatis/generator/plugins/utils/IncrementsPluginTools.java
View file @
c485d7be
...
@@ -69,7 +69,7 @@ public class IncrementsPluginTools {
...
@@ -69,7 +69,7 @@ public class IncrementsPluginTools {
IncrementsPluginTools
tools
=
new
IncrementsPluginTools
(
context
,
introspectedTable
);
IncrementsPluginTools
tools
=
new
IncrementsPluginTools
(
context
,
introspectedTable
);
// 判断是否启用了插件
// 判断是否启用了插件
if
(
PluginTools
.
getPluginConfiguration
(
context
,
IncrementsPlugin
.
class
)
!=
null
)
{
if
(
PluginTools
.
getPluginConfiguration
(
context
,
IncrementsPlugin
.
class
)
!=
null
)
{
String
incrementsColumns
=
introspectedTable
.
getTableConfigurationProperty
(
IncrementsPlugin
.
PR
E
_INCREMENTS_COLUMNS
);
String
incrementsColumns
=
introspectedTable
.
getTableConfigurationProperty
(
IncrementsPlugin
.
PR
O
_INCREMENTS_COLUMNS
);
if
(
StringUtility
.
stringHasValue
(
incrementsColumns
))
{
if
(
StringUtility
.
stringHasValue
(
incrementsColumns
))
{
// 切分
// 切分
String
[]
incrementsColumnsStrs
=
incrementsColumns
.
split
(
","
);
String
[]
incrementsColumnsStrs
=
incrementsColumns
.
split
(
","
);
...
...
src/main/java/com/itfsw/mybatis/generator/plugins/utils/IntrospectedTableTools.java
View file @
c485d7be
...
@@ -71,12 +71,12 @@ public class IntrospectedTableTools {
...
@@ -71,12 +71,12 @@ public class IntrospectedTableTools {
// 注意!! 如果配置了ExampleTargetPlugin插件,要修正Example 位置
// 注意!! 如果配置了ExampleTargetPlugin插件,要修正Example 位置
PluginConfiguration
configuration
=
PluginTools
.
getPluginConfiguration
(
context
,
ExampleTargetPlugin
.
class
);
PluginConfiguration
configuration
=
PluginTools
.
getPluginConfiguration
(
context
,
ExampleTargetPlugin
.
class
);
if
(
configuration
!=
null
&&
configuration
.
getProperty
(
ExampleTargetPlugin
.
TARGET_PACKAGE_KEY
)
!=
null
)
{
if
(
configuration
!=
null
&&
configuration
.
getProperty
(
ExampleTargetPlugin
.
PRO_TARGET_PACKAGE
)
!=
null
)
{
String
exampleType
=
introspectedTable
.
getExampleType
();
String
exampleType
=
introspectedTable
.
getExampleType
();
// 修改包名
// 修改包名
JavaModelGeneratorConfiguration
javaModelGeneratorConfiguration
=
context
.
getJavaModelGeneratorConfiguration
();
JavaModelGeneratorConfiguration
javaModelGeneratorConfiguration
=
context
.
getJavaModelGeneratorConfiguration
();
String
targetPackage
=
javaModelGeneratorConfiguration
.
getTargetPackage
();
String
targetPackage
=
javaModelGeneratorConfiguration
.
getTargetPackage
();
String
newExampleType
=
exampleType
.
replace
(
targetPackage
,
configuration
.
getProperty
(
ExampleTargetPlugin
.
TARGET_PACKAGE_KEY
));
String
newExampleType
=
exampleType
.
replace
(
targetPackage
,
configuration
.
getProperty
(
ExampleTargetPlugin
.
PRO_TARGET_PACKAGE
));
introspectedTable
.
setExampleType
(
newExampleType
);
introspectedTable
.
setExampleType
(
newExampleType
);
}
}
...
...
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