package com.seer.teach.mall.good.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.seer.teach.common.PageListBean;
import com.seer.teach.common.ResultBean;
import com.seer.teach.common.annotation.LogPrint;
import com.seer.teach.mall.good.service.IAdminGoodsSpecificationService;
import com.seer.teach.mall.request.GoodsSpecificationQueryReq;
import com.seer.teach.mall.response.GoodsSpecificationResp;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 规格表 前端控制器
 * </p>
 *
 * @author Sir-G
 * @since 2025-06-10
 */
@RestController
@RequestMapping("/mall/sku")
@Tag(name = "管理端 - 商品规格管理")
@Validated
@RequiredArgsConstructor
public class AdminSkuController {

    private final IAdminGoodsSpecificationService goodsSpecificationService;

    @PostMapping("/list")
    @LogPrint
    @Operation(summary = "商品规格分页查询")
    @SaCheckPermission("admin:sku:list")
    public ResultBean<PageListBean<GoodsSpecificationResp>> getSpecificationPage(@RequestBody @Validated GoodsSpecificationQueryReq params){
        PageListBean<GoodsSpecificationResp> result = goodsSpecificationService.getGoodsSpecification(params);
        return ResultBean.success(result);
    }

}