建设工程设计招标信息网站.,鹰潭做网站的公司,香烟网上商城,洛阳营销型网站建设文章目录 前言函数查询表格 前言
函数查询的表格参考了官网的 2.7.3 版本的文档#xff0c;JPA 的这种函数式查询方法改动不大#xff0c;如果想知道更多的复杂查询#xff0c;可以参考这篇文章 【Spring Data JPA】基于 JpaRepository 增删改查
官方文档地址 Spring Data… 文章目录 前言函数查询表格 前言
函数查询的表格参考了官网的 2.7.3 版本的文档JPA 的这种函数式查询方法改动不大如果想知道更多的复杂查询可以参考这篇文章 【Spring Data JPA】基于 JpaRepository 增删改查
官方文档地址 Spring Data JPA 2.7.3官方文档 函数查询表格
关键字关键字意思函数写法SQL 写法Distinctdistinct 去重findDistinctByLastnameAndFirstnameselect distinct … where x.lastname ?1 and x.firstname ?2Andand 关联findByLastnameAndFirstname… where x.lastname ?1 and x.firstname ?2Oror 或者findByLastnameOrFirstname… where x.lastname ?1 or x.firstname ?2Isis 是与Equals一样findByFirstname findByFirstnameIs… where x.firstname ?1Equals等于findByFirstname findByFirstnameEquals… where x.firstname ?1Betweenbetween 之间findByStartDateBetween… where x.startDate between ?1 and ?2LessThanlessThan 小于findByAgeLessThan… where x.age ?1LessThanEquallessThanEqual 小于等于findByAgeLessThanEqual… where x.age ?1GreaterThangreaterThan 大于findByAgeGreaterThan… where x.age ?1GreaterThanEqualgreaterThan 大于等于findByAgeGreaterThanEqual… where x.age ?1After大于一般用在时间findByStartDateAfter… where x.startDate ?1Before小于一般用在时间findByStartDateBefore… where x.startDate ?1IsNull是 nullfindByAgeIsNull… where x.age is nullNull是 nullfindByAgeNull… where x.age is nullIsNotNull不是 nullfindByAgeIsNotNull… where x.age not nullNotNull不是 nullfindByAgeNotNull… where x.age not nullLike模糊查询findByFirstnameLike… where x.firstname like ?1NotLike不模糊查询findByFirstnameNotLike… where x.firstname not like ?1OrderBy排序findByAgeOrderByLastnameDesc… where x.age ?1 order by x.lastname descNotnotfindByLastnameNot… where x.lastname ?1Inin 查询findByAgeIn(Collection ages)… where x.age in ?1NotInnot in 查询findByAgeNotIn(Collection ages)… where x.age not in ?1True是 truefindByActiveTrue()… where x.active trueFalse是 falsefindByActiveFalse… where x.active false