package com.njcn.device.device.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.device.biz.pojo.dto.PollutionLineInfoDTO;
import com.njcn.device.pq.pojo.po.Device;
import com.njcn.device.pq.pojo.vo.DevDetail;
import com.njcn.device.pq.pojo.vo.LineInfluxDbOnlineVO;
import com.njcn.device.pq.pojo.vo.RunManageVO;
import com.njcn.device.pq.pojo.vo.RunTimeVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author cdf
 * @since 2022-01-04
 */
public interface DeviceMapper extends BaseMapper<Device> {



    /**
     * 获取变电站下面装置
     * @param subId 变电站id
     * @param ip 装置ip
     * @param port 装置端口号
     * @author cdf
     * @date 2022/12/26
     */
    List<Device> getDeviceBySubId(@Param("subId") String subId,@Param("ip") String ip,@Param("port") Integer port,@Param("devId")String devId);


    /**
     * 获取监测点台账信息
     * @param list 监测点集合
     * @param comFlag 状态
     * @param searchValue
     * @return 结果
     */
    Page<RunManageVO> getRunManageCommList(@Param("page")Page<RunTimeVO> page,
                                           @Param("list") List<String> list,
                                       @Param("comFlag") List<Integer> comFlag,
                                       @Param("runFlag") List<Integer> runFlag,
                                       @Param("searchValue") String searchValue);

    /**
     * 获取监测点台账信息
     * @param list 监测点集合
     * @param comFlag 状态
     * @param searchValue
     * @return 结果
     */
    List<RunManageVO> getRunManageList(@Param("list") List<String> list,
                                       @Param("comFlag") List<Integer> comFlag,
                                       @Param("runFlag") List<Integer> runFlag,
                                       @Param("searchValue") String searchValue);

    /**
     * 获取监测点台账信息
     * @param list 终端集合
     * @param comFlag 状态
     * @param runFlag 状态
     * @param manufacturer
     * @param searchValue
     * @return 结果
     */
    Page<RunTimeVO> getRunManageDevList(@Param("page")Page<RunTimeVO> page,
                                        @Param("list") List<String> list,
                                        @Param("comFlag") List<Integer> comFlag,
                                        @Param("runFlag") List<Integer> runFlag,
                                        @Param("manufacturers") List<String> manufacturer,
                                        @Param("searchValue") String searchValue);


    Page<RunTimeVO> getDeviceLedger(@Param("page")Page<RunTimeVO> page,
                                        @Param("list") List<String> list,
                                        @Param("comFlag") List<Integer> comFlag,
                                        @Param("runFlag") List<Integer> runFlag,
                                        @Param("manufacturers") List<String> manufacturer,
                                        @Param("searchValue") String searchValue);


    List<LineInfluxDbOnlineVO> getOnlineEvaluate(@Param("list") List<String> devIndexes,
                                                 @Param("begin") String searchBeginTime,
                                                 @Param("end") String searchEndTime);

    /**
     * @Description: 获取终端集合信息
     * @param ids
     * @return: java.util.List<com.njcn.cloud.pojo.vo.app.DevDetail>
     * @Author: wr
     * @Date: 2023/11/7 15:40
     */
    List<DevDetail> selectDevByIds(@Param("ids") List<String> ids);

    void updateDeviceRunFlag(@Param("id")String deviceId, @Param("runFlag")Integer status);

    List<PollutionLineInfoDTO> getPollutionDeviceInfo(@Param("id")List<String> devId);

    List<DevDetail.DevPowerFlag> selectDevPowerFlagByIds(@Param("ids") List<String> ids);
}
