在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:myfat开源软件地址:https://gitee.com/drinkjava2/myfat开源软件介绍:MyFat让MyBatis更胖 简介 | IntroMyFat是MyBatis的DAO功能增强插件,利用全功能持久层工具jSqlBox来补足MyBatis的短板。 优点 | Advantages
与其它Mybatis插件如Mapper或MyBatis-Plus的区别
文档 | Documentation配置 | Configuration在pom.xml中加入以下内容即可,注意MyFat必须先于MyBatis加载: <dependency> <groupId>com.github.drinkjava2</groupId> <artifactId>myfat</artifactId> <version>3.0.0</version> <!--或最新版--></dependency> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis</artifactId> <version>3.5.2</version> <!--或最新版--> </dependency> 如果在Spring环境下,则上面的第二项要改成Spring的包,如: <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>2.1.0</version> <!--或最新版--> </dependency> 入门 | First Example以下示例演示了myfat的基本配置和使用: public class HelloWorld implements ActiveEntity<HelloWorld> { private String name; public String getName() {return name; } public void setName(String name) {this.name = name; } public static void main(String[] args) { DataSource ds = JdbcConnectionPool .create("jdbc:h2:mem:DBName;MODE=MYSQL;DB_CLOSE_DELAY=-1;TRACE_LEVEL_SYSTEM_OUT=0", "sa", ""); SqlBoxContext ctx = new SqlBoxContext(ds); SqlBoxContext.setGlobalSqlBoxContext(ctx); String[] ddls = ctx.toCreateDDL(HelloWorld.class); for (String ddl : ddls) ctx.nExecute(ddl); new HelloWorld().putField("name", "Hello myfat").insert(); System.out.println(ctx.iQueryForString("select name from HelloWorld")); }} 范例 | Demo
作者其它开源项目 | Other Projects期望 | Futures欢迎发issue提出更好的意见或提交PR,帮助完善myfat 版权 | License关注我 | About Me |
请发表评论