本文档提供了 Spring Data Commons Page
类的 @Query
关键字参考资料,这些关键字用于构建动态查询方法并配置结果页面的分页、排序和投影。它涵盖了与分页、排序、投影和聚合相关的关键字,并提供了示例代码片段以说明其用法。
Repository query keywords
Supported query method subject keywords
下表列出了 Spring Data 存储库查询派生机制通常支持的主体关键字,以表示谓词。有关受支持关键字的确切列表,请查阅特定存储区的文档,因为此处列出的某些关键字可能在特定存储区中不受支持。
The following table lists the subject keywords generally supported by the Spring Data repository query derivation mechanism to express the predicate. Consult the store-specific documentation for the exact list of supported keywords, because some keywords listed here might not be supported in a particular store.
Keyword | Description |
---|---|
|
General query method returning typically the repository type, a |
|
Exists projection, returning typically a |
|
Count projection returning a numeric result. |
|
Delete query method returning either no result ( |
|
Limit the query results to the first |
|
Use a distinct query to return only unique results. Consult the store-specific documentation whether that feature is supported. This keyword can occur in any place of the subject between |
Supported query method predicate keywords and modifiers
下表列出了 Spring Data 存储库查询派生机制通常支持的谓词关键字。但是,有关受支持关键字的确切列表,请查阅特定存储区的文档,因为此处列出的某些关键字可能在特定存储区中不受支持。
The following table lists the predicate keywords generally supported by the Spring Data repository query derivation mechanism. However, consult the store-specific documentation for the exact list of supported keywords, because some keywords listed here might not be supported in a particular store.
Logical keyword | Keyword expressions |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
除了过滤器谓词之外,还支持以下修改器列表:
In addition to filter predicates, the following list of modifiers is supported:
Keyword | Description |
---|---|
|
Used with a predicate keyword for case-insensitive comparison. |
|
Ignore case for all suitable properties. Used somewhere in the query method predicate. |
|
Specify a static sorting order followed by the property path and direction (e. g. |