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
66
67
68
69
70
71
| <?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>
<!-- 引入配置文件,此处我的配置文件和当前generator配置文件在同一个文件夹下,所以直接写文件名即可 -->
<properties resource="config.properties" />
<!-- 引入MySQL-connector jar包 -->
<classPathEntry
location="C:/Rex/maven/repository/mysql/mysql-connector-java/5.1.30/mysql-connector-java-5.1.30.jar" />
<!-- 一个数据库一个context -->
<context id="ssm">
<!-- 注释 -->
<commentGenerator>
<!-- 是否取消注释 -->
<property name="suppressAllComments" value="false" />
<!-- 是否生成注释代时间戳 -->
<property name="suppressDate" value="true" />
</commentGenerator>
<!-- jdbc连接 -->
<jdbcConnection driverClass="${mysql.ssm.driver}"
connectionURL="${mysql.ssm.url}" userId="${mysql.ssm.username}"
password="${mysql.ssm.password}" />
<!-- 类型转换 -->
<javaTypeResolver>
<!-- 是否使用bigDecimal, false可自动转化以下类型(Long, Integer, Short, etc.) -->
<property name="forceBigDecimals" value="false" />
</javaTypeResolver>
<!-- 生成实体类地址 -->
<javaModelGenerator targetPackage="com.ssm.model"
targetProject="src/main/java">
<!-- 是否在当前路径下新加一层schema,eg:fase路径com.ssm.model, true:com.rmbih.model.[schemaName] -->
<property name="enableSubPackages" value="false" />
<!-- 是否针对string类型的字段在set的时候进行trim调用 -->
<property name="trimStrings" value="true" />
</javaModelGenerator>
<!-- 生成mapxml文件 -->
<sqlMapGenerator targetPackage="com.ssm.mapper"
targetProject="src/main/resources">
<!-- 是否在当前路径下新加一层schema,eg:fase路径com.rmbih.mapper, true:com.rmbih.mapper.[schemaName] -->
<property name="enableSubPackages" value="false" />
</sqlMapGenerator>
<!-- 生成mapxml对应client,也就是接口dao -->
<javaClientGenerator targetPackage="com.ssm.dao.mapper"
targetProject="src/main/java" type="XMLMAPPER">
<!-- 是否在当前路径下新加一层schema,eg:fase路径com.rmbih.IDao, true:com.rmbih.IDao.[schemaName] -->
<property name="enableSubPackages" value="false" />
</javaClientGenerator>
<!-- 配置表信息 -->
<!-- schema即为数据库名 tableName为对应的数据库表 domainObjectName是要生成的实体类 enable*ByExample
是否生成 example类 -->
<table schema="ssm" tableName="ssm_user_t">
<!--domainObjectName="UserEntity" enableCountByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" enableUpdateByExample="false" -->
<!-- 忽略列,不生成bean 字段 -->
<!-- <ignoreColumn column="FRED" /> -->
<!-- 指定列的java数据类型 -->
<!-- <columnOverride column="LONG_VARCHAR_FIELD" jdbcType="VARCHAR" /> -->
<!-- <columnOverride column="???" property="???" /> -->
</table>
</context>
</generatorConfiguration>
|