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的使用