package com.njcn.csharmonic.controller;

import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.csharmonic.param.DevicDataTrendQueryParam;
import com.njcn.csharmonic.pojo.vo.ThdDataVO;
import com.njcn.csharmonic.service.DeviceDataTrendService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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;

import java.util.List;

/**
 * Description:
 * Date: 2023/6/26  9:07【需求编号】
 *
 * @author clam
 * @version V1.0.0
 */
@Slf4j
@RestController
@RequestMapping("/datatrend")
@Api(tags = "设备数据趋势")
@AllArgsConstructor
public class DeviceDataTrendController extends BaseController {


    private final DeviceDataTrendService deviceDataTrendService;
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/querydatatrend")
    @ApiOperation("查询设备数据趋势")
    @ApiImplicitParam(name = "devicDataTrendQueryParam", value = "设备数据趋势参数", required = true)
    public HttpResult< List<List<ThdDataVO>>> queryDataTrend(@RequestBody DevicDataTrendQueryParam devicDataTrendQueryParam) {
        String methodDescribe = getMethodDescribe("queryDataTrend");
        List<List<ThdDataVO>> result = deviceDataTrendService.queryDataTrend(devicDataTrendQueryParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }
}
