-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmybatis-generator-config.xml
More file actions
88 lines (73 loc) · 4.71 KB
/
Copy pathmybatis-generator-config.xml
File metadata and controls
88 lines (73 loc) · 4.71 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?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>
<!-- 引入配置文件 -->
<properties resource="config/mybatis-generator.properties"/>
<!-- 指定数据连接驱动jar地址 -->
<!-- <classPathEntry location="${generator.classPath}" /> -->
<!-- 一个数据库一个context -->
<context id="cocEventContext" targetRuntime="MyBatis3">
<!-- 生成的Java文件的编码 -->
<property name="javaFileEncoding" value="UTF-8"/>
<!-- 插件 -->
<plugin type="org.mybatis.generator.plugins.SerializablePlugin"/><!-- PO对象序列化 -->
<plugin type="org.mybatis.generator.plugins.CaseInsensitiveLikePlugin"/><!-- Example中的like语法的大小写敏感 -->
<plugin type="org.mybatis.generator.plugins.RowBoundsPlugin"/><!-- 限制条数,例如:分页数据时使用 -->
<plugin type="org.mybatis.generator.plugins.ToStringPlugin"/><!-- PO中添加toString() -->
<plugin type="org.mybatis.generator.plugins.RenameExampleClassPlugin"><!-- mapper中的Example字眼修改为Criteria -->
<property name="searchString" value="Example$"/>
<property name="replaceString" value="Criteria"/>
</plugin>
<!-- 注释 -->
<commentGenerator>
<!-- 是否取消注释,不建议启用 -->
<!-- <property name="suppressAllComments" value="true" /> -->
<!-- 是否生成注释代时间戳 -->
<property name="suppressDate" value="true"/>
<!-- 是否给PO类,生成表和字段的注释 -->
<property name="addRemarkComments" value="true"/>
</commentGenerator>
<!-- 【数据库】 jdbc连接 -->
<jdbcConnection connectionURL="${jdbc.url}"
driverClass="${jdbc.driverClassName}" password="${jdbc.password}" userId="${jdbc.username}">
<!--识别主键-->
<property name="useInformationSchema" value="true"/>
</jdbcConnection>
<!-- 类型转换 -->
<javaTypeResolver>
<!-- 是否使用bigDecimal, false可自动转化以下类型(Long, Integer, Short, etc.) -->
<property name="forceBigDecimals" value="false"/>
</javaTypeResolver>
<!-- 【PO】生成实体类地址 -->
<javaModelGenerator targetPackage="${generator.domainPackage}" targetProject="src/main/java">
<!-- 是否在当前路径下新加一层schema,eg:fase路径com.oop.eksp.user.model, true:com.oop.eksp.user.model.[schemaName] -->
<!-- <property name="enableSubPackages" value="true" /> -->
<!-- 是否针对string类型的字段在set的时候进行trim调用 -->
<property name="trimStrings" value="true"/>
<!-- 设置一个根对象,
如果设置了这个根对象,那么生成的keyClass或者recordClass会继承这个类;在Table的rootClass属性中可以覆盖该选项
注意:如果在key class或者record class中有root class相同的属性,MBG就不会重新生成这些属性了,包括:
1,属性名相同,类型相同,有相同的getter/setter方法;
-->
<property name="rootClass" value="com.cetccity.common.base.domain.BasePo"/>
</javaModelGenerator>
<!-- 【mapping.xml】 生成mapxml文件 -->
<sqlMapGenerator targetPackage="${generator.mappingXmlPackage}" targetProject="src/main/resources">
<!-- 是否在当前路径下新加一层schema,eg:fase路径com.oop.eksp.user.model, true:com.oop.eksp.user.model.[schemaName] -->
<!-- <property name="enableSubPackages" value="true" /> -->
</sqlMapGenerator>
<!-- 【Mapper.java】 生成mapxml对应client,也就是接口dao -->
<javaClientGenerator targetPackage="${generator.mapperPackage}" targetProject="src/main/java" type="XMLMAPPER">
<!-- 是否在当前路径下新加一层schema,eg:fase路径com.oop.eksp.user.model, true:com.oop.eksp.user.model.[schemaName] -->
<!-- <property name="enableSubPackages" value="true" /> -->
</javaClientGenerator>
<!-- 待生成的表:一张表一个table -->
<table schema="" tableName="school_event" domainObjectName="Event"
enableCountByExample="false" selectByExampleQueryId="false"
enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false">
<generatedKey column="id" sqlStatement="JDBC"/>
</table>
</context>
</generatorConfiguration>