mybatis-plus 范围查询
时间: 2023-09-20 17:06:10 浏览: 83
在使用Mybatis-Plus进行范围查询时,可以使用between()方法。在代码中,我们可以使用LambdaQueryWrapper类来构建查询条件。下面是一个示例代码:
```
LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.between(User::getAge, 18, 30);
List<User> userList = userDao.selectList(queryWrapper);
```
上述代码中,我们通过between()方法指定了查询条件,查询年龄在18到30之间的用户信息。然后使用selectList()方法执行查询并返回结果列表。这样就可以实现范围查询了。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [mybatis -plus基本查询](https://blog.csdn.net/vuecode/article/details/125985034)[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^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [MyBatisPlus-范围查询、模糊查询及排序查询](https://blog.csdn.net/m0_61961937/article/details/125967684)[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^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文