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
edccee50
Commit
edccee50
authored
Oct 30, 2018
by
hewei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Lombok插件测试用例
parent
3df69f4b
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
528 additions
and
63 deletions
+528
-63
src/main/java/com/itfsw/mybatis/generator/plugins/LombokPlugin.java
...ava/com/itfsw/mybatis/generator/plugins/LombokPlugin.java
+57
-22
src/test/java/com/itfsw/mybatis/generator/plugins/LombokPluginTest.java
...com/itfsw/mybatis/generator/plugins/LombokPluginTest.java
+256
-8
src/test/resources/scripts/LombokPlugin/init.sql
src/test/resources/scripts/LombokPlugin/init.sql
+25
-31
src/test/resources/scripts/LombokPlugin/mybatis-generator-builder.xml
...ources/scripts/LombokPlugin/mybatis-generator-builder.xml
+48
-0
src/test/resources/scripts/LombokPlugin/mybatis-generator-constructor.xml
...es/scripts/LombokPlugin/mybatis-generator-constructor.xml
+48
-0
src/test/resources/scripts/LombokPlugin/mybatis-generator-data.xml
...resources/scripts/LombokPlugin/mybatis-generator-data.xml
+45
-0
src/test/resources/scripts/LombokPlugin/mybatis-generator-default.xml
...ources/scripts/LombokPlugin/mybatis-generator-default.xml
+48
-0
src/test/resources/scripts/LombokPlugin/mybatis-generator.xml
...test/resources/scripts/LombokPlugin/mybatis-generator.xml
+1
-2
No files found.
src/main/java/com/itfsw/mybatis/generator/plugins/LombokPlugin.java
View file @
edccee50
...
...
@@ -73,21 +73,26 @@ public class LombokPlugin extends BasePlugin {
public
boolean
modelBaseRecordClassGenerated
(
TopLevelClass
topLevelClass
,
IntrospectedTable
introspectedTable
)
{
// @Data
this
.
addAnnotations
(
topLevelClass
,
EnumLombokAnnotations
.
DATA
);
if
(
topLevelClass
.
getSuperClass
()
!=
null
){
if
(
topLevelClass
.
getSuperClass
()
!=
null
)
{
this
.
addAnnotations
(
topLevelClass
,
EnumLombokAnnotations
.
EQUALS_AND_HASH_CODE_CALL_SUPER
);
this
.
addAnnotations
(
topLevelClass
,
EnumLombokAnnotations
.
TO_STRING_CALL_SUPER
);
}
// @Builder
if
(
this
.
hasBuilder
){
if
(
introspectedTable
.
getRules
().
generateRecordWithBLOBsClass
()
||
introspectedTable
.
getRules
().
generatePrimaryKeyClass
()){
if
(
this
.
hasBuilder
)
{
// 有子类或者父类
if
(
introspectedTable
.
getRules
().
generateRecordWithBLOBsClass
()
||
introspectedTable
.
getRules
().
generatePrimaryKeyClass
()
||
topLevelClass
.
getSuperClass
()
!=
null
)
{
this
.
addAnnotations
(
topLevelClass
,
EnumLombokAnnotations
.
SUPER_BUILDER
);
}
else
{
this
.
addAnnotations
(
topLevelClass
,
EnumLombokAnnotations
.
BUILDER
);
}
}
if
(
this
.
hasNoArgsConstructor
){
// @Constructor
if
(
this
.
hasNoArgsConstructor
)
{
this
.
addAnnotations
(
topLevelClass
,
EnumLombokAnnotations
.
NO_ARGS_CONSTRUCTOR
);
}
if
(
this
.
hasAllArgsConstructor
){
if
(
this
.
hasAllArgsConstructor
)
{
this
.
addAnnotations
(
topLevelClass
,
EnumLombokAnnotations
.
ALL_ARGS_CONSTRUCTOR
);
}
return
super
.
modelBaseRecordClassGenerated
(
topLevelClass
,
introspectedTable
);
...
...
@@ -103,19 +108,26 @@ public class LombokPlugin extends BasePlugin {
public
boolean
modelPrimaryKeyClassGenerated
(
TopLevelClass
topLevelClass
,
IntrospectedTable
introspectedTable
)
{
// @Data
this
.
addAnnotations
(
topLevelClass
,
EnumLombokAnnotations
.
DATA
);
if
(
topLevelClass
.
getSuperClass
()
!=
null
)
{
this
.
addAnnotations
(
topLevelClass
,
EnumLombokAnnotations
.
EQUALS_AND_HASH_CODE_CALL_SUPER
);
this
.
addAnnotations
(
topLevelClass
,
EnumLombokAnnotations
.
TO_STRING_CALL_SUPER
);
}
// @Builder
if
(
this
.
hasBuilder
){
if
(
introspectedTable
.
getRules
().
generateRecordWithBLOBsClass
()
||
introspectedTable
.
getRules
().
generateBaseRecordClass
()){
if
(
this
.
hasBuilder
)
{
// 有子类或者父类
if
(
introspectedTable
.
getRules
().
generateRecordWithBLOBsClass
()
||
introspectedTable
.
getRules
().
generateBaseRecordClass
()
||
topLevelClass
.
getSuperClass
()
!=
null
)
{
this
.
addAnnotations
(
topLevelClass
,
EnumLombokAnnotations
.
SUPER_BUILDER
);
}
else
{
this
.
addAnnotations
(
topLevelClass
,
EnumLombokAnnotations
.
BUILDER
);
}
}
if
(
this
.
hasNoArgsConstructor
){
// @Constructor
if
(
this
.
hasNoArgsConstructor
)
{
this
.
addAnnotations
(
topLevelClass
,
EnumLombokAnnotations
.
NO_ARGS_CONSTRUCTOR
);
}
if
(
this
.
hasAllArgsConstructor
){
if
(
this
.
hasAllArgsConstructor
)
{
this
.
addAnnotations
(
topLevelClass
,
EnumLombokAnnotations
.
ALL_ARGS_CONSTRUCTOR
);
}
return
super
.
modelPrimaryKeyClassGenerated
(
topLevelClass
,
introspectedTable
);
...
...
@@ -131,22 +143,26 @@ public class LombokPlugin extends BasePlugin {
public
boolean
modelRecordWithBLOBsClassGenerated
(
TopLevelClass
topLevelClass
,
IntrospectedTable
introspectedTable
)
{
// @Data
this
.
addAnnotations
(
topLevelClass
,
EnumLombokAnnotations
.
DATA
);
if
(
topLevelClass
.
getSuperClass
()
!=
null
){
if
(
topLevelClass
.
getSuperClass
()
!=
null
)
{
this
.
addAnnotations
(
topLevelClass
,
EnumLombokAnnotations
.
EQUALS_AND_HASH_CODE_CALL_SUPER
);
this
.
addAnnotations
(
topLevelClass
,
EnumLombokAnnotations
.
TO_STRING_CALL_SUPER
);
}
// @Builder
if
(
this
.
hasBuilder
){
if
(
introspectedTable
.
getRules
().
generateBaseRecordClass
()
||
introspectedTable
.
getRules
().
generatePrimaryKeyClass
()){
if
(
this
.
hasBuilder
)
{
// 有子类或者父类
if
(
introspectedTable
.
getRules
().
generateBaseRecordClass
()
||
introspectedTable
.
getRules
().
generatePrimaryKeyClass
()
||
topLevelClass
.
getSuperClass
()
!=
null
)
{
this
.
addAnnotations
(
topLevelClass
,
EnumLombokAnnotations
.
SUPER_BUILDER
);
}
else
{
this
.
addAnnotations
(
topLevelClass
,
EnumLombokAnnotations
.
BUILDER
);
}
}
if
(
this
.
hasNoArgsConstructor
){
// @Constructor
if
(
this
.
hasNoArgsConstructor
)
{
this
.
addAnnotations
(
topLevelClass
,
EnumLombokAnnotations
.
NO_ARGS_CONSTRUCTOR
);
}
if
(
this
.
hasAllArgsConstructor
){
if
(
this
.
hasAllArgsConstructor
)
{
this
.
addAnnotations
(
topLevelClass
,
EnumLombokAnnotations
.
ALL_ARGS_CONSTRUCTOR
);
}
return
super
.
modelRecordWithBLOBsClassGenerated
(
topLevelClass
,
introspectedTable
);
...
...
@@ -185,28 +201,47 @@ public class LombokPlugin extends BasePlugin {
* @param topLevelClass
* @param annotations
*/
private
void
addAnnotations
(
TopLevelClass
topLevelClass
,
EnumLombokAnnotations
annotations
){
topLevelClass
.
addImportedType
(
annotations
.
clazz
);
topLevelClass
.
addAnnotation
(
annotations
.
annotations
);
private
void
addAnnotations
(
TopLevelClass
topLevelClass
,
EnumLombokAnnotations
annotations
)
{
topLevelClass
.
addImportedType
(
annotations
.
getClazz
()
);
topLevelClass
.
addAnnotation
(
annotations
.
getAnnotation
()
);
}
/**
* lombok 类型
*/
public
static
enum
EnumLombokAnnotations
{
public
enum
EnumLombokAnnotations
{
DATA
(
"@Data"
,
"lombok.Data"
),
BUILDER
(
"@Builder"
,
"lombok.Builder"
),
SUPER_BUILDER
(
"@SuperBuilder"
,
"lombok.experimental.SuperBuilder"
),
ALL_ARGS_CONSTRUCTOR
(
"@AllArgsConstructor"
,
"lombok.AllArgsConstructor"
),
NO_ARGS_CONSTRUCTOR
(
"@NoArgsConstructor"
,
"lombok.NoArgsConstructor"
),
EQUALS_AND_HASH_CODE_CALL_SUPER
(
"@EqualsAndHashCode(callSuper = true)"
,
"lombok.EqualsAndHashCode"
),
NO_ARGS_CONSTRUCTOR
(
"@NoArgsConstructor"
,
"lombok.NoArgsConstructor
"
);
TO_STRING_CALL_SUPER
(
"@ToString(callSuper = true)"
,
"lombok.ToString
"
);
private
final
String
annotation
s
;
private
final
String
annotation
;
private
final
String
clazz
;
EnumLombokAnnotations
(
String
annotation
s
,
String
clazz
)
{
this
.
annotation
s
=
annotations
;
EnumLombokAnnotations
(
String
annotation
,
String
clazz
)
{
this
.
annotation
=
annotation
;
this
.
clazz
=
clazz
;
}
/**
* Getter method for property <tt>annotation</tt>.
* @return property value of annotation
* @author hewei
*/
public
String
getAnnotation
()
{
return
annotation
;
}
/**
* Getter method for property <tt>clazz</tt>.
* @return property value of clazz
* @author hewei
*/
public
String
getClazz
()
{
return
clazz
;
}
}
}
src/test/java/com/itfsw/mybatis/generator/plugins/LombokPluginTest.java
View file @
edccee50
This diff is collapsed.
Click to expand it.
src/test/resources/scripts/LombokPlugin/init.sql
View file @
edccee50
...
...
@@ -29,28 +29,6 @@ CREATE TABLE `tb` (
-- ----------------------------
-- Records of tb
-- ----------------------------
INSERT
INTO
`tb`
VALUES
(
'1'
,
'fd1'
,
null
);
INSERT
INTO
`tb`
VALUES
(
'2'
,
null
,
'2'
);
INSERT
INTO
`tb`
VALUES
(
'3'
,
'fd3'
,
'3'
);
-- ----------------------------
-- Table structure for tb_blobs
-- ----------------------------
DROP
TABLE
IF
EXISTS
`tb_blobs`
;
CREATE
TABLE
`tb_blobs`
(
`id`
bigint
(
20
)
NOT
NULL
COMMENT
'注释1'
,
`field1`
varchar
(
255
)
DEFAULT
NULL
,
`field2`
longtext
COMMENT
'注释2'
,
`field3`
longtext
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
MyISAM
DEFAULT
CHARSET
=
utf8
;
-- ----------------------------
-- Records of tb_blobs
-- ----------------------------
INSERT
INTO
`tb_blobs`
VALUES
(
'1'
,
'fd1'
,
null
,
'KK1'
);
INSERT
INTO
`tb_blobs`
VALUES
(
'2'
,
null
,
'2'
,
null
);
INSERT
INTO
`tb_blobs`
VALUES
(
'3'
,
'fd3'
,
'3'
,
'KK3'
);
-- ----------------------------
-- Table structure for tb_keys
...
...
@@ -67,21 +45,37 @@ CREATE TABLE `tb_keys` (
-- ----------------------------
-- Records of tb_keys
-- ----------------------------
INSERT
INTO
`tb_keys`
VALUES
(
'1'
,
'2'
,
'fd1'
,
null
);
INSERT
INTO
`tb_keys`
VALUES
(
'2'
,
'3'
,
null
,
'2'
);
INSERT
INTO
`tb_keys`
VALUES
(
'3'
,
'4'
,
'fd2'
,
'3'
);
-- ----------------------------
-- Table structure for tb_
single
_blob
-- Table structure for tb_
key
_blob
-- ----------------------------
DROP
TABLE
IF
EXISTS
`tb_
single
_blob`
;
CREATE
TABLE
`tb_
single
_blob`
(
DROP
TABLE
IF
EXISTS
`tb_
key
_blob`
;
CREATE
TABLE
`tb_
key
_blob`
(
`id`
bigint
(
20
)
NOT
NULL
COMMENT
'注释1'
,
`key1`
varchar
(
20
)
NOT
NULL
,
`field1`
longtext
COMMENT
'注释2'
,
`field2`
int
(
11
)
DEFAULT
NULL
,
PRIMARY
KEY
(
`id`
)
`field2`
longtext
,
PRIMARY
KEY
(
`id`
,
`key1`
)
)
ENGINE
=
MyISAM
DEFAULT
CHARSET
=
utf8
;
-- ----------------------------
-- Records of tb_key_blob
-- ----------------------------
-- ----------------------------
-- Table structure for tb_lombok
-- ----------------------------
DROP
TABLE
IF
EXISTS
`tb_lombok`
;
CREATE
TABLE
`tb_lombok`
(
`id`
bigint
(
20
)
NOT
NULL
COMMENT
'注释1'
,
`key1`
varchar
(
20
)
NOT
NULL
,
`field1`
varchar
(
10
)
COMMENT
'注释2'
,
`is_find`
tinyint
(
1
),
`field3`
longtext
,
`field4`
longtext
,
PRIMARY
KEY
(
`id`
,
`key1`
)
)
ENGINE
=
MyISAM
DEFAULT
CHARSET
=
utf8
;
-- ----------------------------
-- Records of tb_
single_blob
-- Records of tb_
lombok
-- ----------------------------
\ No newline at end of file
src/test/resources/scripts/LombokPlugin/mybatis-generator-builder.xml
0 → 100644
View file @
edccee50
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2018.
~
~ 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.
-->
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<properties
resource=
"db.properties"
/>
<!--导入属性配置 -->
<context
id=
"default"
targetRuntime=
"MyBatis3"
>
<!-- 插件 -->
<plugin
type=
"com.itfsw.mybatis.generator.plugins.LombokPlugin"
>
<property
name=
"@Builder"
value=
"true"
/>
</plugin>
<!--jdbc的数据库连接 -->
<jdbcConnection
driverClass=
"${driver}"
connectionURL=
"${url}"
userId=
"${username}"
password=
"${password}"
/>
<!-- Model模型生成器,用来生成含有主键key的类,记录类 以及查询Example类
targetPackage 指定生成的model生成所在的包名
targetProject 指定在该项目下所在的路径 -->
<javaModelGenerator
targetPackage=
""
targetProject=
""
/>
<!--Mapper映射文件生成所在的目录 为每一个数据库的表生成对应的SqlMap文件 -->
<sqlMapGenerator
targetPackage=
""
targetProject=
""
/>
<!-- 客户端代码,生成易于使用的针对Model对象和XML配置文件 的代码
type="ANNOTATEDMAPPER",生成Java Model 和基于注解的Mapper对象
type="MIXEDMAPPER",生成基于注解的Java Model 和相应的Mapper对象
type="XMLMAPPER",生成SQLMap XML文件和独立的Mapper接口 -->
<javaClientGenerator
targetPackage=
""
targetProject=
""
type=
"XMLMAPPER"
/>
<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 要自动生成的表 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<table
tableName=
"tb"
/>
<table
tableName=
"tb_lombok"
/>
</context>
</generatorConfiguration>
\ No newline at end of file
src/test/resources/scripts/LombokPlugin/mybatis-generator-constructor.xml
0 → 100644
View file @
edccee50
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2018.
~
~ 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.
-->
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<properties
resource=
"db.properties"
/>
<!--导入属性配置 -->
<context
id=
"default"
targetRuntime=
"MyBatis3"
>
<!-- 插件 -->
<plugin
type=
"com.itfsw.mybatis.generator.plugins.LombokPlugin"
>
<property
name=
"@NoArgsConstructor"
value=
"true"
/>
<property
name=
"@AllArgsConstructor"
value=
"true"
/>
</plugin>
<!--jdbc的数据库连接 -->
<jdbcConnection
driverClass=
"${driver}"
connectionURL=
"${url}"
userId=
"${username}"
password=
"${password}"
/>
<!-- Model模型生成器,用来生成含有主键key的类,记录类 以及查询Example类
targetPackage 指定生成的model生成所在的包名
targetProject 指定在该项目下所在的路径 -->
<javaModelGenerator
targetPackage=
""
targetProject=
""
/>
<!--Mapper映射文件生成所在的目录 为每一个数据库的表生成对应的SqlMap文件 -->
<sqlMapGenerator
targetPackage=
""
targetProject=
""
/>
<!-- 客户端代码,生成易于使用的针对Model对象和XML配置文件 的代码
type="ANNOTATEDMAPPER",生成Java Model 和基于注解的Mapper对象
type="MIXEDMAPPER",生成基于注解的Java Model 和相应的Mapper对象
type="XMLMAPPER",生成SQLMap XML文件和独立的Mapper接口 -->
<javaClientGenerator
targetPackage=
""
targetProject=
""
type=
"XMLMAPPER"
/>
<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 要自动生成的表 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<table
tableName=
"tb_lombok"
/>
</context>
</generatorConfiguration>
\ No newline at end of file
src/test/resources/scripts/LombokPlugin/mybatis-generator-data.xml
0 → 100644
View file @
edccee50
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2018.
~
~ 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.
-->
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<properties
resource=
"db.properties"
/>
<!--导入属性配置 -->
<context
id=
"default"
targetRuntime=
"MyBatis3"
>
<!-- 插件 -->
<plugin
type=
"com.itfsw.mybatis.generator.plugins.LombokPlugin"
/>
<!--jdbc的数据库连接 -->
<jdbcConnection
driverClass=
"${driver}"
connectionURL=
"${url}"
userId=
"${username}"
password=
"${password}"
/>
<!-- Model模型生成器,用来生成含有主键key的类,记录类 以及查询Example类
targetPackage 指定生成的model生成所在的包名
targetProject 指定在该项目下所在的路径 -->
<javaModelGenerator
targetPackage=
""
targetProject=
""
/>
<!--Mapper映射文件生成所在的目录 为每一个数据库的表生成对应的SqlMap文件 -->
<sqlMapGenerator
targetPackage=
""
targetProject=
""
/>
<!-- 客户端代码,生成易于使用的针对Model对象和XML配置文件 的代码
type="ANNOTATEDMAPPER",生成Java Model 和基于注解的Mapper对象
type="MIXEDMAPPER",生成基于注解的Java Model 和相应的Mapper对象
type="XMLMAPPER",生成SQLMap XML文件和独立的Mapper接口 -->
<javaClientGenerator
targetPackage=
""
targetProject=
""
type=
"XMLMAPPER"
/>
<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 要自动生成的表 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<table
tableName=
"tb_lombok"
/>
</context>
</generatorConfiguration>
\ No newline at end of file
src/test/resources/scripts/LombokPlugin/mybatis-generator-default.xml
0 → 100644
View file @
edccee50
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2018.
~
~ 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.
-->
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<properties
resource=
"db.properties"
/>
<!--导入属性配置 -->
<context
id=
"default"
targetRuntime=
"MyBatis3"
>
<!-- 插件 -->
<plugin
type=
"com.itfsw.mybatis.generator.plugins.LombokPlugin"
/>
<!--jdbc的数据库连接 -->
<jdbcConnection
driverClass=
"${driver}"
connectionURL=
"${url}"
userId=
"${username}"
password=
"${password}"
/>
<!-- Model模型生成器,用来生成含有主键key的类,记录类 以及查询Example类
targetPackage 指定生成的model生成所在的包名
targetProject 指定在该项目下所在的路径 -->
<javaModelGenerator
targetPackage=
""
targetProject=
""
>
<property
name=
"constructorBased"
value=
"true"
/>
</javaModelGenerator>
<!--Mapper映射文件生成所在的目录 为每一个数据库的表生成对应的SqlMap文件 -->
<sqlMapGenerator
targetPackage=
""
targetProject=
""
/>
<!-- 客户端代码,生成易于使用的针对Model对象和XML配置文件 的代码
type="ANNOTATEDMAPPER",生成Java Model 和基于注解的Mapper对象
type="MIXEDMAPPER",生成基于注解的Java Model 和相应的Mapper对象
type="XMLMAPPER",生成SQLMap XML文件和独立的Mapper接口 -->
<javaClientGenerator
targetPackage=
""
targetProject=
""
type=
"XMLMAPPER"
/>
<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 要自动生成的表 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<table
tableName=
"tb"
/>
<table
tableName=
"tb_key_blob"
/>
</context>
</generatorConfiguration>
\ No newline at end of file
src/test/resources/scripts/LombokPlugin/mybatis-generator.xml
View file @
edccee50
...
...
@@ -46,7 +46,6 @@
<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 要自动生成的表 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<table
tableName=
"tb"
/>
<table
tableName=
"tb_keys"
/>
<table
tableName=
"tb_single_blob"
/>
<table
tableName=
"tb_blobs"
/>
<table
tableName=
"tb_key_blob"
/>
</context>
</generatorConfiguration>
\ No newline at end of file
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