package com.njcn.product.terminal.mysqlTerminal.mapper;


import cn.hutool.core.date.DateTime;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.dto.SimpleDTO;
import com.njcn.product.terminal.mysqlTerminal.pojo.dto.DeviceType;
import com.njcn.product.terminal.mysqlTerminal.pojo.dto.LedgerBaseInfo;
import com.njcn.product.terminal.mysqlTerminal.pojo.dto.LineDevGetDTO;
import com.njcn.product.terminal.mysqlTerminal.pojo.param.DeviceInfoParam;
import com.njcn.product.terminal.mysqlTerminal.pojo.po.Line;
import com.njcn.product.terminal.mysqlTerminal.pojo.vo.LineDataVO;
import com.njcn.product.terminal.mysqlTerminal.pojo.vo.LineDetailVO;
import com.njcn.product.terminal.mysqlTerminal.pojo.vo.TerminalShowVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

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

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


    Page<TerminalShowVO> getStationList(@Param("page")Page<TerminalShowVO> page,@Param("lineIds")List<String> lineIds,@Param("runFlag")Integer runFlag,@Param("searchValue") String searchValue);

    Page<TerminalShowVO> getDevList(@Param("page")Page<TerminalShowVO> page,@Param("lineIds")List<String> lineIds,@Param("runFlag")Integer runFlag,@Param("searchValue") String searchValue);

    Page<TerminalShowVO> getLineList(@Param("page")Page<TerminalShowVO> page,@Param("lineIds")List<String> lineIds,@Param("comFlag")Integer comFlag,@Param("searchValue") String searchValue);


    LineDevGetDTO getMonitorDetail(@Param("monitorId")String monitorId);

    /**
     * 根据监测点id，获取所有监测点
     *
     * @param ids             监测点id
     * @param deviceInfoParam 监测点查询条件
     * @return 监测点数据
     */
    List<Line> getLineByCondition(@Param("ids") List<String> ids, @Param("deviceInfoParam") DeviceInfoParam deviceInfoParam);

    /**
     * 查询母线信息
     *
     * @param voltageIds 母线索引
     * @param scale      电压等级
     */
    List<Line> getVoltageByCondition(@Param("voltageIds") List<String> voltageIds, @Param("scale") List<SimpleDTO> scale);

    /**
     * 查询终端信息
     *
     * @param devIds       终端索引
     * @param deviceType   终端筛选条件
     * @param manufacturer 终端厂家
     */
    List<Line> getDeviceByCondition(@Param("devIds") List<String> devIds, @Param("deviceType") DeviceType deviceType, @Param("manufacturer") List<SimpleDTO> manufacturer);


    List<Line> getSubByCondition(@Param("subIds") List<String> subIds, @Param("scale") List<SimpleDTO> scale);


    /**
     * 查询变电站id
     *
     * @param subIds 变电站索引集合
     * @param scale      电压等级
     */
    List<String> getSubIdByScale(@Param("subIds") List<String> subIds, @Param("scale") String scale);


    /**
     * 查询监测点id
     *
     * @param lineIds  监测点索引集合
     * @param loadType 干扰源类型
     */
    List<String> getLineIdByLoadType(@Param("lineIds") List<String> lineIds, @Param("loadType") String loadType);


    /**
     * 查询终端id
     *
     * @param deviceIds    终端索引集合
     * @param manufacturer 制造厂家
     */
    List<String> getDeviceIdByManufacturer(@Param("deviceIds") List<String> deviceIds, @Param("manufacturer") String manufacturer);


    List<String> getDeviceIdByPowerFlag(@Param("lineIds")List<String> lineIds, @Param("powerFlag")Integer manufacturer);


    /**
     * 获取监测点信息
     *
     * @param id 监测点id
     * @return 结果
     */
    LineDetailVO getLineSubGdDetail(@Param("id") String id);

    List<LineDataVO> getLineDetail(@Param("ids") List<String> ids);

    List<LedgerBaseInfo> queryMonitorByUser(@Param("userIds")List<String> userIds);
}
