<?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>
<!-- jar包目录 -->
<classPathEntry location="D:/mysql-connector-java-3.1.13-bin.jar" />
<context id="app">
<commentGenerator>
<!-- 是否去除自动生成的注释 true:是 : false:否 -->
<property name="suppressAllComments" value="true"/>
</commentGenerator>
<!-- 数据库链接URL、用户名、密码 -->
<jdbcConnection connectionURL="jdbc_url" driverClass="jdbc_driver" userId="jdbc_user" password="jdbc_password" />
<!-- 生成模型的包名和位置 -->
<javaModelGenerator targetPackage="com.xx.model" targetProject="project" >
<!-- 是否在当前路径下新加一层schema,eg:false路径com.xx.model, true:com.xx.model.[schemaName] -->
<property name="enableSubPackages" value="false"/>
<!-- 是否针对string类型的字段在set的时候进行trim调用 -->
<property name="trimStrings" value="true"/>
</javaModelGenerator>
<!-- 生成的映射文件报名和位置 -->
<sqlMapGenerator targetPackage="com.xx.model.mapper" targetProject="project" >
<!-- 是否在当前路径下新加一层schema,eg:false路径com.xx.model.mapper, true:com.xx.model.mapper.[schemaName] -->
<property name="enableSubPackages" value="false" />
</sqlMapGenerator>
<!-- 生成DAO的包名和位置 -->
<javaClientGenerator targetPackage="com.xx.dao" targetProject="project" type="XMLMAPPER" >
<!-- 是否在当前路径下新加一层schema,eg:false路径com.xx.dao, true:com.xx.dao.[schemaName] -->
<property name="enableSubPackages" value="false" />
</javaClientGenerator>
<!-- schema即为数据库名 tableName为对应的数据库表 domainObjectName是要生成的实体类 enable*ByExample
是否生成 example类 -->
<table schema="jdbc_user" tableName="table_name"
domainObjectName="domain_name" enableCountByExample="false"
enableDeleteByExample="false" enableSelectByExample="false"
enableUpdateByExample="false" >
<!-- 忽略列,不生成bean 字段
<ignoreColumn column="FRED" /> -->
<!-- 指定列的java数据类型
<columnOverride column="LONG_VARCHAR_FIELD" jdbcType="VARCHAR" /> -->
</table>
</context>
</generatorConfiguration>

© 转载请注明出处