package com.fastbee.deviceInfo.manager;

import com.fastbee.deviceInfo.domain.*;
import com.fastbee.deviceInfo.mapper.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class DeviceInformationManager {

    @Autowired
    private DeviceInformationMeteorologyMapper meteorologyMapper;

    @Autowired
    private DeviceInformationMiaoqingMapper miaoqingMapper;

    @Autowired
    private DeviceInformationMoistureMapper moistureMapper;

    @Autowired
    private DeviceInformationMonitorMapper monitorMapper;

    @Autowired
    private DeviceInformationTargetpestsMapper targetpestsMapper;

    @Autowired
    private DeviceInformationWormsMapper wormsMapper;


    /**
     * 获取所有设备
     */
    public Map<String,Object> getAllDeviceCount() {
        List<DeviceInformationMeteorology> meteorologieList = meteorologyMapper.selectDeviceInformationMeteorologyList(null);
        List<DeviceInformationMiaoqing> miaoqingList = miaoqingMapper.selectDeviceInformationMiaoqingList(null);
        List<DeviceInformationMoisture> moistureList= moistureMapper.selectDeviceInformationMoistureList(null);
        List<DeviceInformationMonitor> monitorList = monitorMapper.selectDeviceInformationMonitorList(null);
        List<DeviceInformationTargetpests> targetpestList= targetpestsMapper.selectDeviceInformationTargetpestsList(null);
        List<DeviceInformationWorms> wormList = wormsMapper.selectDeviceInformationWormsList(null);

        Map<String,Object> resp =new HashMap<>();
        resp.put("meteorologieTotal",meteorologieList.size());
        resp.put("miaoqingTotal",miaoqingList.size());
        resp.put("moistureTotal",moistureList.size());
        resp.put("monitorTotal",monitorList.size());
        resp.put("targetpestTotal",targetpestList.size());
        resp.put("wormTotal",wormList.size());
        resp.put("photovoltaicTotal",miaoqingList.size());
        return resp;
    }


}
