Intellij IDEA 中使用 MyBatis-genera
2018-08-15 本文已影响439人
BrightHeart
1.在maven项目的pom.xml 添加mybatis-generator-maven-plugin 插件和MySQL数据库驱动依赖
![](https://img.haomeiwen.com/i12780714/9395ab53f31fe801.png)
2.在maven项目下的src/main/resources 目录下建立名为 generatorConfig.xml的配置文件,作为mybatis-generator-maven-plugin 插件的执行目标,模板如下:
![](https://img.haomeiwen.com/i12780714/bf63aa33f4cc9b7a.png)
3.使用maven运行mybatis-generator-maven-plugin插件:工程名->Plugins->mybatis-generator->mybatis-generator:generate->Run Maven Build
![](https://img.haomeiwen.com/i12780714/f600256985333c6d.png)
4.自动生成的结构如下:
![](https://img.haomeiwen.com/i12780714/46d871475b9512f9.png)