<?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.harmonic.mapper.TerminalDataMapper">

    <select id="getTerminalData" resultType="TerminalVO">
        SELECT
        A.Id,
        A.Pid,
        A.Pids,
        A.Name,
        A.Level,
        B.`Run_Flag` flag
        FROM
        pq_line A,
        pq_device B
        WHERE
        A.Id IN
        <foreach item="item" collection="list" separator="," open="(" close=")">#{item}</foreach>
        AND A.Id = B.Id
        AND B.Dev_Data_Type IN (1,2)
    </select>

    <select id="getLineInfoByList" resultType="TerminalVO">
        SELECT
        Id,
        Pid,
        Pids,
        `Name` name,
        `Level` level
        FROM
        pq_line
        WHERE
        Id IN
        <foreach item="item" collection="list" separator="," open="(" close=")">
            #{item}
        </foreach>
    </select>



    <!--        SELECT-->
    <!--            A.Id,-->
    <!--            A.`Run_Flag` flag-->
    <!--        FROM-->
    <!--            pq_device A,-->
    <!--            pq_voltage B,-->
    <!--            pq_line C,-->
    <!--            pq_line_detail D,-->
    <!--            pq_line C1,-->
    <!--            pq_line C2-->
    <!--        WHERE-->
    <!--        A.Id IN-->
    <!--        <foreach item="item" collection="list" separator="," open="(" close=")">-->
    <!--            #{item}-->
    <!--        </foreach>-->
    <!--        AND B.Id = C.Id-->
    <!--        AND C.Pid = A.Id-->
    <!--        <if test="deviceList != null and deviceList.size()>0">-->
    <!--            AND A.Manufacturer IN-->
    <!--            <foreach item="item2" collection="deviceList" separator="," open="(" close=")">-->
    <!--                #{item2}-->
    <!--            </foreach>-->
    <!--        </if>-->
    <!--        <if test="interferenceList != null and interferenceList.size()>0">-->
    <!--            AND D.Load_Type IN-->
    <!--            <foreach item="item3" collection="interferenceList" separator="," open="(" close=")">-->
    <!--                #{item3}-->
    <!--            </foreach>-->
    <!--        </if>-->
    <!--        AND D.Id = C1.Id-->
    <!--        AND C1.Pid = C2.Id-->
    <!--        AND C2.Pid = A.Id-->
    <!--        GROUP by A.Id-->
</mapper>