package com.xzzn.ems.mapper;

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

import com.xzzn.ems.domain.EmsDevicesSetting;
import org.apache.ibatis.annotations.Param;

/**
 * Modbus设备配置Mapper接口
 *
 * @author xzzn
 * @date 2025-06-24
 */
public interface EmsDevicesSettingMapper
{
    /**
     * 查询Modbus设备配置
     *
     * @param id Modbus设备配置主键
     * @return Modbus设备配置
     */
    public EmsDevicesSetting selectEmsDevicesSettingById(Long id);

    /**
     * 查询Modbus设备配置列表
     *
     * @param emsDevicesSetting Modbus设备配置
     * @return Modbus设备配置集合
     */
    public List<EmsDevicesSetting> selectEmsDevicesSettingList(EmsDevicesSetting emsDevicesSetting);

    /**
     * 新增Modbus设备配置
     *
     * @param emsDevicesSetting Modbus设备配置
     * @return 结果
     */
    public int insertEmsDevicesSetting(EmsDevicesSetting emsDevicesSetting);

    /**
     * 修改Modbus设备配置
     *
     * @param emsDevicesSetting Modbus设备配置
     * @return 结果
     */
    public int updateEmsDevicesSetting(EmsDevicesSetting emsDevicesSetting);

    /**
     * 删除Modbus设备配置
     *
     * @param id Modbus设备配置主键
     * @return 结果
     */
    public int deleteEmsDevicesSettingById(Long id);

    /**
     * 批量删除Modbus设备配置
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteEmsDevicesSettingByIds(Long[] ids);
    /**
     * 根据父类设备id获取子设备id
     * @param parentId
     * @return
     */
    public List<Map<String, Object>> getDeviceInfoByParentId(@Param("siteId")String siteId, @Param("parentId")String parentId);

    /**
     * 根据site_id和device_category获取指定设备信息
     * @param siteId
     * @param deviceCategory
     * @return
     */
    public List<Map<String, Object>> getDeviceInfosBySiteIdAndCategory(@Param("siteId")String siteId, @Param("deviceCategory")String deviceCategory);

    /**
     * 获取该设备下所有的电表
     * @param siteId
     * @return
     */
    public List<Map<String, Object>> getAmmeterNameList(String siteId);

    public EmsDevicesSetting getDeviceBySiteAndDeviceId(@Param("deviceId")String deviceId, @Param("siteId")String siteId);

    public List<Map<String, Object>> getClusterIdsByFuzzyQuery(@Param("siteId")String siteId, @Param("deviceCategory")String deviceCategory,
                                                               @Param("parentId")String parentId);

    public List<String> getAllDeviceCategoryBySiteId(String siteId);
}
