Skip to content

Commit

Permalink
fix: Handle null values for end_time filters
Browse files Browse the repository at this point in the history
  • Loading branch information
itinycheng committed Dec 11, 2024
1 parent cbc8578 commit c62a59a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ public ResultInfo<List<Map<String, Object>>> jobRunStatusCount(
List<Map<String, Object>> maps = jobRunService.listMaps(new QueryWrapper<JobRunInfo>()
.select("status, count(id) as count")
.groupBy("status")
.between(nonNull(startTime) && nonNull(endTime), "stop_time", startTime, endTime)
.nested(
nonNull(startTime) && nonNull(endTime),
qw -> qw.isNull("stop_time").or().between("stop_time", startTime, endTime))
.eq("user_id", loginUser.getId()));
return success(maps);
}
Expand All @@ -60,7 +62,9 @@ public ResultInfo<List<Map<String, Object>>> jobFlowRunStatusCount(
List<Map<String, Object>> maps = jobFlowRunService.listMaps(new QueryWrapper<JobFlowRun>()
.select("status, count(id) as count")
.groupBy("status")
.between(nonNull(startTime) && nonNull(endTime), "end_time", startTime, endTime)
.nested(
nonNull(startTime) && nonNull(endTime),
qw -> qw.isNull("end_time").or().between("end_time", startTime, endTime))
.eq("user_id", loginUser.getId()));
return success(maps);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ public ResultInfo<IPage<JobFlowRun>> page(
.eq(nonNull(status), JobFlowRun::getStatus, status)
.likeRight(isNotEmpty(name), JobFlowRun::getName, name)
.like(isNotEmpty(tagCode), JobFlowRun::getTags, tagCode)
.between(nonNull(startTime) && nonNull(endTime), JobFlowRun::getEndTime, startTime, endTime);
.nested(nonNull(startTime) && nonNull(endTime), qw -> qw.isNull(JobFlowRun::getEndTime)
.or()
.between(JobFlowRun::getEndTime, startTime, endTime));
if ("-id".equals(sort)) {
queryWrapper.orderByDesc(JobFlowRun::getId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ public ResultInfo<IPage<JobRunInfo>> page(
.eq(nonNull(jobId), JobRunInfo::getJobId, jobId)
.eq(nonNull(status), JobRunInfo::getStatus, status)
.likeRight(nonNull(name), JobRunInfo::getName, name)
.between(nonNull(startTime) && nonNull(endTime), JobRunInfo::getEndTime, startTime, endTime);
.nested(nonNull(startTime) && nonNull(endTime), qw -> qw.isNull(JobRunInfo::getEndTime)
.or()
.between(JobRunInfo::getEndTime, startTime, endTime));

if ("-id".equals(sort)) {
queryWrapper.orderByDesc(JobRunInfo::getId);
}
Expand Down

0 comments on commit c62a59a

Please sign in to comment.