Commit da66ca3e by 杨卫

feat:单边时间区间修改提交

1 parent f0a292c4
......@@ -142,7 +142,7 @@ public class VrAuditController {
}
// 7. 场次时间区间 - EXISTS 子查询关联 AuctionVehicle(只查创建时间最晚的场次)
if (queryVO.getAuctionStartTimeBegin() != null && queryVO.getAuctionStartTimeEnd() != null) {
if (queryVO.getAuctionStartTimeBegin() != null || queryVO.getAuctionStartTimeEnd() != null) {
final LocalDate beginTime = queryVO.getAuctionStartTimeBegin();
final LocalDate endTime = queryVO.getAuctionStartTimeEnd();
pagination.addCondition((root, query, builder) -> {
......@@ -155,13 +155,14 @@ public class VrAuditController {
root.get(VrAudit_.VEHICLE_ID))
);
// 子查询2:验证最晚那场是否在时间区间内
// 子查询2:验证最晚那场是否符合时间条件
var subquery = query.subquery(Integer.class);
var subRoot = subquery.from(AuctionVehicle.class);
subquery.select(subRoot.get(AuctionVehicle_.AUCVEH_ID));
subquery.where(
builder.equal(subRoot.get(AuctionVehicle_.AUCVEH_ID), latestSubquery),
builder.between(subRoot.get(AuctionVehicle_.AUCTION_START_TIME), beginTime, endTime)
beginTime != null ? builder.greaterThanOrEqualTo(subRoot.get(AuctionVehicle_.AUCTION_START_TIME), beginTime) : builder.conjunction(),
endTime != null ? builder.lessThanOrEqualTo(subRoot.get(AuctionVehicle_.AUCTION_END_TIME), endTime) : builder.conjunction()
);
return builder.exists(subquery);
});
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!