package com.sckw.slope.detection.controller;

import com.alibaba.fastjson2.JSONObject;
import com.sckw.slope.detection.model.dos.tdengine.Devices;
import com.sckw.slope.detection.service.TdengineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lfdc
 * @description
 * @date 2023-10-24 13:10:04
 */
@RestController
@RequestMapping("/tdengine")
public class TdengineDemoController {

    @Autowired
    TdengineService tdengineDemoService;

    @RequestMapping(value = "/tdengine", method = RequestMethod.GET)
    public void tdengineDemo() {
        tdengineDemoService.tdengineDemo();


    }

    @RequestMapping(value = "/getDevicesDemo", method = RequestMethod.GET)
    public void getDevicesDemo() {
        Devices devices = tdengineDemoService.selectLastData("f1beaa4b9d85f26f288bb3b8e72a6aa0");
        System.out.println("devices" + JSONObject.toJSONString(devices));
    }

    @RequestMapping(value = "/getTable", method = RequestMethod.GET)
    public void getTable() {
        tdengineDemoService.getTable();
    }

    @RequestMapping(value = "/createTable", method = RequestMethod.GET)
    public void createTable() {
        tdengineDemoService.createTable();
    }
}
