
package com.tmerclub.cloud.product.controller.app;

import com.tmerclub.cloud.common.product.vo.GiveawayVO;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.product.service.GiveawayService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
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;

/**
 * 赠品表
 *
 * @author tmerclub
 * @date 2022-08-16 11:11:58
 */
@RestController("appGiveawayController")
@RequestMapping("/giveaway")
@Tag(name = "app-赠品表")
public class GiveawayController {

    @Autowired
    private GiveawayService giveawayService;


    @GetMapping("/info/{spuId}")
    @Operation(summary = "通过商品id查询赠品信息", description = "通过商品id查询赠品")
    public ServerResponseEntity<GiveawayVO> getById(@PathVariable("spuId") Long spuId) {
        GiveawayVO giveawayVO = giveawayService.getGiveawaySpuBySpuId(spuId);
        return ServerResponseEntity.success(giveawayVO);
    }

}


