【功能修复】商城:秒杀活动的活动排重校验不正确的问题

This commit is contained in:
YunaiV 2024-09-30 09:55:45 +08:00
parent caf49aae35
commit 9ae3682b2d
2 changed files with 4 additions and 4 deletions

View File

@ -31,9 +31,9 @@ public interface SeckillActivityMapper extends BaseMapperX<SeckillActivityDO> {
.orderByDesc(SeckillActivityDO::getId));
}
default List<SeckillActivityDO> selectListByStatus(Integer status) {
return selectList(new LambdaQueryWrapperX<SeckillActivityDO>()
.eqIfPresent(SeckillActivityDO::getStatus, status));
default List<SeckillActivityDO> selectListBySpuIdAndStatus(Long spuId, Integer status) {
return selectList(SeckillActivityDO::getSpuId, spuId,
SeckillActivityDO::getStatus, status);
}
/**

View File

@ -97,7 +97,7 @@ public class SeckillActivityServiceImpl implements SeckillActivityService {
seckillConfigService.validateSeckillConfigExists(configIds);
// 2.1 查询所有开启的秒杀活动
List<SeckillActivityDO> activityList = seckillActivityMapper.selectListByStatus(CommonStatusEnum.ENABLE.getStatus());
List<SeckillActivityDO> activityList = seckillActivityMapper.selectListBySpuIdAndStatus(spuId, CommonStatusEnum.ENABLE.getStatus());
if (activityId != null) { // 排除自己
activityList.removeIf(item -> ObjectUtil.equal(item.getId(), activityId));
}