首页 > IT职业 > IT生活 > springboot集成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 >
<!-- mysql jar 文件位置 -->
<classPathEntry location="D:\jarpackage\mysql-connector-java-8.0.22\mysql-connector-java-8.0.22.jar" />
<context id="store" targetRuntime="MyBatis3">
<commentGenerator>
<!-- 是否去除自动生成的注释 true :是 : false: 否 -->
<property name="suppressAllComments" value="true" />
<!-- 是否去除所有自动生成的文件的时间戳,默认为 false -->
<property name="suppressDate" value="true"/>
</commentGenerator>
<!-- 数据库连接的信息:驱动类、连接地址、用户名、密码 -->
<jdbcConnection driverClass="com.mysql.cj.jdbc.Driver"
connectionURL="jdbc:mysql://localhost:3306/mybatis?characterEncoding=utf8&serverTimezone=UTC"
userId="root"
password="123456">
<property name="nullCatalogMeansCurrent" value="true"/>
</jdbcConnection>
<!-- targetPackage: 包名称 ( 自定义 ) targetProject :项目路径 ( 自定义 ) -->
<!-- 定义 model 的包名称 -->
<javaModelGenerator targetPackage="com.huang.domain" targetProject="src/main/java">
<!-- enableSubPackages: 是否让 schema 作为包的后缀 -->
<property name="enableSubPackages" value="false" />
<!-- 从数据库返回的值被清理前后的空格 -->
<property name="trimStrings" value="true" />
</javaModelGenerator>
<!-- 生成映射文件存放位置 -->
<!-- 配置生成相应的实体 Mapper.xml ,对于 Mapper3.X 我们需要把 type="XMLMAPPER" -->
<!-- targetPackage: 包名称 ( 自定义 ) targetProject :外汇跟单gendan5.com项目路径 ( 自定义 ) -->
<sqlMapGenerator targetPackage="com.huang.dao" targetProject="src/main/java">
<property name="enableSubPackages" value="true" />
</sqlMapGenerator>
<!-- 生成 Dao 类存放位置 -->
<!-- 配置生成相应的接口类,对应与 Mapper.xml 中的一系列 CRUD 方法 SQL 语句 -->
<!-- targetPackage: 包名称 ( 自定义 ) targetProject :项目路径 ( 自定义 ) -->
<javaClientGenerator targetPackage="com.huang.dao" targetProject="src/main/java" type="XMLMAPPER">
<property name="enableSubPackages" value="true" />
</javaClientGenerator>
<!-- 部门表 -->
<table tableName="dept" domainObjectName="Dept"
enableCountByExample="false"
enableUpdateByExample="false"
enableDeleteByExample="false"
enableSelectByExample="false"
selectByExampleQueryId="false">
</table>
<!-- 商品表 -->
<table tableName="goods" domainObjectName="Goods"
enableCountByExample="false"
enableUpdateByExample="false"
enableDeleteByExample="false"
enableSelectByExample="false"
selectByExampleQueryId="false">
</table>
<!-- 商户表 -->
<table tableName="sellers" domainObjectName="Sellers"
enableCountByExample="false"
enableUpdateByExample="false"
enableDeleteByExample="false"
enableSelectByExample="false"
selectByExampleQueryId="false">
</table>
</context>
</generatorConfiguration>
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69946337/viewspace-2782776/ ,如需转载,请注明出处,否则将追究法律责任。