Files
smart_venue/service/target/classes/tools/generatorConfig.xml
2021-03-08 22:48:38 +08:00

115 lines
6.0 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?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>
<!--id:必选上下文id用于在生成错误时提示-->
<context id="mysql" targetRuntime="MyBatis3">
<!-- 生成的Java文件的编码 -->
<property name="javaFileEncoding" value="UTF-8"/>
<!-- 对注释进行控制 -->
<commentGenerator>
<!-- suppressDate是去掉生成日期那行注释 -->
<property name="suppressDate" value="true"/>
<!-- suppressAllComments是去掉所有的注解 -->
<property name="suppressAllComments" value="true"/>
</commentGenerator>
<!--jdbc的数据库连接 -->
<jdbcConnection
driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://127.0.0.1:3306/smart_venue"
userId="root"
password="123456">
</jdbcConnection>
<!-- java类型处理器
用于处理DB中的类型到Java中的类型默认使用JavaTypeResolverDefaultImpl
注意一点默认会先尝试使用IntegerLongShort等来对应DECIMAL和 NUMERIC数据类型
-->
<javaTypeResolver type="org.mybatis.generator.internal.types.JavaTypeResolverDefaultImpl">
<!--
true使用BigDecimal对应DECIMAL和 NUMERIC数据类型
false默认,
scale>0;length>18使用BigDecimal;
scale=0;length[10,18]使用Long
scale=0;length[5,9]使用Integer
scale=0;length<5使用Short
-->
<property name="forceBigDecimals" value="false"/>
</javaTypeResolver>
<!-- java模型创建器是必须要的元素
负责1key类见context的defaultModelType2java类3查询类
targetPackage生成的类要放的包真实的包受enableSubPackages属性控制
targetProject目标项目指定一个存在的目录下生成的内容会放到指定目录中如果目录不存在MBG不会自动建目录
-->
<javaModelGenerator targetPackage="com.sv.entity" targetProject="src/main/java">
<!-- 是否允许子包即targetPackage.schemaName.tableName -->
<property name="enableSubPackages" value="true"/>
<!-- 是否对model添加 构造函数 -->
<property name="constructorBased" value="true"/>
<!-- 是否对类CHAR类型的列的数据进行trim操作 -->
<property name="trimStrings" value="true"/>
<!-- 建立的Model对象是否 不可改变 即生成的Model对象不会有 setter方法只有构造方法 -->
<property name="immutable" value="false"/>
</javaModelGenerator>
<!-- 生成SQL map的XML文件生成器
注意在Mybatis3之后我们可以使用mapper.xml文件+Mapper接口或者不用mapper接口
或者只使用Mapper接口+Annotation
所以,如果 javaClientGenerator配置中配置了需要生成XML的话这个元素就必须配置
targetPackage/targetProject:同javaModelGenerator
-->
<sqlMapGenerator targetPackage="mybatis.mapper.sv" targetProject="src/main/resources">
<!-- 在targetPackage的基础上根据数据库的schema再生成一层package最终生成的类放在这个package下默认为false -->
<property name="enableSubPackages" value="true"/>
</sqlMapGenerator>
<!-- 对于mybatis来说即生成Mapper接口注意如果没有配置该元素那么默认不会生成Mapper接口
targetPackage/targetProject:同javaModelGenerator
type选择怎么生成mapper接口在MyBatis3/MyBatis3Simple下
1ANNOTATEDMAPPER会生成使用Mapper接口+Annotation的方式创建SQL生成在annotation中不会生成对应的XML
2MIXEDMAPPER使用混合配置会生成Mapper接口并适当添加合适的Annotation但是XML会生成在XML中
3XMLMAPPER会生成Mapper接口接口完全依赖XML
注意如果context是MyBatis3Simple只支持ANNOTATEDMAPPER和XMLMAPPER
-->
<javaClientGenerator targetPackage="com.sv.mapper" type="XMLMAPPER" targetProject="src/main/java">
<!-- 在targetPackage的基础上根据数据库的schema再生成一层package最终生成的类放在这个package下默认为false -->
<property name="enableSubPackages" value="true"/>
</javaClientGenerator>
<!-- 选择一个table来生成相关文件可以有一个或多个table必须要有table元素
tableName必要要生成对象的表名
domainObjectName 给表对应的 model 起名字
注意:大小写敏感问题。
-->
<table tableName="sv_health_docs" domainObjectName="HealthDoc"
enableInsert="true"
enableDeleteByPrimaryKey="true"
enableSelectByPrimaryKey="true"
enableUpdateByPrimaryKey="true"
enableCountByExample="false"
enableDeleteByExample="false"
enableSelectByExample="false"
enableUpdateByExample="false" >
<!--用来修改表中某个列的属性,一个table元素中可以有多个columnOverride元素哈.
property属性来指定列要生成的属性名称.
-->
<!--<columnOverride column="username" property="userName" />-->
</table>
<!--<table tableName="person" domainObjectName="Person"/>-->
<!--<table tableName="department" domainObjectName="Depart"/>-->
</context>
</generatorConfiguration>