国产成人精品久久免费动漫-国产成人精品天堂-国产成人精品区在线观看-国产成人精品日本-a级毛片无码免费真人-a级毛片毛片免费观看久潮喷

您的位置:首頁技術文章
文章詳情頁

Spring Data JPA 關鍵字Exists的用法說明

瀏覽:5日期:2023-07-11 16:11:14
Spring Data JPA 關鍵字Exists

查詢數據庫中的此數據是否已存在:

例子:

查詢sys_user表中的一個user是否存在,類SysUser對應的是數據庫中的sys_user表,SysUserId是表sys_user的主鍵類(ID類)。

如果查詢一個user,user的accountNo為demo。

userID為demo1,表sys_user的主鍵是accountNo和userID,下面代碼中的方法是查詢這個user是否存在,如果存在則返回true,不存在則返回false。

@Repositorypublic interface SysUserRepository extends JpaRepository<SysUser, SysUserId> { @Override boolean exists(SysUserId sysUserId);}Spring data jpa支持的關鍵字介紹 Sample JPQL snippet

And

findByLastnameAndFirstname

… where x.lastname = ?1 and x.firstname = ?2

Or

findByLastnameOrFirstname

… where x.lastname = ?1 or x.firstname = ?2

Is,Equals

findByFirstname,findByFirstnameIs,findByFirstnameEquals

… where x.firstname = ?1

Between

findByStartDateBetween

… where x.startDate between ?1 and ?2

LessThan

findByAgeLessThan

… where x.age < ?1

LessThanEqual

findByAgeLessThanEqual

… where x.age <= ?1

GreaterThan

findByAgeGreaterThan

… where x.age > ?1

GreaterThanEqual

findByAgeGreaterThanEqual

… where x.age >= ?1

After

findByStartDateAfter

… where x.startDate > ?1

Before

findByStartDateBefore

… where x.startDate < ?1

IsNull

findByAgeIsNull

… where x.age is null

IsNotNull,NotNull

findByAge(Is)NotNull

… where x.age not null

Like

findByFirstnameLike

… where x.firstname like ?1

NotLike

findByFirstnameNotLike

… where x.firstname not like ?1

StartingWith

findByFirstnameStartingWith

… where x.firstname like ?1(parameter bound with appended %)

EndingWith

findByFirstnameEndingWith

… where x.firstname like ?1(parameter bound with prepended %)

Containing

findByFirstnameContaining

… where x.firstname like ?1(parameter bound wrapped in %)

OrderBy

findByAgeOrderByLastnameDesc

… where x.age = ?1 order by x.lastname desc

Not

findByLastnameNot

… where x.lastname <> ?1

In

findByAgeIn(Collection<Age> ages)

… where x.age in ?1

NotIn

findByAgeNotIn(Collection<Age> age)

… where x.age not in ?1

True

findByActiveTrue()

… where x.active = true

False

findByActiveFalse()

… where x.active = false

IgnoreCase

findByFirstnameIgnoreCase

… where UPPER(x.firstame) = UPPER(?1)

Keyword Sample JPQL snippet

And

findByLastnameAndFirstname

… where x.lastname = ?1 and x.firstname = ?2

Or

findByLastnameOrFirstname

… where x.lastname = ?1 or x.firstname = ?2

Is,Equals

findByFirstname,findByFirstnameIs,findByFirstnameEquals

… where x.firstname = ?1

Between

findByStartDateBetween

… where x.startDate between ?1 and ?2

LessThan

findByAgeLessThan

… where x.age < ?1

LessThanEqual

findByAgeLessThanEqual

… where x.age <= ?1

GreaterThan

findByAgeGreaterThan

… where x.age > ?1

GreaterThanEqual

findByAgeGreaterThanEqual

… where x.age >= ?1

After

findByStartDateAfter

… where x.startDate > ?1

Before

findByStartDateBefore

… where x.startDate < ?1

IsNull

findByAgeIsNull

… where x.age is null

IsNotNull,NotNull

findByAge(Is)NotNull

… where x.age not null

Like

findByFirstnameLike

… where x.firstname like ?1

NotLike

findByFirstnameNotLike

… where x.firstname not like ?1

StartingWith

findByFirstnameStartingWith

… where x.firstname like ?1(parameter bound with appended %)

EndingWith

findByFirstnameEndingWith

… where x.firstname like ?1(parameter bound with prepended %)

Containing

findByFirstnameContaining

… where x.firstname like ?1(parameter bound wrapped in %)

OrderBy

findByAgeOrderByLastnameDesc

… where x.age = ?1 order by x.lastname desc

Not

findByLastnameNot

… where x.lastname <> ?1

In

findByAgeIn(Collection<Age> ages)

… where x.age in ?1

NotIn

findByAgeNotIn(Collection<Age> age)

… where x.age not in ?1

True

findByActiveTrue()

… where x.active = true

False

findByActiveFalse()

… where x.active = false

IgnoreCase

findByFirstnameIgnoreCase

… where UPPER(x.firstame) = UPPER(?1)

以上為個人經驗,希望能給大家一個參考,也希望大家多多支持好吧啦網。

標簽: Spring
相關文章:
主站蜘蛛池模板: 91原创视频在线观看 | 亚洲精品自拍 | 国产一级片儿 | 一区二区三区视频 | 免费国产黄 | 午夜视频一区二区 | 成年午夜性爽快免费视频不卡 | 久久国产精品一区二区三区 | 亚洲 午夜在线一区 | 亚洲情a成黄在线观看动 | 免费视频久久 | 亚洲gogo人体大胆西西安徽 | 欧美一级特黄刺激爽大片 | 做爰成人五级在线视频| 日韩免费在线 | 亚洲成a人片在线网站 | 久久精品无遮挡一级毛片 | 国产精品久久久久久爽爽爽 | 国产成人精品一区二三区在线观看 | 中文字幕一区日韩在线视频 | 久久久视频在线 | 一色屋色费精品视频在线观看 | 成人免费看 | 中文一级国产特级毛片视频 | 暖暖视频日韩欧美在线观看 | 国产高清无专砖区2021 | 久久91精品国产91久久小草 | 国产一级二级三级视频 | 丝袜美腿在线不卡视频播放 | 成人99国产精品 | 国产精品久久久久一区二区三区 | 日本午夜精品 | 性欧美精品久久久久久久 | 久久99国产精品久久99无号码 | 94欧美setu| 日本免费人做人一区在线观看 | 精品视频自拍 | 国产精品免费综合一区视频 | 久久国产精彩视频 | 国产黄色片网站 | 在线观看二区三区午夜 |