逆向工程配置
2020-08-20 本文已影响0人
李霖神谷
- pom配置文件
<dependencies>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.3</version>
</dependency>
<dependency>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-core</artifactId>
<version>1.3.7</version>
</dependency>
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.5.4</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.45</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.7</version>
<configuration>
<configurationFile>${basedir}/src/main/resources/generator.xml</configurationFile>
<verbose>true</verbose>
<overwrite>false</overwrite>
</configuration>
</plugin>
</plugins>
</build>
xml配置文件
<?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:\workcode\apache-maven-3.6.1-bin\apache-maven-3.6.1\respository\mysql\mysql-connector-java\5.1.45\mysql-connector-java-5.1.45.jar" />
<context id="Mybatis3Context" targetRuntime="MyBatis3">
<property name="javaFileEncoding" value="UTF-8"/>
<commentGenerator>
<!-- 去掉生成日期那行注释 -->
<property name="suppressDate" value="true"/>
<!-- 是否去除自动生成所有的注释 true:是 : false:否 -->
<property name="suppressAllComments" value="true"/>
</commentGenerator>
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://localhost:3306/shuai-crowd"
userId="root"
password="root">
</jdbcConnection>
<javaTypeResolver>
<property name="forceBigDecimals" value="false"/>
</javaTypeResolver>
<!-- 模型的包名和位置-->
<javaModelGenerator targetPackage="model" targetProject="D:/myproject/shumeiProject/crowd-shuai/shuai-reverse/src/main/java">
<property name="enableSubPackages" value="true"/>
<property name="trimStrings" value="true"/>
</javaModelGenerator>
<!-- 映射文件的包名和位置-->
<sqlMapGenerator targetPackage="mapperxml" targetProject="D:/myproject/shumeiProject/crowd-shuai/shuai-reverse/src/main/resources">
<property name="enableSubPackages" value="true"/>
</sqlMapGenerator>
<!-- DAO的包名和位置-->
<javaClientGenerator type="XMLMAPPER" targetPackage="mapper" targetProject="D:/myproject/shumeiProject/crowd-shuai/shuai-reverse/src/main/java">
<property name="enableSubPackages" value="true"/>
</javaClientGenerator>
<table tableName="admin" domainObjectName="Admin" enableCountByExample="false"
enableDeleteByExample="false" enableUpdateByExample="false" enableSelectByExample="false">
</table>
</context>
</generatorConfiguration>
run---- 添加maven ----parameter
image.png