使用mybait-plus-join连表查询的时候,想排除连表对象中的某个属性值不查询
MPJLambdaWrapper mpjLambdaWrapper = new MPJLambdaWrapper()
.select(A.class, info -> !info.getColumn().equals("bin_data"))
.leftJoin(B.class,B::getId,A::getMusicId)
.selectAssociation(B.class, A::getWorksMusic);
如上代码,我已实现过滤A中的bin_data字段,同时我还想实现过滤B中的某个字段
该回答引用GPT:
可以在selectAssociation方法中添加过滤条件,如下:
MPJLambdaWrapper mpjLambdaWrapper = new MPJLambdaWrapper()
.select(A.class, info -> !info.getColumn().equals("bin_data"))
.leftJoin(B.class,B::getId,A::getMusicId)
.selectAssociation(B.class, A::getWorksMusic, info -> !info.getColumn().equals("bin_data"))
如还有疑问,可留言帮助解决。