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
5e3e9880
Commit
5e3e9880
authored
Jun 28, 2017
by
hewei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
<package name="xxx"/>时xml必须和Mapper.java在同一目录下
parent
e1bf5266
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
148 additions
and
33 deletions
+148
-33
src/test/java/com/itfsw/mybatis/generator/plugins/BatchInsertPluginTest.java
...tfsw/mybatis/generator/plugins/BatchInsertPluginTest.java
+74
-10
src/test/java/com/itfsw/mybatis/generator/plugins/tools/AbstractShellCallback.java
...ybatis/generator/plugins/tools/AbstractShellCallback.java
+69
-18
src/test/resources/scripts/BatchInsertPlugin/mybatis-generator-with-error-driver.xml
...BatchInsertPlugin/mybatis-generator-with-error-driver.xml
+1
-1
src/test/resources/scripts/BatchInsertPlugin/mybatis-generator-without-model-column-plugin.xml
...tPlugin/mybatis-generator-without-model-column-plugin.xml
+1
-1
src/test/resources/scripts/BatchInsertPlugin/mybatis-generator.xml
...resources/scripts/BatchInsertPlugin/mybatis-generator.xml
+1
-1
src/test/resources/scripts/ExampleTargetPlugin/mybatis-generator-without-plugin.xml
.../ExampleTargetPlugin/mybatis-generator-without-plugin.xml
+1
-1
src/test/resources/scripts/ExampleTargetPlugin/mybatis-generator.xml
...sources/scripts/ExampleTargetPlugin/mybatis-generator.xml
+1
-1
No files found.
src/test/java/com/itfsw/mybatis/generator/plugins/BatchInsertPluginTest.java
View file @
5e3e9880
...
@@ -18,8 +18,10 @@ package com.itfsw.mybatis.generator.plugins;
...
@@ -18,8 +18,10 @@ package com.itfsw.mybatis.generator.plugins;
import
com.itfsw.mybatis.generator.plugins.tools.AbstractShellCallback
;
import
com.itfsw.mybatis.generator.plugins.tools.AbstractShellCallback
;
import
com.itfsw.mybatis.generator.plugins.tools.DBHelper
;
import
com.itfsw.mybatis.generator.plugins.tools.DBHelper
;
import
com.itfsw.mybatis.generator.plugins.tools.SqlHelper
;
import
com.itfsw.mybatis.generator.plugins.tools.Util
;
import
com.itfsw.mybatis.generator.plugins.tools.Util
;
import
org.apache.ibatis.io.Resources
;
import
org.apache.ibatis.io.Resources
;
import
org.apache.ibatis.session.SqlSession
;
import
org.junit.AfterClass
;
import
org.junit.AfterClass
;
import
org.junit.Assert
;
import
org.junit.Assert
;
import
org.junit.Before
;
import
org.junit.Before
;
...
@@ -58,9 +60,17 @@ public class BatchInsertPluginTest {
...
@@ -58,9 +60,17 @@ public class BatchInsertPluginTest {
helper
=
DBHelper
.
getHelper
(
"scripts/BatchInsertPlugin/init.sql"
);
helper
=
DBHelper
.
getHelper
(
"scripts/BatchInsertPlugin/init.sql"
);
}
}
/**
* 测试插件依赖
* @throws IOException
* @throws XMLParserException
* @throws InvalidConfigurationException
* @throws SQLException
* @throws InterruptedException
*/
@Test
@Test
public
void
testWarnings1
()
throws
IOException
,
XMLParserException
,
InvalidConfigurationException
,
SQLException
,
InterruptedException
{
public
void
testWarnings1
()
throws
IOException
,
XMLParserException
,
InvalidConfigurationException
,
SQLException
,
InterruptedException
{
List
<
String
>
warnings
=
new
ArrayList
<
String
>();
List
<
String
>
warnings
=
new
ArrayList
<>();
ConfigurationParser
cp
=
new
ConfigurationParser
(
warnings
);
ConfigurationParser
cp
=
new
ConfigurationParser
(
warnings
);
Configuration
config
=
cp
.
parseConfiguration
(
Resources
.
getResourceAsStream
(
"scripts/BatchInsertPlugin/mybatis-generator-without-model-column-plugin.xml"
));
Configuration
config
=
cp
.
parseConfiguration
(
Resources
.
getResourceAsStream
(
"scripts/BatchInsertPlugin/mybatis-generator-without-model-column-plugin.xml"
));
...
@@ -72,9 +82,17 @@ public class BatchInsertPluginTest {
...
@@ -72,9 +82,17 @@ public class BatchInsertPluginTest {
Assert
.
assertEquals
(
warnings
.
get
(
0
),
"itfsw:插件com.itfsw.mybatis.generator.plugins.BatchInsertPlugin插件需配合com.itfsw.mybatis.generator.plugins.ModelColumnPlugin插件使用!"
);
Assert
.
assertEquals
(
warnings
.
get
(
0
),
"itfsw:插件com.itfsw.mybatis.generator.plugins.BatchInsertPlugin插件需配合com.itfsw.mybatis.generator.plugins.ModelColumnPlugin插件使用!"
);
}
}
/**
* 测试错误的支持driver
* @throws IOException
* @throws XMLParserException
* @throws InvalidConfigurationException
* @throws SQLException
* @throws InterruptedException
*/
@Test
@Test
public
void
testWarnings2
()
throws
IOException
,
XMLParserException
,
InvalidConfigurationException
,
SQLException
,
InterruptedException
{
public
void
testWarnings2
()
throws
IOException
,
XMLParserException
,
InvalidConfigurationException
,
SQLException
,
InterruptedException
{
List
<
String
>
warnings
=
new
ArrayList
<
String
>();
List
<
String
>
warnings
=
new
ArrayList
<>();
ConfigurationParser
cp
=
new
ConfigurationParser
(
warnings
);
ConfigurationParser
cp
=
new
ConfigurationParser
(
warnings
);
Configuration
config
=
cp
.
parseConfiguration
(
Resources
.
getResourceAsStream
(
"scripts/BatchInsertPlugin/mybatis-generator-with-error-driver.xml"
));
Configuration
config
=
cp
.
parseConfiguration
(
Resources
.
getResourceAsStream
(
"scripts/BatchInsertPlugin/mybatis-generator-with-error-driver.xml"
));
...
@@ -86,6 +104,16 @@ public class BatchInsertPluginTest {
...
@@ -86,6 +104,16 @@ public class BatchInsertPluginTest {
Assert
.
assertEquals
(
warnings
.
get
(
1
),
"itfsw:插件com.itfsw.mybatis.generator.plugins.BatchInsertPlugin插件使用前提是数据库为MySQL或者SQLserver,因为返回主键使用了JDBC的getGenereatedKeys方法获取主键!"
);
Assert
.
assertEquals
(
warnings
.
get
(
1
),
"itfsw:插件com.itfsw.mybatis.generator.plugins.BatchInsertPlugin插件使用前提是数据库为MySQL或者SQLserver,因为返回主键使用了JDBC的getGenereatedKeys方法获取主键!"
);
}
}
/**
* 测试生成的方法
* @throws IOException
* @throws XMLParserException
* @throws InvalidConfigurationException
* @throws SQLException
* @throws InterruptedException
* @throws ClassNotFoundException
* @throws NoSuchMethodException
*/
@Test
@Test
public
void
testMethods
()
throws
IOException
,
XMLParserException
,
InvalidConfigurationException
,
SQLException
,
InterruptedException
,
ClassNotFoundException
,
NoSuchMethodException
{
public
void
testMethods
()
throws
IOException
,
XMLParserException
,
InvalidConfigurationException
,
SQLException
,
InterruptedException
,
ClassNotFoundException
,
NoSuchMethodException
{
List
<
String
>
warnings
=
new
ArrayList
<>();
List
<
String
>
warnings
=
new
ArrayList
<>();
...
@@ -99,12 +127,12 @@ public class BatchInsertPluginTest {
...
@@ -99,12 +127,12 @@ public class BatchInsertPluginTest {
// 1. 普通Mapper参数中List泛型为普通Model
// 1. 普通Mapper参数中List泛型为普通Model
Class
clsTbMapper
=
loader
.
loadClass
(
"com.itfsw.mybatis.generator.plugins.dao.TbMapper"
);
Class
clsTbMapper
=
loader
.
loadClass
(
"com.itfsw.mybatis.generator.plugins.dao.TbMapper"
);
int
count
=
0
;
int
count
=
0
;
for
(
Method
method
:
clsTbMapper
.
getDeclaredMethods
()){
for
(
Method
method
:
clsTbMapper
.
getDeclaredMethods
())
{
if
(
method
.
getName
().
equals
(
"batchInsert"
)){
if
(
method
.
getName
().
equals
(
"batchInsert"
))
{
Assert
.
assertEquals
(
Util
.
getListActualType
(
method
.
getGenericParameterTypes
()[
0
]),
"com.itfsw.mybatis.generator.plugins.dao.model.Tb"
);
Assert
.
assertEquals
(
Util
.
getListActualType
(
method
.
getGenericParameterTypes
()[
0
]),
"com.itfsw.mybatis.generator.plugins.dao.model.Tb"
);
count
++;
count
++;
}
}
if
(
method
.
getName
().
equals
(
"batchInsertSelective"
)){
if
(
method
.
getName
().
equals
(
"batchInsertSelective"
))
{
Assert
.
assertEquals
(
Util
.
getListActualType
(
method
.
getGenericParameterTypes
()[
0
]),
"com.itfsw.mybatis.generator.plugins.dao.model.Tb"
);
Assert
.
assertEquals
(
Util
.
getListActualType
(
method
.
getGenericParameterTypes
()[
0
]),
"com.itfsw.mybatis.generator.plugins.dao.model.Tb"
);
Assert
.
assertEquals
(
method
.
getGenericParameterTypes
()[
1
].
getTypeName
(),
"com.itfsw.mybatis.generator.plugins.dao.model.Tb$Column[]"
);
Assert
.
assertEquals
(
method
.
getGenericParameterTypes
()[
1
].
getTypeName
(),
"com.itfsw.mybatis.generator.plugins.dao.model.Tb$Column[]"
);
count
++;
count
++;
...
@@ -115,12 +143,12 @@ public class BatchInsertPluginTest {
...
@@ -115,12 +143,12 @@ public class BatchInsertPluginTest {
// 2. 带有WithBlobs
// 2. 带有WithBlobs
Class
clsTbBlobsMapper
=
loader
.
loadClass
(
"com.itfsw.mybatis.generator.plugins.dao.TbBlobsMapper"
);
Class
clsTbBlobsMapper
=
loader
.
loadClass
(
"com.itfsw.mybatis.generator.plugins.dao.TbBlobsMapper"
);
count
=
0
;
count
=
0
;
for
(
Method
method
:
clsTbBlobsMapper
.
getDeclaredMethods
()){
for
(
Method
method
:
clsTbBlobsMapper
.
getDeclaredMethods
())
{
if
(
method
.
getName
().
equals
(
"batchInsert"
)){
if
(
method
.
getName
().
equals
(
"batchInsert"
))
{
Assert
.
assertEquals
(
Util
.
getListActualType
(
method
.
getGenericParameterTypes
()[
0
]),
"com.itfsw.mybatis.generator.plugins.dao.model.TbBlobsWithBLOBs"
);
Assert
.
assertEquals
(
Util
.
getListActualType
(
method
.
getGenericParameterTypes
()[
0
]),
"com.itfsw.mybatis.generator.plugins.dao.model.TbBlobsWithBLOBs"
);
count
++;
count
++;
}
}
if
(
method
.
getName
().
equals
(
"batchInsertSelective"
)){
if
(
method
.
getName
().
equals
(
"batchInsertSelective"
))
{
Assert
.
assertEquals
(
Util
.
getListActualType
(
method
.
getGenericParameterTypes
()[
0
]),
"com.itfsw.mybatis.generator.plugins.dao.model.TbBlobsWithBLOBs"
);
Assert
.
assertEquals
(
Util
.
getListActualType
(
method
.
getGenericParameterTypes
()[
0
]),
"com.itfsw.mybatis.generator.plugins.dao.model.TbBlobsWithBLOBs"
);
Assert
.
assertEquals
(
method
.
getGenericParameterTypes
()[
1
].
getTypeName
(),
"com.itfsw.mybatis.generator.plugins.dao.model.TbBlobsWithBLOBs$Column[]"
);
Assert
.
assertEquals
(
method
.
getGenericParameterTypes
()[
1
].
getTypeName
(),
"com.itfsw.mybatis.generator.plugins.dao.model.TbBlobsWithBLOBs$Column[]"
);
count
++;
count
++;
...
@@ -136,8 +164,44 @@ public class BatchInsertPluginTest {
...
@@ -136,8 +164,44 @@ public class BatchInsertPluginTest {
myBatisGenerator
.
generate
(
null
,
null
,
null
,
true
);
myBatisGenerator
.
generate
(
null
,
null
,
null
,
true
);
}
}
/**
* 测试生成的sql
*/
@Test
public
void
testSql
()
throws
Exception
{
DBHelper
.
cleanDao
();
List
<
String
>
warnings
=
new
ArrayList
<>();
ConfigurationParser
cp
=
new
ConfigurationParser
(
warnings
);
Configuration
config
=
cp
.
parseConfiguration
(
Resources
.
getResourceAsStream
(
"scripts/BatchInsertPlugin/mybatis-generator.xml"
));
MyBatisGenerator
myBatisGenerator
=
new
MyBatisGenerator
(
config
,
new
AbstractShellCallback
(
true
)
{
@Override
public
void
reloadProject
(
ClassLoader
loader
)
{
try
{
SqlSession
sqlSession
=
helper
.
getSqlSession
();
Object
obj
=
sqlSession
.
getMapper
(
loader
.
loadClass
(
"com.itfsw.mybatis.generator.plugins.dao.TbMapper"
));
List
<
Object
>
params
=
new
ArrayList
<>();
String
sql
=
SqlHelper
.
getMapperSql
(
sqlSession
,
loader
.
loadClass
(
"com.itfsw.mybatis.generator.plugins.dao.TbMapper"
),
"batchInsert"
,
params
);
System
.
out
.
println
(
sql
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
Assert
.
assertTrue
(
false
);
}
}
},
warnings
);
myBatisGenerator
.
generate
(
null
,
null
,
null
,
true
);
}
@AfterClass
@AfterClass
public
static
void
clean
(){
public
static
void
clean
()
{
DBHelper
.
reset
();
//
DBHelper.reset();
}
}
}
}
src/test/java/com/itfsw/mybatis/generator/plugins/tools/AbstractShellCallback.java
View file @
5e3e9880
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
package
com
.
itfsw
.
mybatis
.
generator
.
plugins
.
tools
;
package
com
.
itfsw
.
mybatis
.
generator
.
plugins
.
tools
;
import
org.junit.Assert
;
import
org.mybatis.generator.api.ShellCallback
;
import
org.mybatis.generator.api.ShellCallback
;
import
org.mybatis.generator.exception.ShellException
;
import
org.mybatis.generator.exception.ShellException
;
...
@@ -24,6 +25,8 @@ import javax.tools.JavaFileObject;
...
@@ -24,6 +25,8 @@ import javax.tools.JavaFileObject;
import
javax.tools.StandardJavaFileManager
;
import
javax.tools.StandardJavaFileManager
;
import
javax.tools.ToolProvider
;
import
javax.tools.ToolProvider
;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileReader
;
import
java.io.FileWriter
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.StringTokenizer
;
import
java.util.StringTokenizer
;
...
@@ -59,8 +62,59 @@ public abstract class AbstractShellCallback implements ShellCallback {
...
@@ -59,8 +62,59 @@ public abstract class AbstractShellCallback implements ShellCallback {
*/
*/
@Override
@Override
public
void
refreshProject
(
String
project
)
{
public
void
refreshProject
(
String
project
)
{
List
<
File
>
files
=
getJavaFiles
(
new
File
(
project
+
"/com/itfsw/mybatis/generator/plugins/dao"
));
File
daoDir
=
new
File
(
project
+
"/com/itfsw/mybatis/generator/plugins/dao"
);
List
<
File
>
files
=
getJavaFiles
(
daoDir
);
if
(!
files
.
isEmpty
())
{
if
(!
files
.
isEmpty
())
{
compileJavaFiles
(
files
);
copyMappings
(
daoDir
,
project
);
}
reloadProject
(
this
.
getClass
().
getClassLoader
());
}
/**
* 拷贝xml
* @param file
* @param project
*/
private
void
copyMappings
(
File
file
,
String
project
)
{
if
(
file
.
exists
())
{
File
[]
files
=
file
.
listFiles
();
for
(
File
childFile
:
files
)
{
if
(
childFile
.
isDirectory
())
{
copyMappings
(
childFile
,
project
);
}
else
if
(
childFile
.
getName
().
endsWith
(
".xml"
))
{
try
{
FileReader
fileReader
=
new
FileReader
(
childFile
);
// 目标路径
String
path
=
childFile
.
getPath
();
path
=
path
.
replaceAll
(
"\\\\"
,
"/"
);
String
target
=
this
.
getClass
().
getClassLoader
().
getResource
(
""
).
getPath
()
+
path
.
replace
(
project
,
""
);
File
targetFile
=
new
File
(
target
);
if
(!
targetFile
.
getParentFile
().
exists
()){
targetFile
.
getParentFile
().
mkdirs
();
}
targetFile
.
createNewFile
();
FileWriter
fileWriter
=
new
FileWriter
(
targetFile
);
int
ch
=
0
;
while
((
ch
=
fileReader
.
read
())
!=
-
1
)
{
fileWriter
.
write
(
ch
);
}
fileReader
.
close
();
fileWriter
.
close
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
Assert
.
assertTrue
(
false
);
}
}
}
}
}
/**
* 动态编译java文件
* @param files
*/
private
void
compileJavaFiles
(
List
<
File
>
files
)
{
JavaCompiler
compiler
=
ToolProvider
.
getSystemJavaCompiler
();
JavaCompiler
compiler
=
ToolProvider
.
getSystemJavaCompiler
();
//获取java文件管理类
//获取java文件管理类
...
@@ -77,9 +131,6 @@ public abstract class AbstractShellCallback implements ShellCallback {
...
@@ -77,9 +131,6 @@ public abstract class AbstractShellCallback implements ShellCallback {
JavaCompiler
.
CompilationTask
task
=
compiler
.
getTask
(
null
,
manager
,
null
,
ops
,
null
,
it
);
JavaCompiler
.
CompilationTask
task
=
compiler
.
getTask
(
null
,
manager
,
null
,
ops
,
null
,
it
);
//执行编译任务
//执行编译任务
task
.
call
();
task
.
call
();
}
reloadProject
(
this
.
getClass
().
getClassLoader
());
}
}
public
abstract
void
reloadProject
(
ClassLoader
loader
);
public
abstract
void
reloadProject
(
ClassLoader
loader
);
...
...
src/test/resources/scripts/BatchInsertPlugin/mybatis-generator-with-error-driver.xml
View file @
5e3e9880
...
@@ -40,7 +40,7 @@
...
@@ -40,7 +40,7 @@
<!--<property name="rootClass" value="com.itfsw.base"/>-->
<!--<property name="rootClass" value="com.itfsw.base"/>-->
</javaModelGenerator>
</javaModelGenerator>
<!--Mapper映射文件生成所在的目录 为每一个数据库的表生成对应的SqlMap文件 -->
<!--Mapper映射文件生成所在的目录 为每一个数据库的表生成对应的SqlMap文件 -->
<sqlMapGenerator
targetPackage=
"com.itfsw.mybatis.generator.plugins.dao
.mapping
"
targetProject=
"src/test/java"
/>
<sqlMapGenerator
targetPackage=
"com.itfsw.mybatis.generator.plugins.dao"
targetProject=
"src/test/java"
/>
<!-- 客户端代码,生成易于使用的针对Model对象和XML配置文件 的代码
<!-- 客户端代码,生成易于使用的针对Model对象和XML配置文件 的代码
type="ANNOTATEDMAPPER",生成Java Model 和基于注解的Mapper对象
type="ANNOTATEDMAPPER",生成Java Model 和基于注解的Mapper对象
type="MIXEDMAPPER",生成基于注解的Java Model 和相应的Mapper对象
type="MIXEDMAPPER",生成基于注解的Java Model 和相应的Mapper对象
...
...
src/test/resources/scripts/BatchInsertPlugin/mybatis-generator-without-model-column-plugin.xml
View file @
5e3e9880
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
<!--<property name="rootClass" value="com.itfsw.base"/>-->
<!--<property name="rootClass" value="com.itfsw.base"/>-->
</javaModelGenerator>
</javaModelGenerator>
<!--Mapper映射文件生成所在的目录 为每一个数据库的表生成对应的SqlMap文件 -->
<!--Mapper映射文件生成所在的目录 为每一个数据库的表生成对应的SqlMap文件 -->
<sqlMapGenerator
targetPackage=
"com.itfsw.mybatis.generator.plugins.dao
.mapping
"
targetProject=
"src/test/java"
/>
<sqlMapGenerator
targetPackage=
"com.itfsw.mybatis.generator.plugins.dao"
targetProject=
"src/test/java"
/>
<!-- 客户端代码,生成易于使用的针对Model对象和XML配置文件 的代码
<!-- 客户端代码,生成易于使用的针对Model对象和XML配置文件 的代码
type="ANNOTATEDMAPPER",生成Java Model 和基于注解的Mapper对象
type="ANNOTATEDMAPPER",生成Java Model 和基于注解的Mapper对象
type="MIXEDMAPPER",生成基于注解的Java Model 和相应的Mapper对象
type="MIXEDMAPPER",生成基于注解的Java Model 和相应的Mapper对象
...
...
src/test/resources/scripts/BatchInsertPlugin/mybatis-generator.xml
View file @
5e3e9880
...
@@ -40,7 +40,7 @@
...
@@ -40,7 +40,7 @@
<!--<property name="rootClass" value="com.itfsw.base"/>-->
<!--<property name="rootClass" value="com.itfsw.base"/>-->
</javaModelGenerator>
</javaModelGenerator>
<!--Mapper映射文件生成所在的目录 为每一个数据库的表生成对应的SqlMap文件 -->
<!--Mapper映射文件生成所在的目录 为每一个数据库的表生成对应的SqlMap文件 -->
<sqlMapGenerator
targetPackage=
"com.itfsw.mybatis.generator.plugins.dao
.mapping
"
targetProject=
"src/test/java"
/>
<sqlMapGenerator
targetPackage=
"com.itfsw.mybatis.generator.plugins.dao"
targetProject=
"src/test/java"
/>
<!-- 客户端代码,生成易于使用的针对Model对象和XML配置文件 的代码
<!-- 客户端代码,生成易于使用的针对Model对象和XML配置文件 的代码
type="ANNOTATEDMAPPER",生成Java Model 和基于注解的Mapper对象
type="ANNOTATEDMAPPER",生成Java Model 和基于注解的Mapper对象
type="MIXEDMAPPER",生成基于注解的Java Model 和相应的Mapper对象
type="MIXEDMAPPER",生成基于注解的Java Model 和相应的Mapper对象
...
...
src/test/resources/scripts/ExampleTargetPlugin/mybatis-generator-without-plugin.xml
View file @
5e3e9880
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
<!--<property name="rootClass" value="com.itfsw.base"/>-->
<!--<property name="rootClass" value="com.itfsw.base"/>-->
</javaModelGenerator>
</javaModelGenerator>
<!--Mapper映射文件生成所在的目录 为每一个数据库的表生成对应的SqlMap文件 -->
<!--Mapper映射文件生成所在的目录 为每一个数据库的表生成对应的SqlMap文件 -->
<sqlMapGenerator
targetPackage=
"com.itfsw.mybatis.generator.plugins.dao
.mapping
"
targetProject=
"src/test/java"
/>
<sqlMapGenerator
targetPackage=
"com.itfsw.mybatis.generator.plugins.dao"
targetProject=
"src/test/java"
/>
<!-- 客户端代码,生成易于使用的针对Model对象和XML配置文件 的代码
<!-- 客户端代码,生成易于使用的针对Model对象和XML配置文件 的代码
type="ANNOTATEDMAPPER",生成Java Model 和基于注解的Mapper对象
type="ANNOTATEDMAPPER",生成Java Model 和基于注解的Mapper对象
type="MIXEDMAPPER",生成基于注解的Java Model 和相应的Mapper对象
type="MIXEDMAPPER",生成基于注解的Java Model 和相应的Mapper对象
...
...
src/test/resources/scripts/ExampleTargetPlugin/mybatis-generator.xml
View file @
5e3e9880
...
@@ -41,7 +41,7 @@
...
@@ -41,7 +41,7 @@
<!--<property name="rootClass" value="com.itfsw.base"/>-->
<!--<property name="rootClass" value="com.itfsw.base"/>-->
</javaModelGenerator>
</javaModelGenerator>
<!--Mapper映射文件生成所在的目录 为每一个数据库的表生成对应的SqlMap文件 -->
<!--Mapper映射文件生成所在的目录 为每一个数据库的表生成对应的SqlMap文件 -->
<sqlMapGenerator
targetPackage=
"com.itfsw.mybatis.generator.plugins.dao
.mapping
"
targetProject=
"src/test/java"
/>
<sqlMapGenerator
targetPackage=
"com.itfsw.mybatis.generator.plugins.dao"
targetProject=
"src/test/java"
/>
<!-- 客户端代码,生成易于使用的针对Model对象和XML配置文件 的代码
<!-- 客户端代码,生成易于使用的针对Model对象和XML配置文件 的代码
type="ANNOTATEDMAPPER",生成Java Model 和基于注解的Mapper对象
type="ANNOTATEDMAPPER",生成Java Model 和基于注解的Mapper对象
type="MIXEDMAPPER",生成基于注解的Java Model 和相应的Mapper对象
type="MIXEDMAPPER",生成基于注解的Java Model 和相应的Mapper对象
...
...
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