package com.fs.watch.mapper;

import com.fs.common.annotation.DataSource;
import com.fs.common.enums.DataSourceType;
import com.fs.watch.domain.WatchSpo2Data;
import com.fs.watch.domain.vo.WatchSpo2DataVo;
import org.apache.ibatis.annotations.Param;

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

/**
* @author Administrator
* @description 针对表【watch_spo2_data(设备血氧数据)】的数据库操作Mapper
* @createDate 2024-10-15 11:06:51
* @Entity watch.domain.WatchSpo2Data
*/
@DataSource(DataSourceType.CLICKHOUSE)
public interface WatchSpo2DataMapper {

    Integer queryByCreateTime(@Param("createTime") String createTime);

    void insert(@Param("data") WatchSpo2Data data);

    List<WatchSpo2DataVo> queryByDateAndDeviceIdAndState(@Param("date") String date, @Param("deviceId") String deviceId);

    List<WatchSpo2DataVo> querySpByDate(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("deviceId") String deviceId);

    List<Map<String, Object>> countSpByDate(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("deviceId") String deviceId);

    WatchSpo2DataVo getLatest(@Param("deviceId") String deviceId);

    int countSpPageByDate(@Param("startTime") String startTime,
                          @Param("endTime") String endTime,
                          @Param("deviceId") String deviceId);

    List<WatchSpo2DataVo> querySpPageByDate(@Param("startTime") String startTime,
                                            @Param("endTime") String endTime,
                                            @Param("deviceId") String deviceId,
                                            @Param("num") Integer num,
                                            @Param("size") Integer size
    );
}
