<?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.device.pq.mapper.PqsTflgassMapper">

    <select id="selectFlgass" resultType="com.njcn.device.pq.pojo.po.PqsTflgass">
        select
        *
        from pqs_tflgass pt
        INNER JOIN pqs_transformer pf on pf.Tf_Index=pt.Tf_Index
        <where>
            pf.Sub_Index = #{id}
            <if test="ids.size()!=0">
                and ( Logic_Before IN
                <foreach item="item" collection="ids" separator="," open="(" close=")">
                    #{item}
                </foreach>
                or Logic_Next IN
                <foreach item="item" collection="ids" separator="," open="(" close=")">
                    #{item}
                </foreach>
                )
            </if>
        </where>

    </select>

    <select id="getLogic" resultType="EntityLogicDTO">
        select a.tp_index tPIndex,
        b.logic_before nodeBefore,
        b.logic_next nodeNext,
        d.triphase type
        from pqs_tflgployass a
        ,pqs_tflgass b,
        pqs_transformer c,
        pqs_dicdata d
        where a.tf_index = b.tf_index
        and b.tf_index = c.tf_index
        and c.wiring = d.dic_index
    </select>
</mapper>
