使用 Mybatis-Generator 逆向工程生成 pojo、mapper
1、添加依赖插件:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.6</version>
<configuration>
<!– 配置文件的位置 –>
<configurationFile>src/main/resources/generatorConfig.xml</configurationFile>
<verbose>true</verbose>
<overwrite>true</overwrite>
</configuration>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
2、添加配置文件 generatorConfig.xml
3、配置 idea
点击菜单 Run->Edit Configuration, 然后在弹出窗体的左上角,点击 +->maven, 会出现下面窗体
命令:mybatis-generator:generate -e