LambdaQueryWrapper eq使用map
时间: 2023-10-14 11:31:43 浏览: 106
LambdaQueryWrapper的eq方法使用map的示例如下:
```java
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("name", "John");
paramMap.put("age", 25);
LambdaQueryWrapper<User> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.allEq(paramMap);
List<User> userList = userMapper.selectList(lambdaQueryWrapper);
```
在这个示例中,我们使用了一个Map对象paramMap来存储查询条件,其中键是字段名,值是字段值。然后,我们通过调用LambdaQueryWrapper的allEq方法将paramMap作为参数传入,该方法会根据map中的键值对生成相应的等值条件。最后,我们可以通过selectList方法执行查询并获取结果列表。
请注意,eq方法已经过时,推荐使用allEq方法代替。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [LambdaQueryWrapper&QueryWrapper增删改CURD使用教程案例](https://blog.csdn.net/m0_59252007/article/details/121267361)[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_2"}}] [.reference_item style="max-width: 50%"]
- *2* [Map转换实体类生成LambdaQueryWrapper(包含条件构造器)](https://blog.csdn.net/J_com/article/details/121384024)[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_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文