package com.njcn.device.pms.mapper.majornetwork;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
import com.njcn.device.pms.pojo.dto.PmsMonitorBaseDTO;
import com.njcn.device.pms.pojo.dto.PmsSimpleDTO;
import com.njcn.device.pms.pojo.dto.PwPmsMonitorDTO;
import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam;
import com.njcn.device.pms.pojo.param.TaiZhangParam;
import com.njcn.device.pms.pojo.param.pwUser.PwUserMonitorParam;
import com.njcn.device.pms.pojo.po.DistributionMonitor;
import com.njcn.device.pms.pojo.po.Monitor;
import com.njcn.device.pms.pojo.po.PowerDistributionarea;
import com.njcn.device.pms.pojo.vo.DoubleUserVO;
import com.njcn.device.pms.pojo.vo.PmsPowerTreeMonitorVO;
import com.njcn.device.pms.pojo.vo.PmsSummaryStatisticsVO;
import com.njcn.device.pms.pojo.vo.pwUser.PwUserMonitorDataVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author hongawen
 * @since 2022-10-14
 */
public interface DistributionMonitorMapper extends MppBaseMapper<DistributionMonitor> {

    /**
     * 根据组织机构id获取配网监测点
     * @author cdf
     * @date 2022/10/27
     */
    @Deprecated
    List<PmsMonitorBaseDTO> getIdByOrgId(@Param("orgIds")List<String> orgIds, @Param("pmsDeviceInfoParam") PmsDeviceInfoParam pmsDeviceInfoParam);
    List<PmsMonitorBaseDTO> getIdByOrgIdNew(@Param("orgIds")List<String> orgIds, @Param("pmsDeviceInfoParam") PmsDeviceInfoParam pmsDeviceInfoParam);

    /**
     * @Description: 新获取配网配网信息
     * @param orgIds
     * @return: java.util.List<com.njcn.device.pms.pojo.dto.PmsMonitorBaseDTO>
     * @Author: wr
     * @Date: 2023/10/11 15:18
     */
    PmsSummaryStatisticsVO.SummaryVO getMonitorAndDevice(@Param("orgIds")List<String> orgIds);



    /**
     * 获取指定部门下的用电发电用户
     * @author cdf
     * @date 2022/11/15
     */
    List<DoubleUserVO> getDoubleUserByDept(@Param("orgId")String orgId);

    /**
     * 获取I类配网监测点
     * @author cdf
     * @date 2022/11/25
     */
    Page<Monitor> getMonitorByOrg(Page<Monitor> page, @Param("taiZhangParam")TaiZhangParam taiZhangParam,@Param("deptIds")List<String> deptIds);

    /**
     * 获取II类配网监测点
     * @author cdf
     * @date 2022/11/25
     */
    Page<PowerDistributionarea> getPowerDisAreaMonitorByOrg(Page<Monitor> page, @Param("taiZhangParam")TaiZhangParam taiZhangParam, @Param("deptIds")List<String> deptIds);

    /**
     * 获取III类配网监测点
     * @author cdf
     * @date 2022/11/25
     */
    Page<PmsPowerTreeMonitorVO> getThreeMonitorByOrgIdYong(Page<Monitor> page, @Param("taiZhangParam")TaiZhangParam taiZhangParam, @Param("deptIds")List<String> deptIds);

    Page<PmsPowerTreeMonitorVO> getThreeMonitorByOrgIdFa(Page<Monitor> page, @Param("taiZhangParam")TaiZhangParam taiZhangParam, @Param("deptIds")List<String> deptIds);


    List<DistributionMonitor> distributionMonitorListByCondition(@Param("deptIds")List<String> deptIds, @Param("monitorSort")String monitorSort);


    List<PmsSimpleDTO> statisticMonitor(@Param("list") List<String> monitorIds);

    List<PmsSimpleDTO> statisticTerminal(@Param("list") List<String> terminalIds);

    List<PmsSimpleDTO> getOnlineRate(@Param("list") List<String> terminalIds,@Param("param") StatisticsBizBaseParam param);

    List<PmsSimpleDTO> getIntegrity(@Param("list") List<String> terminalIds,@Param("param")StatisticsBizBaseParam param);


    List<PmsMonitorBaseDTO> getDisMonitorAllList(@Param("subId") String subId,@Param("type") Integer type);


    /**
     * 根据配网监测点id获取配网台账信息
     */
    List<PwPmsMonitorDTO> pwMonitorAreaDetailInfo(@Param("monitorIds") List<String> monitorIds);

    List<String> getBaseDisMonitorIds(@Param("list")List<String> list,@Param("monitorSortIds")List<String> monitorSortIds);

    /**
     * 删除配网表数据
     * @param dic 监测点类型
     * @param type 是否是发电用户
     * @return
     */
    Boolean deletePmsDistributionMonitor(@Param("dic") String dic,@Param("type") String type);

    /**
     * 配网批量导入发电用户
     * @param dic
     * @return
     */
    Boolean insertPmsDistributionUser(@Param("dic") String dic);

    /**
     * 配网批量导入台区
     * @param dic
     * @return
     */
    Boolean insertPmsDistributionArea(@Param("dic") String dic);


    /**
     * pms临时处理方式，后续物联平台接口修改开放后修改
     * @param deptIds
     * @param param
     * @return
     */
    //TODO pms临时处理方式，后续物联平台接口修改开放后修改
    List<PwUserMonitorDataVO> getDistributionList(@Param("deptIds")List<String> deptIds,@Param("param") PwUserMonitorParam param);
}
