package com.casic.missiles.modular.system.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.casic.missiles.core.datascope.DataScope;
import com.casic.missiles.modular.system.dto.*;
import com.casic.missiles.modular.system.model.Device;
import org.apache.ibatis.annotations.Param;

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

/**
 * <p>
 * 设备表 Mapper 接口
 * </p>
 *
 * @author lwh123
 * @since 2019-05-23
 */
public interface DeviceMapper extends BaseMapper<Device> {

    List<DeviceDto> selectDataScopePage(@Param("scope") DataScope dataScope, @Param("page") Page<DeviceDto> page, @Param("deviceType") String deviceType, @Param("deptid") String deptid, @Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("keywords") String keywords,@Param("isOnline") String isOnline);
    List<DeviceInfoDto> getDeviceList(@Param("scope") DataScope dataScope);
    DeviceWellDto selectWellIdByCode(@Param("wellCode") String wellCode);

    DeviceConcentratorDto selectDeviceConcentorByCode(@Param("concenCode") String concenCode);

    List<DeviceMonitorDataDto> selectWellDataScopePage(@Param("dataScope") DataScope dataScope, @Param("page") Page<DeviceMonitorDataDto> page, @Param("deptid") String deptid, @Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("keywords") String keywords);

    List<DeviceMonitorDataDto> selectLiquidDataScopePage(@Param("dataScope") DataScope dataScope, @Param("page") Page<DeviceMonitorDataDto> page, @Param("deptid") String deptid, @Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("keywords") String keywords);

    List<Map<String, Object>> selectGasDataScopePage(@Param("dataScope") DataScope dataScope, @Param("page") Page<Map<String,Object>> page, @Param("deptid") String deptid, @Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("keywords") String keywords);

    List<Map<String, Object>> selectTubeDataScopePage(@Param("dataScope") DataScope dataScope, @Param("page") Page<Map<String,Object>> page, @Param("deptid") String deptid, @Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("keywords") String keywords);

    List<Map<String, Object>> selectHarmfulDataScopePage(@Param("dataScope") DataScope dataScope, @Param("page") Page<Map<String,Object>> page, @Param("deptid") String deptid, @Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("keywords") String keywords);

    List<Map<String, Object>> selectTempDataScopePage(@Param("dataScope") DataScope dataScope, @Param("page") Page<Map<String,Object>> page, @Param("deptid") String deptid, @Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("keywords") String keywords);

    List<Map<String, Object>> selectTempPressDataScopePage(@Param("dataScope") DataScope dataScope, @Param("page") Page<Map<String,Object>> page, @Param("deptid") String deptid, @Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("keywords") String keywords);

    List<Map<String, Object>> selectDigDataScopePage(@Param("dataScope") DataScope dataScope, @Param("page") Page<Map<String,Object>> page, @Param("deptid") String deptid, @Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("keywords") String keywords);

    List<Map<String, Object>> selectWellLocDataScopePage(@Param("dataScope") DataScope dataScope, @Param("page") Page<Map<String,Object>> page, @Param("deptid") String deptid, @Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("keywords") String keywords);

    List<Map<String, Object>> selectNoiseDataScopePage(@Param("dataScope") DataScope dataScope, @Param("page") Page<Map<String,Object>> page, @Param("deptid") String deptid, @Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("keywords") String keywords);

    List<AlarmDeptStaticsDto> alarmsStaticsByDept(@Param("deviceType") Long deviceType, @Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("dataScope") DataScope dataScope, @Param("deptId")Long deptId, @Param("searchCurr")Boolean searchCurr);

    List<DeviceCodeSelectDto> selectDevicesByConfig(@Param("dataScope") DataScope dataScope, @Param("deviceType") String deviceType, @Param("configStatus") String configStatus);

    List<Map<String, Object>> selectGasLiquidDataGasScopePage(@Param("dataScope") DataScope dataScope, @Param("page") Page<Map<String, Object>> page,@Param("deptIds") List<Long> deptIds, @Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("keywords") String keywords);

    List<Map<String, Object>> selectGasLiquidDataLiquidScopePage(@Param("dataScope") DataScope dataScope, @Param("page") Page<Map<String, Object>> page, @Param("deptIds") List<Long> deptIds, @Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("keywords") String keywords);

    List<Map<String, Object>> selectLiquidDataList(@Param("dataScope")DataScope dataScope, @Param("wellCode")String wellCode, @Param("beginTime")String beginTime, @Param("endTime")String endTime);

    List<Map<String, Object>> selectGasDataList(@Param("dataScope")DataScope dataScope, @Param("wellCode")String wellCode, @Param("beginTime")String beginTime, @Param("endTime")String endTime);

    List<Map<String, Object>> selectTempDataList(@Param("dataScope")DataScope dataScope, @Param("wellCode")String wellCode, @Param("beginTime")String beginTime, @Param("endTime")String endTime);

    List<Map<String, Object>> selectHarmfulDataList(@Param("dataScope")DataScope dataScope, @Param("wellCode")String wellCode, @Param("beginTime")String beginTime, @Param("endTime")String endTime);

    /**
     * 查询设备信息
     * @param id 设备主键
     * @return
     */
    DeviceInfoDto selectDeviceById(@Param("id") Long id);

    List<DeviceInWellInfo> getDeviceInWellInfo(@Param("id") Long id);
}
