QueryWrapper概述:

       
也称条件构造器,继承自AbstractWrapper,自身的内部属性entity,也用于生成where条件及LambdaQueryWapper,可以通过new
QueryWrapper().lambda()方法获取
QueryWrapper<Employee> wrapper = new QueryWrapper<>() QueryWrapper常见用法
函数名说明例子
eq等于 =eq("name","海绵宝宝")  →  name="海绵宝宝"
ne不等于 <>ne("name","海绵宝宝")  →  name<>"海绵宝宝"
gt大于 >gt("age","18")   →  age>18
ge大于等于 >=ge("age","18")  →  age>=18
le小于等于 <=le("age","18")  →  age<=18
lt小于 <lt("age","18")  →  age<18
betweenBETWEEN 值1 and 值2between("age",18,30)  →  age between 18 and 30
notBetweenNOT BETWEEN 值1 and 值2between("age",18,30)  →  age not between 18 and
30
likeLIKE '%值%'like("name","海")  →  name like "%海%"
notLikeNOT LIKE '%值%'not like("name","海")  →  name like "%海%"
likeLeftLIKE '%值'leftLlike("name","海")  →  name like "%海"
likeRightLIKE '值%'rightLlike("name","海")  →  name like "海%"
isNull字段 IS NULLisNull("name")  →  name is null
isNotNull字段 IS NOT NULLis Not Null("name")  →  name is not null
in字段 IN(v0,v1,v2,...)in("age",{1,2,3})  →  age in (1,2,3)
notIn字段 NOT IN(v0,v1,v2,...)notIn("age",{1,2,3})  →  age not in (1,2,3)
inSql字段 IN(sql语句)inSql("id","select id from table where id<3") 
→  age in(select id from table where id<3) 
notInSql字段 NOT IN(sql语句)notInSql("id","select id from table where id<3") 
→  age not in(select id from table where id<3) 
groupBy分组:groupBygroupBy("id","name")  →  group by id,name
orderByAsc正序排序orderByAsc("id","name")  →  order by id Asc,name Asc
orderByDesc倒序排序orderByDesc("id","name") → order by id Desc,name Desc
orderBy排序  :ODER BY 字段orderBy(true,true,"id","name")→ order by id Asc,name Asc
havingHAVING(sql语句)having("sum(age) > {0}",11) →  having sum(age) >11
or拼接 OReq("id",1).or().eq("name","派大星")
→  id=1 or name="派大星"
andAND 嵌套用于嵌套
apply拼接 sql用于数据库函数,一般having很少用
last无视化规则直接拼接到sql的最后只能调用一次  last("limit 1")
exists拼接EXISTS(sql语句)exists("select id from table where age = 1")
→exists("select id from table where age = 1")
notExists拼接NOT EXISTS(sql语句)notExists("select id from table where age = 1")
→not exists("select id from table where age = 1")

技术
©2019-2020 Toolsou All rights reserved,
Python学习笔记(一)Linux【shell】 shell编程创建一个线程——— Javaweb (3)evo工具使用问题——Degenerate covariance rank, Umeyama alignment is not possibleVMware 16安装centos 7详细教程C语言做一个简易的登陆验证(功能)界面C语言——qsort函数Spring Boot面试必问:自动配置原理Android EditText密码显示隐藏Qt入门教程【基础控件篇】QCalendarWidget日历控件