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.Date;
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> getDeviceList(@Param("scope") DataScope dataScope, @Param("deviceType") String deviceType, @Param("deptid") Long deptid, @Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("keywords") String keywords, @Param("isOnline") String isOnline);

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

    List<DeviceInfoDto> getDeviceListInfo(@Param("scope") DataScope dataScope);

    DeviceWellDto selectWellIdByCode(@Param("wellCode") String wellCode);

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

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

    List<Map<String, Object>> offlineListPage(@Param("dataScope") DataScope dataScope, @Param("page") Page<Map<String, Object>> page,
                                              @Param("deviceCode") String deviceCode, @Param("deviceType") Integer deviceType);


    List<Map<String, Object>> getOfflineTimeList(@Param("tableName") String tableName);

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

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

    DeviceDto getDetailById(@Param("id") String id);

    Integer logicDelete(@Param("id") Long id, @Param("currentTime") Long currentTime);

    List<Map<String, String>> getDeviceType();

    List<Map<String, String>> getDeptList();

}
