package com.hwrj.cloud.admin.controller;

import com.hwrj.cloud.admin.dto.param.BigDataListInfoVo;
import com.hwrj.cloud.admin.dto.param.BigDataListParam;
import com.hwrj.cloud.admin.dto.param.BigDataListVo;
import com.hwrj.cloud.admin.dto.param.SelectVo;
import com.hwrj.cloud.admin.service.PmsProductService;
import com.hwrj.cloud.common.api.CommonPage;
import com.hwrj.cloud.common.api.CommonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.sf.jsqlparser.statement.select.SelectBody;
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;

import java.io.IOException;
import java.util.List;

@RestController
@RequestMapping("/bigData")
@Api(tags = "产品大屏接口",description = "获取大屏数据")
public class PmsProductBigDataController {
    @Autowired
    private PmsProductService productService;

    @ApiOperation("产品列表查询")
    @GetMapping(value = "/product/list")
    public CommonResult<CommonPage<BigDataListInfoVo>> bigDataList(BigDataListParam bigDataListParam) throws IOException {
        List<BigDataListInfoVo> list = productService.bigDataList(bigDataListParam);
        return CommonResult.success(CommonPage.restPage(list));
    }

    @ApiOperation("产品类别查询")
    @GetMapping(value = "/product/type")
    public CommonResult<List<SelectVo> > bigDataType() throws IOException {
        List<SelectVo> list = productService.bigDataType();
        return CommonResult.success(list);
    }

    @ApiOperation("产品详细信息查询")
    @GetMapping(value = "/product/info")
    public CommonResult<BigDataListInfoVo> bigDatainfo(Long id) {
        BigDataListInfoVo bigDataListInfoVo = productService.bigDatainfo(id);
        return CommonResult.success(bigDataListInfoVo);
    }
}
