Mybatis-Plus select不列出全部字段

https://www.jianshu.com/p/e97b8236db67

只显示某两个字段

@Test
    public void selectByWrapper10() {
        QueryWrapper<User> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("name", "age").like("name", "雨");
        List<User> users = userMapper.selectList(queryWrapper);
        users.forEach(System.out::println);
    }



显示除了某两个字段,其他所有字段.
    @Test
    public void selectByWrapper11() {
        QueryWrapper<User> queryWrapper = new QueryWrapper<>();
        queryWrapper.select(User.class, info -> !info.getColumn().equals("manager_id")
                && !info.getColumn().equals("create_time"));
        List<User> users = userMapper.selectList(queryWrapper);
        users.forEach(System.out::println);
    }
上一篇:使用mybatis-plus的条件构造器queryWrapper查询指定字段


下一篇:Spring Boot学习(三十一):SpringBoot集成MyBatis-Plus,增强版MyBatis!