【发布时间】:2020-11-05 10:28:59
【问题描述】:
我有这个 queryDSL 查询:
QReport report = QReport.report;
BooleanBuilder builder = new BooleanBuilder();
if (startDate != null) {
builder.and(report.modificationDate.after(startDate));
}
if (endDate != null) {
builder.and(report.modificationDate.before(endDate));
}
但如果我想查找从 09/04/2018 到 09/04/2018 的行,它就行不通了。
或者从 09/04/2018 到 09/05/2018 - 仅找到 09/04/2018 行。
我可以将 23.59.59 时间添加到 endDate 但也许在查询 DSL 中有一些选项?
例如 - 获取从开始日期到结束日期的所有行
【问题讨论】:
标签: mongodb date spring-data-mongodb querydsl predicate