From 8059e9b991c15edbac508e6b658a0d9571d11b1c Mon Sep 17 00:00:00 2001 From: huliguo <2023611923@qq.com> Date: 星期五, 01 八月 2025 12:46:00 +0800 Subject: [PATCH] bug修改 --- ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/activity/ActivityGoodsServiceImpl.java | 61 ++++++++++++++++++++++++++++-- 1 files changed, 57 insertions(+), 4 deletions(-) diff --git a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/activity/ActivityGoodsServiceImpl.java b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/activity/ActivityGoodsServiceImpl.java index 1f9dd6c..1b171c7 100644 --- a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/activity/ActivityGoodsServiceImpl.java +++ b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/activity/ActivityGoodsServiceImpl.java @@ -1,14 +1,18 @@ package com.ruoyi.goods.service.impl.activity; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.goods.domain.vo.MgtActivityGoodsListVo; import com.ruoyi.goods.mapper.activity.ActivityGoodsMapper; import com.ruoyi.goods.service.activity.ActivityGoodsService; +import com.ruoyi.goods.service.activity.ActivityRecordService; import com.ruoyi.system.api.domain.poji.activity.ActivityGoods; - - import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; /** * <p> @@ -21,16 +25,65 @@ @Service public class ActivityGoodsServiceImpl extends ServiceImpl<ActivityGoodsMapper, ActivityGoods> implements ActivityGoodsService { + @Resource + private ActivityGoodsMapper activityGoodsMapper; + + @Resource + private ActivityRecordService activityRecordService; + /** * 通过id获取活动商品 * @param goodsId * @return */ @Override - public ActivityGoods getByGoodsId(String goodsId){ + public ActivityGoods getByGoodsId(String activityId,String goodsId){ LambdaQueryWrapper<ActivityGoods> queryWrapper = Wrappers.lambdaQuery(); - queryWrapper.eq(ActivityGoods::getDelFlag, 0).eq(ActivityGoods::getGoodsId, goodsId); + queryWrapper.eq(ActivityGoods::getDelFlag, 0).eq(ActivityGoods::getActivityId, activityId).eq(ActivityGoods::getGoodsId, goodsId); ActivityGoods activityGoods = this.getOne(queryWrapper,false); return activityGoods; } + + /** + * @description 通过活动id删除商品 + * @author jqs + * @date 2023/6/14 15:47 + * @param activityId + * @return void + */ + @Override + public void deleteByActivityId(String activityId){ + LambdaUpdateWrapper<ActivityGoods> wrapper = new LambdaUpdateWrapper<>(); + wrapper.eq(ActivityGoods::getActivityId, activityId); + wrapper.eq(ActivityGoods::getDelFlag, 0); + wrapper.set(ActivityGoods::getDelFlag, 1); + this.update(wrapper); + } + + /** + * @description + * @author jqs + * @date 2023/6/14 18:02 + * @param + * @return List<MgtActivityGoodsListVo> + */ + @Override + public List<MgtActivityGoodsListVo> listVoByActivityId(String activityId){ + return activityGoodsMapper.listVoByActivityId(activityId); + } + + /** + * @description + * @author jqs + * @date 2023/7/12 20:35 + * @param activityId + * @return List<ActivityGoods> + */ + @Override + public List<ActivityGoods> listByActivityId(String activityId){ + LambdaQueryWrapper<ActivityGoods> queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ActivityGoods::getDelFlag,0); + queryWrapper.eq(ActivityGoods::getActivityId,activityId); + return this.list(queryWrapper); + } } -- Gitblit v1.7.1