色综合图-色综合图片-色综合图片二区150p-色综合图区-玖玖国产精品视频-玖玖香蕉视频

您的位置:首頁技術(shù)文章
文章詳情頁

Spring Data JPA 關(guān)鍵字Exists的用法說明

瀏覽:3日期:2023-07-11 16:11:14
Spring Data JPA 關(guān)鍵字Exists

查詢數(shù)據(jù)庫中的此數(shù)據(jù)是否已存在:

例子:

查詢sys_user表中的一個(gè)user是否存在,類SysUser對應(yīng)的是數(shù)據(jù)庫中的sys_user表,SysUserId是表sys_user的主鍵類(ID類)。

如果查詢一個(gè)user,user的accountNo為demo。

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

@Repositorypublic interface SysUserRepository extends JpaRepository<SysUser, SysUserId> { @Override boolean exists(SysUserId sysUserId);}Spring data jpa支持的關(guān)鍵字介紹 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)

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持好吧啦網(wǎng)。

標(biāo)簽: Spring
相關(guān)文章:
主站蜘蛛池模板: 亚洲精品久久精品h成人 | 性做爰片免费视频毛片中文i | 精品一精品国产一级毛片 | 伊在人亚洲香蕉精品区 | 欧美三级网站在线观看 | 国产三级做爰在线观看视频 | 一级一毛片a级毛片欧美 | 亚洲欧美在线观看 | 好叼操这里只有精品 | 成人午夜视频在线播放 | 另类视频一区 | 久热中文字幕在线精品免费 | 国产一区二区三区毛片 | 美女张开腿给男人捅 | 亚洲人成亚洲精品 | 亚洲成年男人的天堂网 | 成人国产第一区在线观看 | 男女上下爽无遮挡午夜免费视频 | 97在线观看成人免费视频 | 国产日韩欧美综合一区二区三区 | 99视频在线播放 | 久久久久久久久久免费视频 | 国产91无套剧情在线播放 | www夜色| 日韩特级黄色片 | 黄色美女网站免费看 | 97视频在线观看免费 | 亚洲天堂中文网 | 自拍视频在线 | 99久久精品费精品国产一区二区 | 日韩欧美在线一区二区三区 | 国产性生交xxxxx免费 | 欧美亚洲免费久久久 | 欧美成人私人视频88在线观看 | 国产精品偷伦费观看 | 久久网在线 | 国产精品精品国产一区二区 | 久久成人18免费网站 | 久久影院yy6080 | 日韩在线播放中文字幕 | 亚洲二区在线观看 |