This repository has been archived by the owner on Jan 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathgeneratorConfig.xml
65 lines (53 loc) · 2.96 KB
/
generatorConfig.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<!--无Example等内容,简单版 -->
<context id="Mysql" targetRuntime="MyBatis3Simple" defaultModelType="flat">
<!-- 有Example查询条件内容,拓展版
<context id="testTables" targetRuntime="MyBatis3"> -->
<!--生成的实体bean重写toString方法-->
<plugin type="org.mybatis.generator.plugins.ToStringPlugin" />
<!-- ########################################## -->
<commentGenerator>
<!-- 是否去除自动生成的注释 true:是 : false:否 -->
<property name="suppressAllComments" value="true"/>
</commentGenerator>
<!--数据库连接的信息:驱动类、连接地址、用户名、密码 -->
<jdbcConnection
driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://localhost:3306/test"
userId="root"
password="root">
</jdbcConnection>
<!-- 默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer,为 true时把JDBC DECIMAL 和
NUMERIC 类型解析为java.math.BigDecimal -->
<javaTypeResolver>
<property name="forceBigDecimals" value="true"/>
</javaTypeResolver>
<!-- targetProject:生成Entity类的路径 -->
<javaModelGenerator targetProject=".\src" targetPackage="com.leeyom.orm.pojo">
<!-- enableSubPackages:是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false"/>
<!-- 从数据库返回的值被清理前后的空格 -->
<property name="trimStrings" value="true"/>
</javaModelGenerator>
<!-- targetProject:XXXMapper.xml映射文件生成的路径 -->
<sqlMapGenerator targetProject=".\src" targetPackage="com.leeyom.orm.mapper">
<!-- enableSubPackages:是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false"/>
</sqlMapGenerator>
<!-- targetPackage:Mapper接口生成的位置 -->
<javaClientGenerator type="XMLMAPPER" targetProject=".\src" targetPackage="com.leeyom.orm.mapper">
<!-- enableSubPackages:是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false"/>
</javaClientGenerator>
<!-- 数据库表名字和我们的entity类对应的映射指定,这种insert后不会返回主键id -->
<table tableName="user" domainObjectName="User"/>
<!-- insert插入时返回数据库自增长主键id -->
<table tableName="case" domainObjectName="Case">
<generatedKey column="case_id" sqlStatement="MySql" identity="true" />
</table>
</context>
</generatorConfiguration>