// 条件构造器1 @Test publicvoidtestFindWrapper1() { // 查询年龄小于25或年龄大于30的人 QueryWrapper<Student>queryWrapper=new QueryWrapper<>(); queryWrapper.lt("age",25).or().gt("age",30); List<Student>students=studentMapper.selectList(queryWrapper); students.forEach(System.out::println); // 查询性别为女,且年龄小于等于35的数据 QueryWrapper<Student>queryWrapper=new QueryWrapper<>(); queryWrapper.eq("gender","f").le("age",35); List<Student>students=studentMapper.selectList(queryWrapper); students.forEach(System.out::println);
// 查询名字包含"小"的学生,按照年龄升序排序 QueryWrapper<Student>queryWrapper=new QueryWrapper<>(); queryWrapper.like("sname","小").orderByAsc("age"); List<Student>students=studentMapper.selectList(queryWrapper); students.forEach(System.out::println);
标签:QueryWrapper,queryWrapper,age,System,Liststudents,参数,mybatis,plus,out From: https://www.cnblogs.com/Mvloveyouforever/p/18421011