mybatis-plus查询指定字段

show me the code :
mybais-plus版本:3.1.1

1,排除某些字段,可以同时排除多个字段
排除多个字段写法:

.setEntity(new User())
.select(c -> !Objects.equals(c.getProperty(), "secretKey")
&& !Objects.equals(c.getProperty(), "password"))

如果写多个select 则只有最后一个select生效

2,指定字段查询:指定多个字段写法:
.setEntity(new User())
.select(c -> Objects.equals(c.getProperty(), "nickname")
|| Objects.equals(c.getProperty(), "status"))
如果写多个select 则只有最后一个select生效

 

3,distinct 

原文地址:https://www.cnblogs.com/hbuuid/p/14082499.html