diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/activity/AppActivityController.http b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/activity/AppActivityController.http new file mode 100644 index 000000000..0dda88c7d --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/activity/AppActivityController.http @@ -0,0 +1,5 @@ +### /promotion/activity/list-by-spu-ids 获得多个商品,近期参与的每个活动 +GET {{appApi}}/promotion/activity/list-by-spu-ids?spuIds=222&spuIds=633 +Authorization: Bearer {{appToken}} +Content-Type: application/json +tenant-id: {{appTenentId}} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/bargain/BargainActivityMapper.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/bargain/BargainActivityMapper.java index d12056d56..bfaed212e 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/bargain/BargainActivityMapper.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/bargain/BargainActivityMapper.java @@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.promotion.controller.admin.bargain.vo.activity.Ba import cn.iocoder.yudao.module.promotion.dal.dataobject.bargain.BargainActivityDO; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import java.time.LocalDateTime; @@ -87,6 +88,7 @@ public interface BargainActivityMapper extends BaseMapperX { // TODO @puhui999:一个商品,在统一时间,不会参与多个活动;so 是不是不用 inner join 哈? // PS:如果可以参与多个,其实可以这样写 select * from promotion_bargain_activity group by spu_id ORDER BY create_time DESC;通过 group 来过滤 + /** * 获取指定 spu 编号最近参加的活动,每个 spuId 只返回一条记录 * @@ -94,16 +96,20 @@ public interface BargainActivityMapper extends BaseMapperX { * @param status 状态 * @return 砍价活动列表 */ - @Select("SELECT p1.* " + + @Select("") + List selectListBySpuIdsAndStatus(@Param("spuIds") Collection spuIds, @Param("status") Integer status); } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/combination/CombinationActivityMapper.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/combination/CombinationActivityMapper.java index 1af92b538..14dfcb395 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/combination/CombinationActivityMapper.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/combination/CombinationActivityMapper.java @@ -44,6 +44,7 @@ public interface CombinationActivityMapper extends BaseMapperX " + "SELECT p1.* " + "FROM promotion_combination_activity p1 " + "INNER JOIN ( " + - " SELECT spu_id, MAX(DISTINCT(create_time)) AS max_create_time " + + " SELECT spu_id, MAX(DISTINCT create_time) AS max_create_time " + " FROM promotion_combination_activity " + - " WHERE spu_id IN #{spuIds} " + + " WHERE spu_id IN " + + "" + + " #{spuId}" + + "" + " GROUP BY spu_id " + ") p2 " + "ON p1.spu_id = p2.spu_id AND p1.create_time = p2.max_create_time AND p1.status = #{status} " + - "ORDER BY p1.create_time DESC;") - List selectListBySpuIds(@Param("spuIds") Collection spuIds, @Param("status") Integer status); + "ORDER BY p1.create_time DESC;" + + " ") + List selectListBySpuIdsAndStatus(@Param("spuIds") Collection spuIds, @Param("status") Integer status); + } 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 b3b75d36b..b82e4e3d5 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 @@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.promotion.controller.app.seckill.vo.activity.AppS import cn.iocoder.yudao.module.promotion.dal.dataobject.seckill.SeckillActivityDO; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import java.util.Collection; @@ -59,6 +60,7 @@ public interface SeckillActivityMapper extends BaseMapperX { } // TODO @puhui999:类似 BargainActivityMapper + /** * 获取指定 spu 编号最近参加的活动,每个 spuId 只返回一条记录 * @@ -66,16 +68,20 @@ public interface SeckillActivityMapper extends BaseMapperX { * @param status 状态 * @return 秒杀活动列表 */ - @Select("SELECT p1.* " + + @Select("") + List selectListBySpuIdsAndStatus(@Param("spuIds") Collection spuIds, @Param("status") Integer status); } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/bargain/BargainActivityServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/bargain/BargainActivityServiceImpl.java index 0905a09a7..5cf387956 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/bargain/BargainActivityServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/bargain/BargainActivityServiceImpl.java @@ -178,7 +178,7 @@ public class BargainActivityServiceImpl implements BargainActivityService { @Override public List getBargainActivityBySpuIdsAndStatus(Collection spuIds, Integer status) { - return bargainActivityMapper.selectListBySpuIds(spuIds, status); + return bargainActivityMapper.selectListBySpuIdsAndStatus(spuIds, status); } } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationActivityServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationActivityServiceImpl.java index db907ba36..c488bdc03 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationActivityServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationActivityServiceImpl.java @@ -228,7 +228,7 @@ public class CombinationActivityServiceImpl implements CombinationActivityServic @Override public List getCombinationActivityBySpuIdsAndStatus(Collection spuIds, Integer status) { - return combinationActivityMapper.selectListBySpuIds(spuIds, status); + return combinationActivityMapper.selectListBySpuIdsAndStatus(spuIds, 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 d2bbc7466..425610a50 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 @@ -312,7 +312,7 @@ public class SeckillActivityServiceImpl implements SeckillActivityService { @Override public List getSeckillActivityBySpuIdsAndStatus(Collection spuIds, Integer status) { - return seckillActivityMapper.selectListBySpuIds(spuIds, status); + return seckillActivityMapper.selectListBySpuIdsAndStatus(spuIds, status); } }