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

import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.common.security.AuthUserContext;
import com.tmerclub.cloud.product.service.SpuService;
import com.tmerclub.cloud.product.vo.SpuCountVO;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author chiley
 * @date 2022/6/29 17:11
 */
@RestController("SpuStatisticsController")
@RequestMapping("/s/spu_statistics")
@Tag(name = "supplier-商品数据统计接口")
public class SpuStatisticsController {

    @Autowired
    private SpuService spuService;

    @GetMapping("/spu_count")
    @Operation(summary = "查询店铺各状态商品数量", description = "根据商品状态统计商品数量")
    public ServerResponseEntity<SpuCountVO> getSpuCount() {
        SpuCountVO spuCountVO = spuService.getSpuCountBySupplierId(AuthUserContext.get().getTenantId());
        return ServerResponseEntity.success(spuCountVO);
    }

}
