/*
 * 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.model.ShopSku;
import com.yami.shop.common.util.R;
import com.yami.shop.service.ShopSkuService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;


/**
 * 门店对应商品价格和库存管理
 *
 * @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(@RequestParam(defaultValue = "1") Integer current,
                                  @RequestParam(defaultValue = "10") Integer size,
                                  ShopSku shopSku) {
        IPage<ShopSku> page = shopProdService.shopSkuPage(current,size,shopSku);
        return R.SUCCESS(page);
    }


}
