LambdaQueryWrapper怎么查list
时间: 2023-10-17 10:35:48 浏览: 150
List对象列表 转换Json
使用LambdaQueryWrapper可以通过以下步骤查询list:
1. 创建一个LambdaQueryWrapper对象,并指定查询的实体类类型,例如:
LambdaQueryWrapper<Student> lambdaQuery = new LambdaQueryWrapper<>();
2. 使用lambda表达式设置查询条件,例如:
lambdaQuery.eq(Student::getUserId, userId)
.eq(Student::getStatus, 1)
.orderByDesc(Student::getCreateTime);
3. 调用对应的mapper方法进行查询,例如:
List<Student> list = studentMapper.selectList(lambdaQuery);
这样就可以使用LambdaQueryWrapper查询list了。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [MybatisPlus lambdaQueryWrapper中常用方法](https://blog.csdn.net/moyingmj/article/details/121796354)[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* [使用LambdaQueryWrapper,QueryWrapper,lambda表达式,获取list集合的几种方式](https://blog.csdn.net/sun_tf_sir/article/details/121267964)[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 ]
阅读全文