mybatis自动生成代码工具

<?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="sql-mybatis.properties" />


<!--数据库驱动包路径 -->
<classPathEntry location="${drive.class.path}" />


<context id="MySQLTables" targetRuntime="MyBatis3">
<!--关闭注释 -->
<commentGenerator>
<property name="suppressAllComments" value="true" /><!-- 是否取消注释 -->
<property name="suppressDate" value="true" /> <!-- 是否生成注释代时间戳 -->
</commentGenerator>


<!--数据库连接信息 -->
<jdbcConnection driverClass="${jdbc.driver}"
connectionURL="${jdbc.url}" userId="${jdbc.username}" password="${jdbc.password}">
</jdbcConnection>


<!--生成的model 包路径 -->
<javaModelGenerator targetPackage="${model.package}"
targetProject="${target.project}">
<property name="enableSubPackages" value="true" />
<property name="trimStrings" value="true" />
</javaModelGenerator>


<!--生成xml mapper文件 路径 -->
<sqlMapGenerator targetPackage="${xml.mapper.package}"
targetProject="${target.project}">
<property name="enableSubPackages" value="true" />
</sqlMapGenerator>


<!-- 生成的Dao接口 的包路径 -->
<javaClientGenerator type="XMLMAPPER"
targetPackage="${dao.package}" targetProject="${target.project}">
<property name="enableSubPackages" value="true" />
</javaClientGenerator>


<!--对应数据库表名 -->
<table schema="banaworld" tableName="region" domainObjectName="Region"
enableCountByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" enableUpdateByExample="false">
<property name="useActualColumnNames" value="false" />
</table>
</context>
</generatorConfiguration>

猜你喜欢

转载自blog.csdn.net/qq_37273784/article/details/79761267