package com.sqx.modules.activity.controller.app;

import com.sqx.common.utils.Result;
import com.sqx.modules.activity.bo.ShopActivityBO;
import com.sqx.modules.activity.service.ActivityService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
* 活动商品
* @author : codingliang
* @date : 2024-6-17
*/
@Api(tags = "活动-app活动商品")
@RestController
@RequestMapping("app/activity-goods")
@RequiredArgsConstructor
public class AppActivityGoodsController {

   private final ActivityService activityService;

   @GetMapping("{shopId}/{goodsId}")
   @ApiOperation("查看商品参与的活动列表")
   public Result getActivityListByGoodsId(@PathVariable @ApiParam("店铺id") Long shopId, @PathVariable @ApiParam("商品id") Long goodsId) {
       List<ShopActivityBO> shopActivityBOS = activityService.getActivityListByShopIdAndGoodsId(shopId, goodsId);
       return Result.success().put("data", shopActivityBOS);
   }
}
