数据有Test表,表里有id,name,ip_address,last_time四个字段
通常查询写法,返回结果会把id,name,ip_address,last_time四个字段都返回 public List selectList(Test test) { List list = testMapper.selectList(new QueryWrapper<>(test)) return list; } 现在想排除ip_address这个字段 public List selectList(Test test) { QueryWrapper<Test> wrapper = new QueryWrapper<>(test); wrapper.select(Test.class,info -> !info.getColumn().equals("ip_address")); List<Test> list = testMapper.selectList(wrapper); return list; } 进一步想排除ip_address和last_time这两个字段 public List selectList(Test test) { QueryWrapper<Test> wrapper = new QueryWrapper<>(test); wrapper.select(Test.class,info -> !(info.getColumn().equals("ip_address")||info.getColumn().equals("last_time"))); List<Test> list = testMapper.selectList(wrapper); return list; }
标签:某字段,mybatisplus,ip,selectList,List,wrapper,查询,test,Test From: https://www.cnblogs.com/yclh/p/17601383.html