lambdaquerywrapper.or方法
时间: 2023-09-20 14:14:52 浏览: 144
lambdaQueryWrapper.or方法是用于在LambdaQueryWrapper中进行or条件连接的方法。 [2在LambdaQueryWrapper中使用or连接的方法是通过在lambda表达式中使用wq.or()来实现。例如,假设我们要查询name为"aa"或者name为"bb"的用户,可以使用以下代码:
```java
QueryWrapper<User> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().and(wq -> {
wq.like(User::getName, "aa");
wq.or().like(User::getName, "bb");
});
```
在上述代码中,lambda表达式wq.or()表示在wq.like(User::getName, "aa")条件之后,使用or连接下一个条件wq.like(User::getName, "bb")。这样就实现了查询name为"aa"或者name为"bb"的用户的功能。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [QueryWrapper的lambda表达式使用OR](https://blog.csdn.net/coder_afly/article/details/128870428)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *3* [LambdaQueryWrapper多层嵌套 OR / AND。LambdaQueryWrapper.func()实现](https://blog.csdn.net/clevermeng123/article/details/120870820)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文