package com.sckw.slope.detection.dao.tdengine;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sckw.slope.detection.model.dos.tdengine.SlopeData;
import com.sckw.slope.detection.model.vo.SlopeDataVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author lfdc
 * @description
 * @date 2023-10-25 09:10:17
 */
@DS("td")
@Mapper
@Repository
public interface SlopeDataMapper extends BaseMapper<SlopeData> {

    @Select("select * from devicesv2.device_#{number}")
    List<SlopeDataVo> selectAll(@Param("vin") String vin, @Param("number") String number);

    List<SlopeDataVo> selectList();

    SlopeData selectListByLine(@Param("snCode") String snCode,@Param("item") String item);

    List<SlopeData> selectListByTwoLine(@Param("snCode") String snCode,@Param("item") String item);

    List<SlopeData> selectListLineByMsgId(@Param("snCode") String snCode,@Param("item") String item,@Param("msgId") String msgId);

    List<SlopeData> selectLineList(@Param("snCode") String snCode, @Param("item") String item, @Param("dateStart") String dateStart, @Param("dateEnd") String dateEnd);

    List<SlopeData> selectLineListByArray(@Param("snCode") String snCode, @Param("parts") Object parts, @Param("dateStart") String dateStart, @Param("dateEnd") String dateEnd);

    List<SlopeData> selectLineListByList(@Param("snCode") String snCode, @Param("parts") List<String> parts, @Param("dateStart") String dateStart, @Param("dateEnd") String dateEnd);

    int insertData(@Param("slopeData") SlopeData slopeData);

    List<SlopeData> selectListByLineOrderByCreateTime(@Param("snCode") String snCode, @Param("item") String item);

    List<SlopeDataVo> selectListByMaster(@Param("page") Integer page, @Param("pageSize") Integer pageSize);

    List<SlopeDataVo> selectListByMasterCount(Integer newPage, Integer pageSize);

    @DS("td")
    SlopeData selectLastData(@Param("deviceCode") String deviceCode);
}
