package com.muyu.event.service.impl;

import com.muyu.event.config.IoTDBConfig;
import com.muyu.event.domian.AddCarInformation;
import com.muyu.event.domian.CarInformation;
import com.muyu.event.service.IoTDBService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Array;
import java.util.ArrayList;
import java.util.List;

/**
 * @author 刘武
 * @package：com.muyu.event.service
 * @name：IotdbService
 * @date：2024/9/28 19:19
 */
@Service
public class IoTDBServiceImpl implements IoTDBService {

    @Autowired
    private IoTDBConfig ioTDBConfig;


    @Override
    public List<CarInformation> findIoTDBList() {



        return null;
    }

    @Override
    public CarInformation findIoTDBByVin(String carVin) {
        CarInformation carInformation = ioTDBConfig.queryIoTDB(carVin);
        return carInformation;
    }

    @Override
    public void insertIoTDB(AddCarInformation addCarInformation) {
        ArrayList<String> list = new ArrayList<>();
        if (addCarInformation!=null){
            list.add(addCarInformation.getCarVin());
            list.add(addCarInformation.getInformation());
        }

        ioTDBConfig.insertIoTDB(list);
    }
}
