/*
 * Copyright (c) 2018-2999 广州亚米信息科技有限公司 All rights reserved.
 *
 * https://www.gz-yami.com/
 *
 */

package com.yami.shop.platform.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yami.shop.bean.dto.OrderRefundDto;
import com.yami.shop.bean.model.ChannelProd;
import com.yami.shop.bean.model.ShopSku;
import com.yami.shop.common.util.PageParam;
import com.yami.shop.common.util.R;
import com.yami.shop.service.ShopSkuService;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;


/**
 * 门店对应商品价格和库存管理
 *
 * @author fbj
 * @version 1.0.0
 * @since 2025-09-19
 */
@RestController
@AllArgsConstructor
@RequestMapping("/shop/shopProd")
public class ShopSkuController {

    private final ShopSkuService shopProdService;

    /**
     * 新建店铺
     */
    @PostMapping
    public R<ShopSku> ShopProd(@RequestBody ShopSku shopSku) {
        shopProdService.insertSku(shopSku);
        return R.SUCCESS(shopSku);
    }
    /**
     * 分页查询门店对应商品详细
     */
    @GetMapping("/page")
    public R<IPage<ShopSku>> page(PageParam<ShopSku> page, ShopSku shopSku) {
        return R.SUCCESS(shopProdService.shopSkuPage(page,shopSku));
    }


    @GetMapping("/export")
    @ApiOperation(value = "导出渠道商品数据")
    public void exportChannelProds(ShopSku shopSku, HttpServletResponse response) {
        shopProdService.exportChannelProds(shopSku, response);
    }

}
