package com.zksy.base.gas.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zksy.base.gas.domain.GasMonitorData;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;

/**
* @author Administrator
* @description 针对表【gas_monitor_data(可燃气体监测仪数据表)】的数据库操作Mapper
* @createDate 2025-09-19 14:51:16
* @Entity com.zksy.gas.domain.GasMonitorData
*/
public interface GasMonitorDataMapper extends BaseMapper<GasMonitorData> {
    @Select("SELECT COUNT(DISTINCT DATE(create_time)) " +
            "FROM gas_monitor_data " +
            "WHERE mac_address = #{deviceId} " +
            "AND create_time BETWEEN #{start} AND #{end}")
    long countDistinctOnlineDays(@Param("deviceId") String deviceId,
                                 @Param("start") LocalDateTime start,
                                 @Param("end") LocalDateTime end);
}




