package com.dcs.equipment.controller;

import com.dcs.common.core.domain.AjaxResult;
import com.dcs.equipment.domain.InfluxDBQuery;
import com.dcs.equipment.service.InfluxDBService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
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;

/**
 * @author: wangpx
 * @date: 2025-04-16 15:52
 */
@Api
@RestController
@RequestMapping("/influxdb")
public class InfluxDBController {
    @Autowired
    private InfluxDBService service;

    @PostMapping("/queryWithFlux")
    @ApiOperation(value = "使用Flux语言查询InfluxDB数据")
    public AjaxResult queryWithFlux(@RequestBody InfluxDBQuery query) {
        return AjaxResult.success(service.queryWithFlux(query));
    }

    @PostMapping("/queryWithFluxQL")
    @ApiOperation(value = "使用FluxQL语言查询InfluxDB数据")
    public AjaxResult queryWithFluxQL(@RequestBody InfluxDBQuery query) {
        return AjaxResult.success(service.queryWithFluxQL(query));
    }
}
