<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yfd.platform.modules.algorithm.mapper.AlgorithmDeviceMapper">
<!--String algorithmId, String componentId-->
    <select id="getAlgorithmDeviceParams" resultType="java.util.Map">
        SELECT
            ad.param_id,
            ad.param_name,
            ad.param_value,
            ap.param_fixed
        FROM
            iis_algorithm_params ap
            INNER JOIN iis_algorithm_device ad ON ap.id = ad.param_id
        WHERE
            ap.param_fixed = '1'
        <if test="algorithmId != null and algorithmId != ''">
            AND ad.algorithm_id = #{algorithmId}
        </if>
        <if test="componentId != null and componentId != ''">
            AND ad.component_id =#{componentId}
        </if>
    </select>
    <select id="getAlgorithmDeviceType" resultType="java.util.Map">
        SELECT
            ad.device_id,
            ad.source_type
        FROM
            iis_algorithm_params ap
            INNER JOIN iis_algorithm_device ad ON ap.id = ad.param_id
        WHERE
            ap.param_fixed = '0'
        <if test="algorithmId != null and algorithmId != ''">
            AND ad.algorithm_id =#{algorithmId}
        </if>
        <if test="componentId != null and componentId != ''">
            AND ad.component_id =#{componentId}
        </if>
    </select>
</mapper>
