发现个问题,在实体上使用了lombok的@Builder注解,如果不select所有字段,就会报错
@Data @Builder public class User { @TableId(value = "id",type = IdType.INPUT) private Long id; private String name; private Integer age; private String email; }
@Test public void selectByQueryWrapperSupper(){ QueryWrapper<User> queryWrapper = new QueryWrapper<>(); queryWrapper.select("id","name") .like("name","Billie") .lt("age",30); List<User> users = userDao.selectList(queryWrapper); users.forEach(System.out::println); }
报错内容:
把@Builder 的注解去掉,就能正常查出来了