<?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.njcn.gather.device.mapper.PqStandardDevMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="standardDevResultMap" type="com.njcn.gather.device.pojo.vo.PreDetection">
        <id column="Id" property="devId"/>
        <id column="Name" property="devName"/>
        <id column="IP" property="devIP"/>
        <result column="Port" property="port"/>
        <result column="Dev_Type" property="devType"/>
        <result column="Series" property="devCode"/>
        <result column="Dev_Key" property="devKey"/>
        <result column="icdType" property="icdType"/>
        <result column="Dev_Chns" property="devChns"/>
        <result column="Dev_Volt" property="devVolt"/>
        <result column="Dev_Curr" property="devCurr"/>
        <result column="Angle" property="angle"/>
        <result column="Use_Phase_Index" property="usePhaseIndex"/>
        <result column="Wave_Cmd" property="waveCmd"/>
    </resultMap>

    <select id="listStandardDevPreDetection" resultMap="standardDevResultMap">
        select
        standard_dev.Id,
        standard_dev.Name,
        standard_dev.IP,
        standard_dev.Port,
        dev_type.name as Dev_Type,
        standard_dev.Series,
        standard_dev.Dev_Key,
        icd_path.Name as icdType,
        dev_type.Dev_Chns,
        dev_type.Dev_Volt,
        dev_type.Dev_Curr,
        icd_path.Angle,
        icd_path.Use_Phase_Index,
        dev_type.Wave_Cmd
        from pq_standard_dev standard_dev
        inner join pq_dev_type dev_type on standard_dev.Dev_Type = dev_type.id
        inner join pq_icd_path icd_path on dev_type.icd = icd_path.id
        where standard_dev.Id in
        <foreach collection="ids" item="id" open="(" separator="," close=")">
            #{id}
        </foreach>
    </select>
</mapper>

