我是靠谱客的博主 认真含羞草,这篇文章主要介绍mybatis-plus中and和or的使用,现在分享给大家,希望可以做个参考。

1、a and b形式

直接使用追加形式,比如连续的eq

2、a or b形式

使用or()来连接两个操作,使用的是Join接口中的or,比如eq(Test::getA, 1).or().eq(Test::getB, 2)

3、a or (b and c)形式

使用or(Consumer<Wrapper> consumer)形式,使用的是Nested接口中的or。比如eq(Test::getA, 1).or(w -> w.eq(Test::getB, 2).eq(Test::getC, 3)

4、(a and b) or (c and d)形式

使用and(Consumer<Wrapper> consumer).or(Consumer<Wrapper> consumer)形式,比如and(wp -> wp.eq(Test::getA, 1).eq(Test::getB,2)).or(wp -> wp.eq(Test::getC, 3).eq(Test::getD, 4)

5、a or (b and ( c or d))

使用and(wp.a()).or(wp -> wp.b(....).and(wp -> wp.c().or().wp.d())

最后

以上就是认真含羞草最近收集整理的关于mybatis-plus中and和or的使用的全部内容,更多相关mybatis-plus中and和or内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(118)

评论列表共有 0 条评论

立即
投稿
返回
顶部