JpaRepository 查询规范

JpaRepository支持接口规范方法名查询

如果在接口中定义的查询方法符合它的命名规则,就可以不用写实现,目前支持的关键字如下

Keyword Sample
IsNotNull findByIdNotNull
Like findByIdLike
NotLike findByIdNotLike
StartingWith findBy****StartingWith
EndingWith 其余如上格式
Containing  
OrderBy(特殊) findBy***OrderBy**(ASC/DESC)
Not  
In  
NotIn  
True  
False  
And  
Or  
Between  
LessThan  
GreaterThan  
IsNull  

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

SpringData  在动态生成执行SQL时, 是基于类名而不是 路径,  因此要避免类名重复

posted @ 2024-08-29 18:39  苏汐sama  阅读(56)  评论(0)    收藏  举报