package com.pqs9900.mapper.linedata;

import com.njcn.pojo.commons.runmanage.IntergralityTable;
import com.njcn.pojo.commons.runmanage.OnlineRateData;
import com.njcn.pojo.data.ComInformation;
import com.pqs9900.pojo.linedata.*;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;

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

/**
 * system
 *
 * @author cdf
 * @date 2021/11/9
 */
public interface TopStrategyMapper extends Mapper<TerminalRun> {
    List<TerminalRun> getList();

    /**
     * 获取每天终端异常情况
     * @author cdf
     * @date 2021/11/9
     */


    List<OnlineRateData> selectOnlineRate( @Param("startTime")Date startTime, @Param("endTime")Date endTime,@Param("lineGrade") Integer lineGrade);


    List<IntergralityTable> selectIntegrityData(@Param("startTime")Date startTime, @Param("endTime")Date endTime, @Param("lineGrade")Integer lineGrade);

    List<IntergralityTable> getIntegrityTask(@Param("startTime")Date startTime);

    /**
     * 获取前一天装置在线率为0的装置
     * @author cdf
     * @date 2021/12/13
     */
    List<TopExceptionParam> getDevOnlineZero(@Param("startTime")Date startTime);

    List<OnlineRateCldParam> getOffTimeTask(@Param("startTime")Date startTime,@Param("endTime")Date endTime, @Param("devIndex")Integer devIndex);

    List<TopExceptionParam> getOffLineTask(@Param("startTime")Date startTime, @Param("endTime")Date endTime);

    List<ComInformation> devMsgInfo(@Param("devIndex")int devIndex, @Param("startTime")Date startTime, @Param("endTime")Date endTime);

    List<TopExceptionParam> getFlowOutTask(@Param("startTime")Date startTime,@Param("timeId")String timeId,@Param("preValue")Integer preValue,@Param("allDay")Integer allDay,@Param("intervals")Integer intervals);

    List<TopExceptionParam>  getOffTimeList(@Param("devIndex")Integer devIndex,@Param("startTime")Date startTime,@Param("endTime")Date endTime,@Param("offTime")Integer offTime);

    Integer addTopException(@Param("list") List<TopException> list);

    Integer getTopCount(@Param("startTime")Date startTime);

    List<TopView> getTopView(@Param("startTime")Date startTime,@Param("endTime")Date endTime,@Param("lineGrade")Integer lineGrade);

    List<TopException> getRunExceptionDetail(@Param("timeId")Date timeId,@Param("lineGrade")Integer lineGrade);

    TopException getRunExceptionDetailById(@Param("timeId")Date timeId,@Param("devIndex")Integer devIndex);


    /**
     * 进行流量查询
     */
    List<TopExceptionParam> getDevFlow(@Param("startTime")Date startTime,@Param("timeId")String timeId);

    /**
     * 批量更新装置流量
     * @author cdf
     * @date 2021/11/18
     */
    Integer batchUpdateDevFlow(@Param("list") List<TopExceptionParam> list);

    /**
     * 单个监测点数据完整性统计
     * @author dhj
     * @date 2021/12/07
     */
    List<DataIntegralityStatis> getDataIntegralityStatis(@Param("lineId")Long lineId,@Param("startTime")String startTime,@Param("endTime")String endTime);


}
