1、例子1,查询非空和大于
QueryWrapper<User> wrapper = new QueryWrapper<>();
wrapper
.isNotNull("name")
.isNotNull("email")
.ge("age",12);
userMapper.selectList(wrapper).forEach(System.out::println);
2、例子2,查询单个物体,如:名字为
QueryWrapper<User> wrapper = new QueryWrapper<>();
wrapper.eq("name","chen");
User user = userMapper.selectOne(wrapper);
System.out.println(user);
3、例子3,查询一个范围内的物体个数
QueryWrapper<User> wrapper = new QueryWrapper<>();
wrapper.between("age",20,30);
Interger count= userMapper.selectCount(wrapper);
System.out.println(count);
4、例子4,模糊查询
不包含:notLike
右包含,如:t%,也就是t开头;
左包含,如:%t,也就是t结尾;
两边包含,如:%t%,也就任何位置包含了t
5、例子5,子查询
6、根据ID排序
或者