-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ feat(query-utils): 引入 QueryCondition 记录类型并优化动态 SQL 构建逻辑
- 添加 `QueryCondition` 记录类型以清晰表达查询条件。 - 在 `QueryJsonHelper` 中增强错误处理与 JSON 查询路径构建。 - 优化 `QueryHelper` 中的条件生成逻辑,支持特殊关键字处理与参数化构建。 - 调整 `LoggerRequest` 的 `buildQueryFragment` 方法以适配新逻辑。
- Loading branch information
Showing
4 changed files
with
159 additions
and
104 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
boot/platform/src/main/java/com/plate/boot/commons/utils/query/QueryCondition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.plate.boot.commons.utils.query; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* Represents a single condition for a database query, encapsulating the operation, | ||
* the corresponding SQL fragment, and the parameters required for the query. | ||
* <p> | ||
* This record is primarily used within SQL construction logic to dynamically | ||
* build WHERE clauses based on provided criteria, supporting various comparison | ||
* and set-based operations through its components. | ||
* | ||
* @param operation A Map.Entry consisting of a keyword indicating the type of operation (e.g., equality, range) | ||
* and a placeholder or specific SQL syntax related to the operation. | ||
* @param sql The SQL fragment representing the condition without actual values, | ||
* with placeholders for parameters. | ||
* @param params A map mapping parameter placeholders used in the SQL fragment to their intended values. | ||
*/ | ||
public record QueryCondition( | ||
String sql, | ||
Map<String, Object> params, | ||
Map.Entry<String, String> operation) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.