diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/seckill/seckillactivity/SeckillActivityMapper.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/seckill/seckillactivity/SeckillActivityMapper.java index 51d3309b3..34e50f1f5 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/seckill/seckillactivity/SeckillActivityMapper.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/seckill/seckillactivity/SeckillActivityMapper.java @@ -31,9 +31,9 @@ public interface SeckillActivityMapper extends BaseMapperX { .orderByDesc(SeckillActivityDO::getId)); } - default List selectListByStatus(Integer status) { - return selectList(new LambdaQueryWrapperX() - .eqIfPresent(SeckillActivityDO::getStatus, status)); + default List selectListBySpuIdAndStatus(Long spuId, Integer status) { + return selectList(SeckillActivityDO::getSpuId, spuId, + SeckillActivityDO::getStatus, status); } /** diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/SeckillActivityServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/SeckillActivityServiceImpl.java index 3b7ab3d64..3e6be3ec3 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/SeckillActivityServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/SeckillActivityServiceImpl.java @@ -97,7 +97,7 @@ public class SeckillActivityServiceImpl implements SeckillActivityService { seckillConfigService.validateSeckillConfigExists(configIds); // 2.1 查询所有开启的秒杀活动 - List activityList = seckillActivityMapper.selectListByStatus(CommonStatusEnum.ENABLE.getStatus()); + List activityList = seckillActivityMapper.selectListBySpuIdAndStatus(spuId, CommonStatusEnum.ENABLE.getStatus()); if (activityId != null) { // 排除自己 activityList.removeIf(item -> ObjectUtil.equal(item.getId(), activityId)); }