@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 的注解去掉,就能正常查出来了
找到原因了就好,没帮上你什么忙。
?找到原因了,是lombok的builder注解的问题。需要给加了@builder的实体手动加上无参构造函数
@Data @Builder(toBuilder = true) public class User { @TableId(value = "id",type = IdType.INPUT) private Long id; private String name; private Integer age; private String email; @Tolerate public User(){ } }