package com.jjt.rziot;

import cn.hutool.json.JSONObject;
import com.jjt.JjtApplication;
import com.jjt.rz.domain.TwinDeviceRz;
import com.jjt.rz.service.ITwinDeviceRzService;
import com.jjt.utils.IotService;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

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

/**
 * DataTest$
 *
 * @author wukai
 * @date 2025/5/22 17:27
 */
@SpringBootTest(classes = JjtApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class DataTest {
    @Resource
    private IotService iotService;

    @Resource
    private ITwinDeviceRzService rzService;

    @Test
    void test() {
        List<TwinDeviceRz> list = rzService.selectTwinDeviceRzList(new TwinDeviceRz());
        for (TwinDeviceRz rz : list) {
            String sql = "select * from " + rz.getDevicePath();
            JSONObject jsonObject = iotService.query(sql);
            System.out.println(jsonObject);
        }
    }

}
