我这里使用的的eclipse插件的方式,来逆向生成代码。给出配置文件
generatorConfig.xml
代码语言:javascript复制<?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>
<!-- 数据库驱动的位置 -->
<classPathEntry
location="D:DevToolsMaven3.5.0Repositorymysqlmysql-connector-java5.1.38mysql-connector-java-5.1.38.jar" />
<context id="context1">
<!-- jdbc的配置信息 -->
<jdbcConnection connectionURL="jdbc:mysql://localhost:3306/row_manager?useUnicode=true&characterEncoding=utf-8"
driverClass="com.mysql.jdbc.Driver"
password="shiye"
userId="root" />
<!--targetPackage: 生成在哪个包下 targetProject:项目路径-->
<!-- pojo对象 -->
<javaModelGenerator targetPackage="com.shi.pojo"
targetProject="MyAirPort/src/main/java" />
<!-- 配置文件 -->
<sqlMapGenerator targetPackage="com.shi.mapper"
targetProject="MyAirPort/src/main/resources" />
<!-- 接口 -->
<javaClientGenerator targetPackage="com.shi.mapper"
targetProject="MyAirPort/src/main/java" type="XMLMAPPER" />
<!-- 表的配置信息 -->
<table schema="User" tableName="user" enableCountByExample="false"
enableUpdateByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" selectByExampleQueryId="false">
</table>
<table schema="Power" tableName="power" enableCountByExample="false"
enableUpdateByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" selectByExampleQueryId="false">
</table>
<table schema="Row" tableName="row" enableCountByExample="false"
enableUpdateByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" selectByExampleQueryId="false">
</table>
<table schema="RowPower" tableName="row_power" enableCountByExample="false"
enableUpdateByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" selectByExampleQueryId="false">
</table>
<table schema="UserPower" tableName="user_power" enableCountByExample="false"
enableUpdateByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" selectByExampleQueryId="false">
</table>
<table schema="UserRow" tableName="user_row" enableCountByExample="false"
enableUpdateByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" selectByExampleQueryId="false">
</table>
</context>
</generatorConfiguration>