1、首先创建对象
QueryWrapper<泛型> wrapper=new QueryWrapper();
2、常用方法
(1)like
实例:wrapper.like(“name”,”月”); –> where name like “%月%”
(2)lt
实例:wrapper.lt(“age”,20); –> where age<20
(3)between
实例:wrapper.between(“age”,10,20); –> where age between 10 and 20
(4)isNotNull
实例:wrapper.isNotNull(“name”); –>where name is not null
(5)likeRight
实例:wrapper.likeRight(“name”,”袁”); –>where name like “袁%”
(6)ge
实例:wrapper.ge(“age”,18); –>where age>=18
(7)or
实例:wrapper.likeRight(“name”,”袁”).or().lt(“age”,18); –>where name like “袁%” or age<18
(8)orderByDesc和orderByAsc
实例:wrapper.orderByDesc(“id”) –> order by id desc
wrapper.orderByAsc(“id”) –>order by id 或者order by id asc
(9)inSql
实例:wrapper.inSql(“id”,”select * from student”); –>where ….., id in(select * from student)