package com.usky.rule.mapper;

import com.usky.rule.domain.RuleEngineDevice;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface RuleEngineDeviceMapper {
    /** tenantId 为空时不按租户过滤 */
    List<RuleEngineDevice> selectByDeviceAndIdentifier(@Param("deviceId") String deviceId,
                                                        @Param("identifier") String identifier,
                                                        @Param("ruleEngineId") Long ruleEngineId,
                                                        @Param("tenantId") Integer tenantId);
    int insert(RuleEngineDevice row);
    int deleteByRuleEngineId(@Param("ruleEngineId") Long ruleEngineId);
    List<RuleEngineDevice> selectByRuleEngineId(@Param("ruleEngineId") Long ruleEngineId);
    /** 按设备 ID 查询关联的规则绑定（供设备上报触发使用） */
    List<RuleEngineDevice> selectByDeviceId(@Param("deviceId") String deviceId);

    /** 按设备 UUID 查询关联的规则绑定 */
    List<RuleEngineDevice> selectByDeviceUuid(@Param("deviceUuid") String deviceUuid);
}
