mybatis逆向工程详解源码
MyBatis的一个主要的特点就是需要程序员自己编写sql,那么如果表太多的话,难免会很麻烦,所以mybatis官方提供了一个逆向工程,可以针对单表自动生成mybatis执行所需要的代码(包括mapper.xml、mapper.java、po..)。一般在开发中,常用的逆向工程方式是通过数据库的表生成代码。
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-09-01 17:38 mybatisGeneratorCustom
文件 542 2017-09-06 14:04 mybatisGeneratorCustom.classpath
目录 0 2018-08-25 22:20 mybatisGeneratorCustom.git
目录 0 2017-09-06 14:04 mybatisGeneratorCustom.gitranches
文件 264 2017-09-06 14:04 mybatisGeneratorCustom.gitconfig
文件 127 2017-09-06 14:04 mybatisGeneratorCustom.gitFETCH_HEAD
文件 23 2017-09-06 14:04 mybatisGeneratorCustom.gitHEAD
目录 0 2017-09-06 14:04 mybatisGeneratorCustom.githooks
文件 1624 2017-09-06 14:04 mybatisGeneratorCustom.gitindex
目录 0 2018-08-25 22:20 mybatisGeneratorCustom.gitlogs
文件 146 2017-09-06 14:04 mybatisGeneratorCustom.gitlogsHEAD
目录 0 2018-08-25 22:20 mybatisGeneratorCustom.gitlogs
efs
目录 0 2018-08-25 22:20 mybatisGeneratorCustom.gitlogs
efsheads
文件 146 2017-09-06 14:04 mybatisGeneratorCustom.gitlogs
efsheadsmaster
目录 0 2018-08-25 22:20 mybatisGeneratorCustom.gitlogs
efs
emotes
目录 0 2018-08-25 22:20 mybatisGeneratorCustom.gitlogs
efs
emotesorigin
文件 160 2017-09-06 14:04 mybatisGeneratorCustom.gitlogs
efs
emotesoriginmaster
目录 0 2018-08-25 22:20 mybatisGeneratorCustom.gitobjects
目录 0 2017-09-06 14:04 mybatisGeneratorCustom.gitobjectsinfo
目录 0 2018-08-25 22:20 mybatisGeneratorCustom.gitobjectspack
文件 2584 2017-09-06 14:04 mybatisGeneratorCustom.gitobjectspackpack-16030ed645c5bb9494713c3a5852701ab3dbf6f1.idx
文件 6092631 2017-09-06 14:04 mybatisGeneratorCustom.gitobjectspackpack-16030ed645c5bb9494713c3a5852701ab3dbf6f1.pack
目录 0 2018-08-25 22:20 mybatisGeneratorCustom.git
efs
目录 0 2018-08-25 22:20 mybatisGeneratorCustom.git
efsheads
文件 41 2017-09-06 14:04 mybatisGeneratorCustom.git
efsheadsmaster
目录 0 2018-08-25 22:20 mybatisGeneratorCustom.git
efs
emotes
目录 0 2018-08-25 22:20 mybatisGeneratorCustom.git
efs
emotesorigin
文件 41 2017-09-06 14:04 mybatisGeneratorCustom.git
efs
emotesoriginmaster
目录 0 2017-09-06 14:04 mybatisGeneratorCustom.git
efs ags
文件 381 2017-09-06 14:04 mybatisGeneratorCustom.project
目录 0 2018-09-01 17:38 mybatisGeneratorCustom.settings
............此处省略16个文件信息
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 GeneratorSqlmap {
public void generator() throws Exception{
List warnings = new ArrayList();
boolean overwrite = true;
//指定 逆向工程配置文件
File configFile = new File(“generatorConfig.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);
}
public static void main(String[] args) throws Exception {
try {
GeneratorSqlmap generatorSqlmap = new GeneratorSqlmap();
generatorSqlmap.generator();
} catch (Exception e) {
e.printStackTrace();
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-09-01 17:38 mybatisGeneratorCustom
文件 542 2017-09-06 14:04 mybatisGeneratorCustom.classpath
目录 0 2018-08-25 22:20 mybatisGeneratorCustom.git
目录 0 2017-09-06 14:04 mybatisGeneratorCustom.gitranches
文件 264 2017-09-06 14:04 mybatisGeneratorCustom.gitconfig
文件 127 2017-09-06 14:04 mybatisGeneratorCustom.gitFETCH_HEAD
文件 23 2017-09-06 14:04 mybatisGeneratorCustom.gitHEAD
目录 0 2017-09-06 14:04 mybatisGeneratorCustom.githooks
文件 1624 2017-09-06 14:04 mybatisGeneratorCustom.gitindex
目录 0 2018-08-25 22:20 mybatisGeneratorCustom.gitlogs
文件 146 2017-09-06 14:04 mybatisGeneratorCustom.gitlogsHEAD
目录 0 2018-08-25 22:20 mybatisGeneratorCustom.gitlogs
efs
目录 0 2018-08-25 22:20 mybatisGeneratorCustom.gitlogs
efsheads
文件 146 2017-09-06 14:04 mybatisGeneratorCustom.gitlogs
efsheadsmaster
目录 0 2018-08-25 22:20 mybatisGeneratorCustom.gitlogs
efs
emotes
目录 0 2018-08-25 22:20 mybatisGeneratorCustom.gitlogs
efs
emotesorigin
文件 160 2017-09-06 14:04 mybatisGeneratorCustom.gitlogs
efs
emotesoriginmaster
目录 0 2018-08-25 22:20 mybatisGeneratorCustom.gitob
目录 0 2017-09-06 14:04 mybatisGeneratorCustom.gitob
目录 0 2018-08-25 22:20 mybatisGeneratorCustom.gitob
文件 2584 2017-09-06 14:04 mybatisGeneratorCustom.gitob
文件 6092631 2017-09-06 14:04 mybatisGeneratorCustom.gitob
目录 0 2018-08-25 22:20 mybatisGeneratorCustom.git
efs
目录 0 2018-08-25 22:20 mybatisGeneratorCustom.git
efsheads
文件 41 2017-09-06 14:04 mybatisGeneratorCustom.git
efsheadsmaster
目录 0 2018-08-25 22:20 mybatisGeneratorCustom.git
efs
emotes
目录 0 2018-08-25 22:20 mybatisGeneratorCustom.git
efs
emotesorigin
文件 41 2017-09-06 14:04 mybatisGeneratorCustom.git
efs
emotesoriginmaster
目录 0 2017-09-06 14:04 mybatisGeneratorCustom.git
efs ags
文件 381 2017-09-06 14:04 mybatisGeneratorCustom.project
目录 0 2018-09-01 17:38 mybatisGeneratorCustom.settings
............此处省略16个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)