Mybatis Plus 逆向工程介绍

这篇文章主要介绍了Mybatis Plus 逆向工程,文章通过Mybatis Plus 逆向工程相关资料及示例代码详细介绍,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考一下

一、创建数据库

二、配置pom.xml 文件

            org.mybatis.generator         mybatis-generator-core         1.3.5     

导入mybatis-generator的jar包:

注:如果存在导入不进去的情况

在项目-右键-maven-updataproject

三、在项目同级目录建立mgb.xml

                                                                                                                                                                                     
     
 

四、在测试类中写入方法

package com.crud.text; import java.io.File; import java.util.ArrayList; import java.util.List; import org.mybatis.generator.api.MyBatisGenerator; import org.mybatis.generator.config.Configuration; import org.mybatis.generator.config.xml.ConfigurationParser; import org.mybatis.generator.internal.DefaultShellCallback; public class MGBTest {     public static void main(String[] args) throws Exception {          List warnings = new ArrayList();            boolean overwrite = true;            //下面写入自己建立的xml文件            File configFile = new File("mbg.xml");            ConfigurationParser cp = new ConfigurationParser(warnings);            Configuration config = cp.parseConfiguration(configFile);            DefaultShellCallback callback = new DefaultShellCallback(overwrite);            MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings);            myBatisGenerator.generate(null);   } }

刷新项目(按F5)

如同对应就生产好了。

到此这篇关于Mybatis Plus 逆向工程介绍的文章就介绍到这了,更多相关Mybatis Plus 逆向工程内容请搜索0133技术站以前的文章或继续浏览下面的相关文章希望大家以后多多支持0133技术站!

以上就是Mybatis Plus 逆向工程介绍的详细内容,更多请关注0133技术站其它相关文章!

赞(0) 打赏
未经允许不得转载:0133技术站首页 » Java