Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
E

easy-query

> 数据库
Open source

java/kotlin high performance lightweight solution for jdbc query,support oltp and olap query,一款java下面支持强类型、轻量级、高性能的ORM,致力于解决jdbc查询,拥有对象模型筛选、隐式子查询、隐式join

769 stars0 likes0 views
WebsiteGitHub

About

java/kotlin high performance lightweight solution for jdbc query,support oltp and olap query,一款java下面支持强类型、轻量级、高性能的ORM,致力于解决jdbc查询,拥有对象模型筛选、隐式子查询、隐式join

English | 中文

Special user

全项目基于.Net专业团队自研,源头工厂,价格约是官方的二十分之一不到,获得全网数万用户好评,稳定安全,快速可靠!

  • ①支持 编程/对话/视频/图片/翻译/知识库/插件 直接使用 等等。
  • ②支持全球顶流模型,支持最强编程ClaudeCode/Codex/GeminiCli。
  • ③支持一个key通用claude、gpt、gemini等全站模型。
  • ④包售后,充值后提供1对1售后服务,手把手教玩ai 。

用Ai就选择意心Ai,省心放心爽用!让你不再有Ai焦虑!

ai skill

https://github.com/wzszsw/easy-query-orm

documentation

QQGroup:170029046

Five Implicit Features

  • Implicit Join - Automatically implements join queries for OneToOne and ManyToOne relationships, supporting filtering, sorting, and result fetching
  • Implicit Subquery - Automatically handles subqueries for OneToMany and ManyToMany relationships, supporting filtering, sorting, and aggregate function results
  • Implicit Grouping - Optimizes and merges multiple subqueries into grouped queries for OneToMany and ManyToMany relationships, supporting filtering, sorting, and aggregate functions
  • Implicit Partition Grouping - Enables first/Nth element operations for OneToMany and ManyToMany relationships, supporting filtering, sorting, and aggregate function results
  • Implicit CASE WHEN Expression - property.aggregate.filter() syntax, e.g., o.age().sum().filter(()->o.name().like("123"))

Company OneToMany SysUser

Implicit Join

List userInXXCompany = entityQuery.queryable(SysUser.class)
        .where(user -> {
            user.company().name().like("xx Company");
        })
        .orderBy(user -> {
            user.company().registerMoney().desc();
            user.birthday().asc();
        }).toList();

Implicit Subquery

List companies = entityQuery.queryable(Company.class)
        .where(company -> {
          company.users().any(u -> u.name().like("Xiao Ming"));
          company.users().where(u -> u.name().like("Xiao Ming"))
                  .max(u -> u.birthday()).gt(LocalDateTime.of(2000,1,1,0,0,0));
        }).toList();

Implicit Grouping

List companies = entityQuery.queryable(Company.class)
        // Two subqueries in where will be merged
        .subQueryToGroupJoin(company -> company.users())
        .where(company -> {
          company.users().any(u -> u.name().like("Xiao Ming"));
          company.users().where(u -> u.name().like("Xiao Ming"))
                  .max(u -> u.birthday()).gt(LocalDateTime.now());
        }).toList();

Implicit Partition Grouping

List companies = entityQuery.queryable(Company.class)
        .where(company -> {
          company.users().orderBy(u->u.birthday().desc()).first().name().eq("Xiao Ming");
          company.users().orderBy(u->u.birthday().desc()).element(0)
                  .birthday().lt(LocalDateTime.now());
        }).toList();

Implicit CASE WHEN Expression

…

Complete Single-Table Example

First, let's look at a complete single-table query example involving filtering, aggregation, aggregate filtering, projection, and sorting.

…

Introduction

  • Usage Guide
    • Overview
    • How to Get the Latest Version
    • Installation
  • Getting Started
    • Single Table Query
    • Multi-Table Query
    • Complex Query
    • Dynamic Table Names
    • Insert
    • Update
    • Delete
    • Union/ALL Query
    • Subquery
  • Sharding
    • Table Sharding
    • Database Sharding
  • support

Usage-Guide

easy-query is a high-performance, lightweight, and versatile Java/Kotlin object query ORM framework that supports database sharding and read-write separation.

Overview

easy-query is a dependency-free JAVA/Kotlin ORM framework, extremely lightweight, with high performance. It supports single table queries, multi-table queries, union, subqueries, pagination, dynamic table names, VO object query returns, logical deletion, global interception, database column encryption (supporting high-performance LIKE queries), data tracking for differential updates, optimistic locking, multi-tenancy, automatic database sharding, automatic table sharding, read-write separation, and supports full-featured external extension customization of the framework, with strong-typed expressions.

Get-Latest-Version

https://central.sonatype.com/ search com.easy-query获取最新Installation包

single table preview

…

console

for mysql


  last-version

com.easy-query
sql-api-proxy
${easy-query.version}

        

com.easy-query
sql-mysql
${easy-query.version}
…

Getting-Started

sql script

…

query entity

…

Single-Table-Query

Topic topic = easyEntityQuery
                .queryable(Topic.class)
                .where(o -> o.id().eq("3"))
                .firstOrNull();      
==> Preparing: SELECT t.`id`,t.`stars`,t.`title`,t.`create_time` FROM `t_topic` t WHERE t.`id` = ? LIMIT 1
==> Parameters: 3(String)
 t.id().eq(t1.id()))
               .where(o -> {
                    o.id().eq("3");
                    o.title().eq("4");
                })
               .firstOrNull();
…
==> Preparing: SELECT COUNT(*) FROM (SELECT t1.`id` AS `id`,SUM(t1.`score`) AS `score` FROM `t_topic` t INNER JOIN `t_blog` t1 ON t1.`deleted` = ? AND t.`id` = t1.`id` WHERE t1.`title` IS NOT NULL GROUP BY t1.`id`) t2
  ==> Parameters: false(Boolean)
 Preparing: SELECT t1.`id` AS `id`,SUM(t1.`score`) AS `score` FROM `t_topic` t INNER JOIN `t_blog` t1 ON t1.`deleted` = ? AND t.`id` = t1.`id` WHERE t1.`title` IS NOT NULL GROUP BY t1.`id` LIMIT 20
==> Parameters: false(Boolean)
"aa_bb_cc")
        .where(o -> o.id().eq("123"))
        .toList();
     
 SELECT t.`id`,t.`create_time`,t.`update_time`,t.`create_by`,t.`update_by`,t.`deleted`,t.`title`,t.`content`,t.`url`,t.`star`,t.`publish_time`,t.`score`,t.`status`,t.`order`,t.`is_top`,t.`top` FROM `aa_bb_cc` t WHERE t.`deleted` = ? AND t.`id` = ?  

Insert


Topic topic = new Topic();
topic.setId(String.valueOf(0));
topic.setStars(100);
topic.setTitle("标题0");
topic.setCreateTime(LocalDateTime.now().plusDays(i));

long rows = easyEntityQuery.insertable(topic).executeRows();

//返回结果rows为1
==> Preparing: INSERT INTO `t_topic` (`id`,`stars`,`title`,`create_time`) VALUES (?,?,?,?) 
==> Parameters: 0(String),100(Integer),标题0(String),2023-03-16T21:34:13.287(LocalDateTime)
 o.id().eq("7")).firstNotNull("未找到对应的数据");
        String newTitle = "test123" + new Random().nextInt(100);
        topic.setTitle(newTitle);

long rows=easyEntityQuery.updatable(topic).executeRows();
…
==> Preparing: UPDATE t_topic SET `stars` = ? WHERE `id` = ?
==> Parameters: 12(Integer),2(String)
o.title().eq("title998"))
                    .executeRows();
==> Preparing: DELETE FROM t_topic WHERE `title` = ?
==> Parameters: title998(String)
 Preparing: DELETE FROM t_topic WHERE `id` = ?
==> Parameters: 997(String)
 q1 = easyQuery
                .queryable(Topic.class);
Queryable q2 = easyQuery
        .queryable(Topic.class);
Queryable q3 = easyQuery
        .queryable(Topic.class);
List list = q1.union(q2, q3).where(o -> o.eq(Topic::getId, "123321")).toList();
…
==> Preparing: SELECT t.`id`,t.`stars`,t.`title`,t.`create_time` FROM `t_topic` t WHERE t.`id` IN (SELECT t1.`id` FROM `t_blog` t1 WHERE t1.`deleted` = ? AND t1.`id` = ?)
  ==> Parameters: false(Boolean),1(String)
 o.id().eq("1" ));

List list2 = easyEntityQuery.queryable(Topic.class)
        .where(o -> {
        o.exists(() -> where.where(q -> q.id().eq(o.id())));
        }).toList();
…

数据库脚本参考源码

其中shardingInitializer为Sharding初始化器用来初始化告诉框架有多少Sharding的表名(支持动态添加)

ShardingTableKey表示哪个字段作为Sharding键(Sharding键不等于主键)

执行sql

LocalDateTime beginTime = LocalDateTime.of(2021, 1, 1, 1, 1);
LocalDateTime endTime = LocalDateTime.of(2021, 5, 2, 1, 1);
Duration between = Duration.between(beginTime, endTime);
long days = between.toDays();
List list = easyQuery.queryable(TopicShardingTime.class)
        .where(o->o.rangeClosed(TopicShardingTime::getCreateTime,beginTime,endTime))
        .orderByAsc(o -> o.column(TopicShardingTime::getCreateTime))
        .toList();
…
LocalDateTime beginTime = LocalDateTime.of(2020, 1, 1, 1, 1);
LocalDateTime endTime = LocalDateTime.of(2023, 5, 1, 1, 1);
Duration between = Duration.between(beginTime, endTime);
long days = between.toDays();
EasyPageResult pageResult = easyQuery.queryable(TopicShardingDataSource.class)
        .orderByAsc(o -> o.column(TopicShardingDataSource::getCreateTime))
        .toPageResult(1, 33);
…

support

博客

个人QQ:326308290(欢迎技术支持提供您宝贵的意见)

个人邮箱:[email protected]

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Javajavajdbcjoinkotlin

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category数据库
PricingOpen source

> Related tools

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库