新一代国产 ORM 框架 sagacity-sqltoy-5.2.10 发版


开源地址:

  • github: https://github.com/sagframe/sagacity-sqltoy
  • gitee: https://gitee.com/sagacity/sagacity-sqltoy
  • idea 插件 (可直接在 idea 中检索安装):  https://github.com/threefish/sqltoy-idea-plugins

更新内容

1、增加h2数据库的支持,便于开展项目测试
2、getTranslateCache支持返回Map类型
3、优化loadAll功能,按照查询顺序输出结果
4、增加sql自定义处理拦截器用于进行类似租户过滤等(beta),spring.sqltoy.sqlInterceptors数组
 

public interface SqlInterceptor {
    /**
     * @TODO 对最终执行sql和sql参数进行处理
     * @param sqlToyContext 支持getEntityMeta(tableName)获取表信息
     * @param sqlToyConfig  传递原本的sql配置,可以通过获取paramNames判断是否sql中已经有相关参数
     * @param operateType search\page\top\random\count 等,
     * @param sqlToyResult 存放了最终的sql 和paramValues
     * @param entityClass 对象crud操作对应的pojo类型(仅对象crud有值)
     * @param dbType 当前数据库类型,通过DBType.xxx 进行对比
     * @return
     */
    public default SqlToyResult decorate(SqlToyContext sqlToyContext,SqlToyConfig sqlToyConfig,  OperateType operateType, SqlToyResult sqlToyResult,Class entityClass,Integer dbType) {
    /**
     * 注意: 开启sqlToyContext.getEntityMeta(tableName)获得pojo的注解(表字段等),需要设置
     * spring.sqltoy.packagesToScan 数组属性(pojo的路径),让sqltoy启动时主动加载pojo
     */
    return sqlToyResult;
    }
}

 

sqltoy 的关键优势:

//------------------了解 sqltoy的关键优势: -------------------------------------------------------------------------------------------*/
//1、最简最直观的sql编写方式(不仅仅是查询语句),采用条件参数前置处理规整法,让sql语句部分跟客户端保持高度一致
//2、sql中支持注释(规避了对hint特性的影响,知道hint吗?搜oracle hint),和动态更新加载,便于开发和后期维护整个过程的管理
//3、支持缓存翻译和反向缓存条件检索(通过缓存将名称匹配成精确的key),实现sql简化和性能大幅提升
//4、支持快速分页和分页优化功能,实现分页最高级别的优化,同时还考虑到了cte多个with as情况下的优化支持
//5、支持并行查询
//6、根本杜绝sql注入问题
//7、支持行列转换、分组汇总求平均、同比环比计算,在于用算法解决复杂sql,同时也解决了sql跨数据库问题
//8、支持保留字自动适配
//9、支持跨数据库函数自适配,从而非常有利于一套代码适应多种数据库便于产品化,比如oracle的nvl,当sql在mysql环境执行时自动替换为ifnull
//10、支持分库分表
//11、提供了取top、取random记录、树形表结构构造和递归查询支持、updateFetch单次交互完成修改和查询等实用的功能
//12、sqltoy的update、save、saveAll、load 等crud操作规避了jpa的缺陷,参见update(entity,String...forceUpdateProps)和updateFetch
//13、提供了极为人性化的条件处理:排它性条件、日期条件加减和提取月末月初处理等
//14、提供了查询结果日期、数字格式化、安全脱敏处理,让复杂的事情变得简单,大幅简化sql或结果的二次处理工作
//-----------------------------------------------------------------------------------*/

sqltoy 特点介绍:

  • sqltoy 的核心构建思想

  • sqltoy 的对比 mybatis (plus) 的核心点:查询语句编写、可阅读性、可维护性

  • 对象化 crud 是基础,但 sqltoy 有针对性的改进:update、updateSaveFetch、updateFetch 等

  • sqltoy 的缓存翻译,大幅减少表关联简化 sql,让你的查询性能成几何级提升

  • 极致的分页,同样帮助你实现查询的性能大幅提升
  1. 快速分页:@fast () 实现先取单页数据然后再关联查询,极大提升速度
  2. 分页优化器:page-optimize 让分页查询由两次变成 1.3~1.5 次 (用缓存实现相同查询条件的总记录数量在一定周期内无需重复查询
  3. sqltoy 的分页取总记录的过程不是简单的 select count (1) from (原始 sql);而是智能判断是否变成:select count (1) from 'from 后语句 ', 并自动剔除最外层的 order by
  4. sqltoy 支持并行查询:parallel="true",同时查询总记录数和单页数据,大幅提升性能
 
  • 便利的跨数据库统计计算:数据旋转
  • 便利的跨数据库统计计算:无限极分组统计 (含汇总求平均)
  • 便利的跨数据库统计计算:同比环比

相關推薦

2023-11-08

开源地址: github: https://github.com/sagframe/sagacity-sqltoy gitee: https://gitee.com/sagacity/sagacity-sqltoy idea 插件 (可直接在 idea 中检索安装):  https://github.com/threefish/sqltoy-idea-plugins sqltoy 脚手架项目:https://gitee.com/momoljw/ss

2023-11-18

开源地址: github: https://github.com/sagframe/sagacity-sqltoy gitee: https://gitee.com/sagacity/sagacity-sqltoy idea 插件 (可直接在 idea 中检索安装):  https://github.com/threefish/sqltoy-idea-plugins sqltoy 脚手架项目:https://gitee.com/momoljw/ss

2023-10-28

开源地址: github: https://github.com/sagframe/sagacity-sqltoy gitee: https://gitee.com/sagacity/sagacity-sqltoy idea 插件 (可直接在 idea 中检索安装):  https://github.com/threefish/sqltoy-idea-plugins sqltoy 脚手架项目:https://gitee.com/momoljw/ss

2023-04-22

开源地址: github: https://github.com/sagframe/sagacity-sqltoy gitee: https://gitee.com/sagacity/sagacity-sqltoy idea 插件 (可直接在 idea 中检索安装):  https://github.com/threefish/sqltoy-idea-plugins 更新内容 1、修复sqlserver数据库update和s

2023-09-19

开源地址: github: https://github.com/sagframe/sagacity-sqltoy gitee: https://gitee.com/sagacity/sagacity-sqltoy idea 插件 (可直接在 idea 中检索安装):  https://github.com/threefish/sqltoy-idea-plugins sqltoy 脚手架项目:https://gitee.com/momoljw/ss

2023-10-19

聊 AI!>>> 开源地址: github: https://github.com/sagframe/sagacity-sqltoy gitee: https://gitee.com/sagacity/sagacity-sqltoy idea 插件 (可直接在 idea 中检索安装):  https://github.com/threefish/sqltoy-idea-plugins sqltoy 脚手架项目:https://gitee

2022-11-01

开源地址: github: https://github.com/sagframe/sagacity-sqltoy gitee: https://gitee.com/sagacity/sagacity-sqltoy idea 插件 (可直接在 idea 中检索安装):  https://github.com/threefish/sqltoy-idea-plugins 更新内容 1、增强错误提示,优化部分

2023-07-21

开源地址: github: https://github.com/sagframe/sagacity-sqltoy gitee: https://gitee.com/sagacity/sagacity-sqltoy idea 插件 (可直接在 idea 中检索安装):  https://github.com/threefish/sqltoy-idea-plugins sqltoy 脚手架项目:https://gitee.com/momoljw/ss

2023-10-25

AI 时代 开源地址: github: https://github.com/sagframe/sagacity-sqltoy gitee: https://gitee.com/sagacity/sagacity-sqltoy idea 插件 (可直接在 idea 中检索安装):  https://github.com/threefish/sqltoy-idea-plugins sqltoy 脚手架项目:https://gitee.co

2023-06-30

开源地址: github: https://github.com/sagframe/sagacity-sqltoy gitee: https://gitee.com/sagacity/sagacity-sqltoy idea 插件 (可直接在 idea 中检索安装):  https://github.com/threefish/sqltoy-idea-plugins 更新内容 1、全面开放xml中的功能在find

2023-09-14

讲回顾 开源地址: github: https://github.com/sagframe/sagacity-sqltoy gitee: https://gitee.com/sagacity/sagacity-sqltoy idea 插件 (可直接在 idea 中检索安装):  https://github.com/threefish/sqltoy-idea-plugins sqltoy 脚手架项目:https://gitee.c

2023-11-25

值的领域 开源地址: github: https://github.com/sagframe/sagacity-sqltoy gitee: https://gitee.com/sagacity/sagacity-sqltoy idea 插件 (可直接在 idea 中检索安装):  https://github.com/threefish/sqltoy-idea-plugins sqltoy 脚手架项目:https://gitee

2023-12-05

开源地址: github: https://github.com/sagframe/sagacity-sqltoy gitee: https://gitee.com/sagacity/sagacity-sqltoy idea 插件 (可直接在 idea 中检索安装):  https://github.com/threefish/sqltoy-idea-plugins sqltoy 脚手架项目:https://gitee.com/momoljw/ss

2023-09-17

Wood,微型 Java ORM 框架(支持:java sql,xml sql,annotation sql;事务;缓存;监控;等...),零依赖! 特点和理念: 跨平台:可以嵌入到JVM脚本引擎(js, groovy, lua, python, ruby)及GraalVM支持的部分语言。 很小巧:0.2Mb(且是功