mybatis plus or括号
时间: 2023-09-20 15:04:57 浏览: 161
mybatis-plus
MyBatis Plus supports the OR condition using the `or` method provided by the `QueryWrapper` class. To use OR conditions with parentheses, you can chain multiple `or` methods together.
Here's an example:
```java
QueryWrapper<Entity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("column1", value1)
.or()
.eq("column2", value2)
.or()
.nested(wrapper -> wrapper.eq("column3", value3).ne("column4", value4));
```
In the above example, `eq` represents the equal condition, `ne` represents the not equal condition, and `nested` is used to create a nested condition with parentheses.
You can adjust the conditions and column names based on your requirements.
阅读全文