BeetlSQL,Java Dao工具 BeetlSQL

码农软件 · 软件分类 · ORM/持久层框架 · 2019-09-23 15:43:08

软件介绍

BeetlSQL 是一个全功能 DAO 工具,同时具有 Hibernate 优点 & Mybatis 优点功能,适用于承认以 SQL 为中心,同时又需求工具能自动能生成大量常用的 SQL 的应用。

BeetlSQL介绍
派别:SQL为中心
  * 强化SQL管理,通过md文件管理sql,使用Beetl模板编写复杂sql
  * 简单SQL可以通过Query类链式API完成
   * 内置常见增删改查功能,节省项目50%工作量
* 全面支持跨数据库平台
* 支持一对一,一对多等常见的ORM映射
* 其他
   * 具备代码生成功能
   * 主从支持
   * 支持Interceptor,如Debug,Cache等


内置增删改查

void insert(T entity);
int updateById(T entity);
int updateTemplateById(T entity);
int deleteById(Object key);
T unique(Object key);
T single(Object key);
T lock(Object key);
List<T> all(); 
List<T> template(T entity);
<T> T templateOne(T entity); 
List<T> execute(String sql,Object... args);
....等等大量内置方法且可以扩展内置方法



Query查询

List<User> list = userDao.createQuery().andEq("name","hi").orderBy("create_date").select();

如果是Java8,且引入了对jaque库依赖,则可以

List<User> list1  = userDao.createQuery().lamdba().andEq(User::getName, "hi").orderBy(User::getCreateDate).select();

管理SQL

@SqlResource("console.user")
public interface UserConsoleDao extends BaseMapper<SysUser> {

    void batchDelUserByIds(List<Long> ids);
    void batchUpdateUserState( List<Long> ids,  GeneralStateEnum stateEnum);
    @Sql("update sys_user set password=? where id=?")
    int changePassword(String newPassword,long id);


}


对应的sql文件是console/user.md,内容如下

batchDelUserByIds
===
    update SYS_USER u set u.del_flag = 1 where u.id in( #join(ids)#)
    
batchUpdateUserState
===
    update SYS_USER u set u.state = #state# where u.id in( #join(ids)#)

关系映射

selectUserAndDepartment
===
    select * from user where user_id=#userId#
    @ orm.single({"departmentId":"id"},"Department");
    @ orm.many({"id":"userId"},"user.selectRole","Role");


user.selectRole
===

    select r.* from user_role ur left join role r on ur.role_id=r.id
where ur.user_id=#userId#

也支持注解说明映射关系

与hiberante,myabtis比较

本文地址:https://www.codercto.com/soft/d/15235.html

Getting Started with C++ Audio Programming for Game Development

Getting Started with C++ Audio Programming for Game Development

David Gouveia

Written specifically to help C++ developers add audio to their games from scratch, this book gives a clear introduction to the concepts and practical application of audio programming using the FMOD li......一起来看看 《Getting Started with C++ Audio Programming for Game Development》 这本书的介绍吧!

随机密码生成器
随机密码生成器

多种字符组合密码

URL 编码/解码
URL 编码/解码

URL 编码/解码