JPA中比较语句

JPA中比较语句

eq相等   ne、neq不相等,   gt大于, lt小于 gte、ge大于等于   lte、le 小于等于   not非   mod求模   is [not] div by是否能被某数整除   is [not] even是否为偶数   is [not] even by $b即($a / $b) % 2 == 0   is [not] odd是否为奇   is not odd by $b即($a / $b) % 2 != 0 示例:

equal/ not equal/ greater than/ less than/ less than or equal/ great than or equal/后面的就不用说了

 

JPA的基本操作语句

 1  //And --- 等价于 SQL 中的 and 关键字,比如 findByHeightAndSex(int height,char sex);  
 2  public List<User> findByHeightAndSex(int height,char sex);  
 3   
 4 // Or --- 等价于 SQL 中的 or 关键字,比如 findByHeightOrSex(int height,char sex);  
 5  public List<User> findByHeightOrSex(int height,char sex);  
 6   
 7  //Between --- 等价于 SQL 中的 between 关键字,比如 findByHeightBetween(int min, int max);  
 8  public List<User> findByHeightBetween(int min,int max);  
 9   
10  //LessThan --- 等价于 SQL 中的 "<",比如 findByHeightLessThan(int max);  
11  public List<User> findByHeightLessThan(int max);  
12   
13  //GreaterThan --- 等价于 SQL 中的">",比如 findByHeightGreaterThan(int min);  
14  public List<User> findByHeightGreaterThan(int min);  
15   
16  //IsNull --- 等价于 SQL 中的 "is null",比如 findByNameIsNull();  
17  public List<User> findByNameIsNull();  
18   
19  //IsNotNull --- 等价于 SQL 中的 "is not null",比如 findByNameIsNotNull();  
20  public List<User> findByNameIsNotNull();  
21   
22  //NotNull --- 与 IsNotNull 等价;  
23  public List<User> findByNameNotNull();  
24   
25  //Like --- 等价于 SQL 中的 "like",比如 findByNameLike(String name);  
26  public List<User> findByNameLike(String name);  
27   
28  //NotLike --- 等价于 SQL 中的 "not like",比如 findByNameNotLike(String name);  
29  public List<User> findByNameNotLike(String name);  
30   
31  //OrderBy --- 等价于 SQL 中的 "order by",比如 findByNameNotNullOrderByHeightAsc();  
32  public List<User>findByNameNotNullOrderByHeightAsc();  
33   
34  //Not --- 等价于 SQL 中的 "! =",比如 findByNameNot(String name);  
35  public List<User> findByNameNot(String name);  
36   
37  //In --- 等价于 SQL 中的 "in",比如 findByNameIN(String name);  
38  public List<User> findByNameIn(String name);  
39   
40  //NotIn --- 等价于 SQL 中的 "not in",比如 findByNameNotIN(String name);  
41  public List<User> findByNameNotIn(String name);  

 springboot jpa之复杂查询语句  https://blog.csdn.net/Maslii/article/details/81782670

Spring系列:JPA 常用接口和方法 https://blog.csdn.net/VIP099/article/details/107576710?utm_medium=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param

posted @ 2020-08-23 20:54  随园  阅读(3451)  评论(0编辑  收藏  举报