release: 先根据开奖状态,再根据发布时间

release-2024-04-25
huangyw 1 month ago
parent deef419f40
commit 268bc9ad60

@ -469,6 +469,7 @@ public class LotteryService {
BooleanBuilder booleanBuilder = new BooleanBuilder(); BooleanBuilder booleanBuilder = new BooleanBuilder();
QLottery qLottery = QLottery.lottery; QLottery qLottery = QLottery.lottery;
checkCondition(booleanBuilder, qLottery, lotterySearchDto); checkCondition(booleanBuilder, qLottery, lotterySearchDto);
booleanBuilder.and(qLottery.status.in(new Integer[]{PointEnums.LOTTERY_STATUS_LOTTERY.getCode(), PointEnums.LOTTERY_STATUS_SIGN.getCode()}));
// 创建分页对象 // 创建分页对象
Pageable pageable = PageRequest.of(page - 1, size); Pageable pageable = PageRequest.of(page - 1, size);
List<LotteryAPPVO> list = jpaQueryFactory.select(Projections.constructor(LotteryAPPVO.class, List<LotteryAPPVO> list = jpaQueryFactory.select(Projections.constructor(LotteryAPPVO.class,
@ -494,7 +495,7 @@ public class LotteryService {
qLottery.publishTime qLottery.publishTime
)).from(qLottery) )).from(qLottery)
.where(booleanBuilder) .where(booleanBuilder)
.orderBy(qLottery.publishTime.desc()) .orderBy(qLottery.status.asc(), qLottery.publishTime.desc())
.offset(pageable.getOffset()) .offset(pageable.getOffset())
.limit(pageable.getPageSize()) .limit(pageable.getPageSize())
.fetch(); .fetch();

Loading…
Cancel
Save