LambdaQueryWrapper查询当日数据
时间: 2023-08-28 19:20:36 浏览: 149
高级筛选--时间区间数据查询(1).xlsm
在使用LambdaQueryWrapper进行当日数据查询时,可以使用以下代码:
```java
List<ProjectSms> list = list(new QueryWrapper<ProjectSms>()
.lambda()
.eq(ProjectSms::getPhoneNumbers, phoneNumbers)
.gt(ProjectSms::getSendTime, LocalDateTime.of(LocalDate.now(), LocalTime.MIN))
.orderByDesc(ProjectSms::getSendTime));
```
这段代码通过在lambda()方法后使用eq()方法来指定获取ProjectSms中字段phoneNumbers相等的数据,并使用gt()方法来获取sendtime字段大于今天00:00的数据(即今日的数据),最后使用orderByDesc()方法对sendtime字段进行倒序输出。这样就可以查询到当日的数据了。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [java 8 lambda表达式和mybatis-plus中结合使用,根据今日时间返回倒序最新数据 queryWrapper常用方法及简单...](https://blog.csdn.net/nn1656353506/article/details/107814760)[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^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [关于时间范围查询和时间类型转换和日周月数据查询【总汇】](https://blog.csdn.net/weixin_52380943/article/details/125224380)[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^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [高级筛选--时间区间数据查询(1).xlsm](https://download.csdn.net/download/weixin_44681501/80926770)[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^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文