package org.dromara.ems.record.service.impl;

import org.dromara.ems.record.domain.TWTempertureData;
import org.dromara.ems.record.mapper.TWTempertureDataMapper;
import org.dromara.ems.record.service.ITWTempertureDataService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 物联网实时数据Service业务层处理
 * 
 * @author Caoql
 * @date 2024-08-21
 */
@Service
@RequiredArgsConstructor
public class TWTempertureDataServiceImpl implements ITWTempertureDataService 
{
    
    private final TWTempertureDataMapper tWTempertureDataMapper;

    /**
     * 查询物联网实时数据
     * 
     * @param objid 物联网实时数据主键
     * @return 物联网实时数据
     */
    @Override
    public TWTempertureData selectTWTempertureDataByObjid(Long objid)
    {
        return tWTempertureDataMapper.selectTWTempertureDataByObjid(objid);
    }

    /**
     * 查询物联网实时数据列表
     * 
     * @param tWTempertureData 物联网实时数据
     * @return 物联网实时数据
     */
    @Override
    public List<TWTempertureData> selectTWTempertureDataList(TWTempertureData tWTempertureData)
    {
        return tWTempertureDataMapper.selectTWTempertureDataList(tWTempertureData);
    }

    /**
     * 新增物联网实时数据
     * 
     * @param tWTempertureData 物联网实时数据
     * @return 结果
     */
    @Override
    public int insertTWTempertureData(TWTempertureData tWTempertureData)
    {
        return tWTempertureDataMapper.insertTWTempertureData(tWTempertureData);
    }

    /**
     * 修改物联网实时数据
     * 
     * @param tWTempertureData 物联网实时数据
     * @return 结果
     */
    @Override
    public int updateTWTempertureData(TWTempertureData tWTempertureData)
    {
        return tWTempertureDataMapper.updateTWTempertureData(tWTempertureData);
    }

    /**
     * 批量删除物联网实时数据
     * 
     * @param objids 需要删除的物联网实时数据主键
     * @return 结果
     */
    @Override
    public int deleteTWTempertureDataByObjids(Long[] objids)
    {
        return tWTempertureDataMapper.deleteTWTempertureDataByObjids(objids);
    }

    /**
     * 删除物联网实时数据信息
     * 
     * @param objid 物联网实时数据主键
     * @return 结果
     */
    @Override
    public int deleteTWTempertureDataByObjid(Long objid)
    {
        return tWTempertureDataMapper.deleteTWTempertureDataByObjid(objid);
    }

    /**
     * 查询实时物联网数据
     * @param tWTempertureData
     * @return
     */
    @Override
    public List<TWTempertureData> selectIotInstantList(TWTempertureData tWTempertureData) {
        return tWTempertureDataMapper.selectIotInstantList(tWTempertureData);
    }

    /**
     * 根据设备编号查询实时物联网设备监控数据
     * @param monitorId
     * @return
     */
    @Override
    public TWTempertureData selectIotInstantMinitoringData(String monitorId) {
        return tWTempertureDataMapper.selectIotInstantMinitoringData(monitorId);
    }

    /**
     * 查询物联网实时分组数据列表
     * @param tWTempertureData
     * @return
     */
    public List<TWTempertureData> selectLastTWTempertureDataList(TWTempertureData tWTempertureData) {
        // 按monitorName分组并获取每个分组的最新记录
        return tWTempertureDataMapper.selectLastTWTempertureDataList(tWTempertureData);
    }
}
