package com.tofly.water.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tofly.scada.entity.Allocation;
import com.tofly.water.entity.dto.MonitorDto;
import com.tofly.water.entity.dto.MonitorRealDto;
import com.tofly.water.entity.dto.OverviewDto;
import com.tofly.water.entity.dto.StatisticsRealDto;
import com.tofly.water.entity.vo.*;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

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

/**
 * @author HaiQiu
 * @since 2022/11/30
 */
public interface OverviewMapper {

    Page<DeviceBusPumpsVo> getDevicesByPage(Page page, @Param("queryWrapper") OverviewDto queryWrapper);

    List<DeviceBusPumpsVo> getDevices(@Param("queryWrapper") OverviewDto queryWrapper);

    List<MonitorPumpVo> monitor(@Param("overviewDto") MonitorDto overviewDto, @Param("tableName") String tableName);

    Page<MonitorPumpVo> pageMonitor(Page page, @Param("overviewDto") MonitorDto overviewDto, @Param("tableName") String tableName);

    Page<MonitorPumpVo> pageMonitorNew(Page page, @Param("overviewDto") MonitorDto overviewDto, @Param("tableName") String tableName);




    List<MonitorWaterVo> monitorWater(@Param("overviewDto") MonitorRealDto overviewDto, @Param("tableName") String tableName);

    Page<MonitorWaterVo> pageMonitorWater(Page page, @Param("overviewDto") MonitorRealDto overviewDto, @Param("tableName") String tableName);

    Page<ReportPumpVo> reportRealPage(Page page, @Param("overviewDto") MonitorRealDto dto);

    List<ReportPumpVo> reportReal(Page page, @Param("overviewDto") MonitorRealDto dto);

    Page<ReportWaterVo> reportRealWaterPage(Page page, @Param("overviewDto") MonitorRealDto dto);

    List<ReportWaterVo> reportWaterReal(Page page, @Param("overviewDto") MonitorRealDto dto);


    List<StatisticsPumpRealVo> statisticsPumpReal(@Param("overviewDto") StatisticsRealDto overviewDto);

    Page<StatisticsPumpRealVo> statisticsPumpRealPage(Page page, @Param("overviewDto") StatisticsRealDto overviewDto);


    List<StatisticsWaterRealVo> statisticsPumpWater(@Param("overviewDto") StatisticsRealDto overviewDto);

    Page<StatisticsWaterRealVo> statisticsPumpWaterPage(Page page, @Param("overviewDto") StatisticsRealDto overviewDto);

    /**
     * 水厂今日供水量
     * @return
     */
    List<WaterSupplyVo> waterSupplyDay(@Param("codes") List<String> codes);

    /**
     *
     * @param yearStart
     * @param yearEnd
     * @return
     */
    List<WaterSupplyVo> waterSupplyYear(
            @Param("yearStart")Date yearStart,
            @Param("yearEnd")Date yearEnd,@Param("codes") List<String> codes);


    List<PupmSupplyVo> pumpSupplyDay();
    List<PupmSupplyVo> pumpSupplyYear();


    List<ScadaReportVo> reportCount();


    @Select("select ID from TF_WATER_INFO")
    List<Long> getWaterIds();


    String selectValueByCode(String code,Long pumpGroupId);

    List<Allocation> selectPumpByIndex(@Param("ids") List<Long> ids,@Param("typeQuery") Integer type);

    List<Map<String,String>> waterSupplyOneMonth(@Param("waterType") String waterType,@Param("yearAndMonth")String yearAndMonth,@Param("codes")List<String> codes);

    Map<String,Object> waterSupplYearReport(@Param("yearAndMonth")String yearAndMonth,@Param("waterId")Long waterId, @Param("waterSupplyJin")String waterSupplyJin,@Param("waterSupplyChu")String waterSupplyChu);

    Map<String,Object> waterSupplyMonthReport(@Param("yearAndMonth")String yearAndMonth, @Param("waterSupplyJin")String waterSupplyJin,@Param("waterSupplyChu")String waterSupplyChu);
    Map<String,Object> waterSupplyDayReport(@Param("startHour")String startHour,
                                            @Param("endHour")String endHour,
                                            @Param("yearAndMonth")String yearAndMonth,
                                            @Param("waterId")Long waterId,
                                            @Param("waterSupplyJin")String waterSupplyJin,
                                            @Param("waterSupplyChu")String waterSupplyChu);

    Map<String,Object> waterSupplyCommReport(@Param("yearAndMonth")String yearAndMonth,@Param("formatterStr")String formatterStr,@Param("dateType")Integer dateType,@Param("waterId")Long waterId, @Param("waterSupplyJin")String waterSupplyJin,@Param("waterSupplyChu")String waterSupplyChu);


   BigDecimal getWaterAllocationCount(@Param("waterId")Long waterId);

    BigDecimal getWaterAlarmCount(@Param("waterId")Long waterId);

    BigDecimal getWaterAlarmAllocationCount(@Param("waterId")Long waterId);

   List<String> getWaterAllocation(@Param("waterId")Long waterId,@Param("codes")String codes,@Param("isOut")String isOut);


    WaterProductionInfoVo getWaterProductInfo(@Param("waterType") String waterType);
}
