65 lines
2.1 KiB
Java
65 lines
2.1 KiB
Java
package com.xy.xyaicpzs.service.impl;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.xy.xyaicpzs.domain.entity.LotteryDraws;
|
|
import com.xy.xyaicpzs.mapper.LotteryDrawsMapper;
|
|
import com.xy.xyaicpzs.service.LotteryDrawsService;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* @author XY003
|
|
* @description 针对表【lottery_draws(开奖结果表)】的数据库操作Service实现
|
|
* @createDate 2025-06-14 09:48:10
|
|
*/
|
|
@Service
|
|
public class LotteryDrawsServiceImpl extends ServiceImpl<LotteryDrawsMapper, LotteryDraws>
|
|
implements LotteryDrawsService{
|
|
|
|
@Override
|
|
public List<LotteryDraws> getRecentDraws(Integer limit) {
|
|
if (limit == null || limit <= 0) {
|
|
limit = 15;
|
|
}
|
|
QueryWrapper<LotteryDraws> queryWrapper = new QueryWrapper<>();
|
|
queryWrapper.orderByDesc("drawId").last("LIMIT " + limit);
|
|
return list(queryWrapper);
|
|
}
|
|
|
|
@Override
|
|
public LotteryDraws getByDrawId(Long drawId) {
|
|
return getById(drawId);
|
|
}
|
|
|
|
@Override
|
|
public List<LotteryDraws> getByDateRange(Date startDate, Date endDate) {
|
|
QueryWrapper<LotteryDraws> queryWrapper = new QueryWrapper<>();
|
|
if (startDate != null) {
|
|
queryWrapper.ge("drawDate", startDate);
|
|
}
|
|
if (endDate != null) {
|
|
queryWrapper.le("drawDate", endDate);
|
|
}
|
|
queryWrapper.orderByDesc("drawId");
|
|
return list(queryWrapper);
|
|
}
|
|
|
|
@Override
|
|
public List<LotteryDraws> queryDraws(Long drawId, Date startDate, Date endDate) {
|
|
QueryWrapper<LotteryDraws> queryWrapper = new QueryWrapper<>();
|
|
if (drawId != null) {
|
|
queryWrapper.eq("drawId", drawId);
|
|
}
|
|
if (startDate != null) {
|
|
queryWrapper.ge("drawDate", startDate);
|
|
}
|
|
if (endDate != null) {
|
|
queryWrapper.le("drawDate", endDate);
|
|
}
|
|
queryWrapper.orderByDesc("drawId");
|
|
return list(queryWrapper);
|
|
}
|
|
} |