Skip to content

feat(条件构造): 增加已有条件显式分组能力 - #130

Merged
zhou-hao merged 2 commits into
4.2from
codex/conditional-group
Oct 29, 2026
Merged

zhou-hao merged 2 commits into
4.2from
codex/conditional-group

Conversation

@zhou-hao

@zhou-hao zhou-hao commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

已有业务条件包含 OR 时,再通过 nest() 追加过滤条件无法保证整个业务范围与过滤范围求交,上层因此不得不识别具体 DSL 并改写内部条件列表。新增显式 Conditional.group() 和 NestConditional.group(),让构造器自行将已有条件整体分组,例如 is("a", 1).or("b", 2).group().nest().is("c", 3).end() 生成 (a = 1 OR b = 2) AND (c = 3)。

  • core Query/Update/Delete、同步及响应式 RDB 构造器统一委托参数层分组,保留更新内容、字段筛选、分页和上下文。
  • 支持空条件、单条件、只读列表和连续分组;保留 nest() / orNest() 追加新分组的原有语义。
  • NestConditional.group() 只重组当前层已有子条件,复用根条件分组逻辑,支持多层嵌套;保留外层 AND/OR、承载字段和值,以及 end() 的父级返回对象。
  • 自定义实现仅在调用新方法时需要适配;默认明确抛出 UnsupportedOperationException,避免静默跳过分组。公共接口和 README 已同步说明。

验证使用 JDK 21:52 项测试通过,0 失败、0 错误、0 跳过。新增 11 项 core 契约测试、12 项使用正式同步/响应式构造器和 H2 执行器的 SQL 回归;其余 29 项覆盖既有查询、更新、删除及 CRUD 事件上下文。

mvn -o \
  '-Dtest=ConditionalGroupTest,ConditionalGroupIntegrationTest,QueryTest,QueryDslBusinessTest,UpdateDeleteTest,DefaultQueryUpdateCoverageTest,DefaultSyncQueryTest,DefaultSyncRepositoryTest,DefaultReactiveRepositoryTest,SyncCrudEventContextIntegrationTest' \
  -Dsurefire.failIfNoSpecifiedTests=false -Djacoco.skip=true -Dmaven.javadoc.skip=true test

消费者:components #1678。须先合并并发布包含此能力的 core/RDB 4.2.3-SNAPSHOT,再集成消费者;开发机本地安装不能替代干净 CI 的依赖供应。

@codecov-commenter

codecov-commenter commented Oct 29, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 96.77419% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 79.63%. Comparing base (68b2764) to head (c0830ce).
⚠️ Report is 60 commits behind head on 4.2.

Files with missing lines Patch % Lines
...org/hswebframework/ezorm/core/NestConditional.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##                4.2     #130       +/-   ##
=============================================
+ Coverage     64.92%   79.63%   +14.70%     
- Complexity     2341     3468     +1127     
=============================================
  Files           343      376       +33     
  Lines          9375    11076     +1701     
  Branches        940     1342      +402     
=============================================
+ Hits           6087     8820     +2733     
+ Misses         2810     1607     -1203     
- Partials        478      649      +171     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@zhou-hao
zhou-hao merged commit 96b61b0 into 4.2 Oct 29, 2026
1 check passed
@zhou-hao
zhou-hao deleted the codex/conditional-group branch October 29, 2026 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants