-
分页和排序: first(), last(), previous(), next(), sort()
-
条件查询: between(), lessThan(), greaterThan(), isNull()
-
投影和分组: groupBy(), having(), project()
-
联合查询和自定义实施: disjunction(), conjunction(), customImplementation()
使用这些关键字,开发人员可以轻松创建复杂查询,而无需编写原生 SQL 或使用复杂映射。这简化了数据访问并提高了应用程序的开发效率和可维护性。
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. |