package com.corewing.app.modules.website;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.corewing.app.common.Result;
import com.corewing.app.dto.website.ProductCategoryRequest;
import com.corewing.app.dto.website.ProductPageRequest;
import com.corewing.app.entity.BizProduct;
import com.corewing.app.entity.BizProductCategory;
import com.corewing.app.service.BizProductCategoryService;
import com.corewing.app.service.BizProductService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 产品
 */
@Api(tags = "官网产品列表")
@RestController
@RequestMapping("/api/website/product")
public class WebsiteProductController {

    @Resource
    private BizProductService productService;


    @Resource
    private BizProductCategoryService productCategoryService;


    @ApiOperation("获取产品分页")
    @GetMapping("/page")
    public Result<Page<BizProduct>> page(ProductPageRequest productPageRequest) {
        return Result.success(productService.page(productPageRequest));
    }

    @ApiOperation("获取产品分类")
    @GetMapping("/category/list")
    public Result<List<BizProductCategory>> categoryList(ProductCategoryRequest productCategoryRequest) {
        return Result.success(productCategoryService.list(productCategoryRequest));
    }



}
