LambdaQueryWrapper怎么进行关联表查询
时间: 2023-10-15 21:24:11 浏览: 154
LambdaQueryWrapper可以通过使用eq()方法来进行关联表查询。在eq()方法中,你可以指定关联表的字段和值进行查询。例如,你可以使用以下代码进行关联表查询:
```java
LambdaQueryWrapper<User> wrapper = Wrappers.lambdaQuery(User.class);
wrapper.eq(User::getDeptId, deptVo.getDeptId());
```
在上述代码中,我们通过eq()方法将User表的deptId字段和deptVo对象的deptId值进行比较,从而实现了关联表查询。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [Mybatis-Plus高级查询LambdaQueryWrapper&QueryWrapper](https://blog.csdn.net/weixin_52317961/article/details/128317591)[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%"]
- *2* [MybatisPlus多表连接查询](https://blog.csdn.net/wdj_yyds/article/details/122599468)[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 ]
阅读全文