Java中QueryWrapper的基本使用
1.单表查询
select * from student where name = '?' and class like '%?%' and age between '?' and '?' order by '?' asc
1.1、单表查询的基本用法
函数名 | 说明 | 例子 |
---|---|---|
eq | 等于 | 例:eq(“name”,“张子”) ===> name = ‘张子’ |
ne | 不等于 | 例:ne(“name”,“张子”) ===> name <> ‘张子’ |
gt | 大于 | 例:gt(“age”,“18”) ===> age>18 |
lt | 小于 | 例:lt(“age”,“18”) ===> age<18 |
between | 在值1到值2之间 | 例:between(“age”,18,30) ===> 18<age<30’ |
like | 模糊查询 | 例:like(“name”,“张”) ===> name like ‘%张%’ |
isNull | 字段为NULL | 例:isNull(“name”) ===> name is null |
2、多表查询
//Controller