-
Notifications
You must be signed in to change notification settings - Fork 0
/
generatorConfig.xml
50 lines (44 loc) · 2.58 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
<?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>
<!--核心配置-->
<context id="DB2Tables" targetRuntime="MyBatis3">
<commentGenerator>
<!-- 是否取消注释 -->
<property name="suppressDate" value="true"/>
<property name="suppressAllComments" value="true"/>
</commentGenerator>
<!--数据库链接地址账号密码,根据自己安装时的账户和密码进行填写-->
<jdbcConnection driverClass="com.mysql.cj.jdbc.Driver"
connectionURL="jdbc:mysql://localhost:3306/dbtest"
userId="root"
password="0000">
</jdbcConnection>
<!-- 是否使用bigDecimal, false可自动转化以下类型(Long, Integer, Short,)
默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer,为 true时把JDBC DECIMAL
和 NUMERIC 类型解析为java.math.BigDecimal -->
<javaTypeResolver>
<property name="forceBigDecimals" value="false"/>
</javaTypeResolver>
<!--生成实体类存放位置,这里是可以自动生成的,不需要创建-->
<javaModelGenerator targetPackage="indi.beta.bean" targetProject=".\src\main\java">
<property name="enableSubPackages" value="true"/>
<!-- 设置是否在getter方法中,对String类型字段调用trim()方法 -->
<property name="trimStrings" value="true"/>
</javaModelGenerator>
<!--生成映射文件(mapper.xml)存放位置,也不需要创建,可以生成-->
<sqlMapGenerator targetPackage="indi.beta.mapper" targetProject=".\src\main\resources">
<!-- enableSubPackages:是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="true"/>
</sqlMapGenerator>
<!--生成Mapper接口存放位置, 不要创建,会生成-->
<javaClientGenerator type="XMLMAPPER" targetPackage="indi.beta.mapper" targetProject=".\src\main\java">
<property name="enableSubPackages" value="true"/>
</javaClientGenerator>
<!--生成对应表及类名,你想生成几个就给你生成几个,tableName:表名,domainObjectName:实体类名-->
<table tableName="employees" domainObjectName="Employee"/>
<table tableName="departments" domainObjectName="Department"/>
</context>
</generatorConfiguration>