<?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.tofly.xrtymis.mapper.TfYwpnPipenodeMapper">

      <resultMap id="tfYwpnPipenodeMap" type="com.tofly.xrtymis.entity.TfYwpnPipenode">
            <id property="id" column="ID"/>
            <result property="sid" column="SID"/>
            <result property="x" column="X"/>
            <result property="y" column="Y"/>
            <result property="groundz" column="GROUNDZ"/>
            <result property="aspecttype" column="ASPECTTYPE"/>
            <result property="fixturetype" column="FIXTURETYPE"/>
            <result property="welldem" column="WELLDEM"/>
            <result property="wellbottom" column="WELLBOTTOM"/>
            <result property="nodecode" column="NODECODE"/>
            <result property="distno" column="DISTNO"/>
            <result property="surveyunit" column="SURVEYUNIT"/>
            <result property="ownerunit" column="OWNERUNIT"/>
            <result property="maintainedunit" column="MAINTAINEDUNIT"/>
            <result property="buryyear" column="BURYYEAR"/>
            <result property="precisionclass" column="PRECISIONCLASS"/>
            <result property="wellbore" column="WELLBORE"/>
            <result property="rotation" column="ROTATION"/>
            <result property="surveydate" column="SURVEYDATE"/>
            <result property="indate" column="INDATE"/>
            <result property="laneway" column="LANEWAY"/>
            <result property="address" column="ADDRESS"/>
            <result property="manholetype" column="MANHOLETYPE"/>
            <result property="manholematerial" column="MANHOLEMATERIAL"/>
            <result property="manholemiameter" column="MANHOLEMIAMETER"/>
            <result property="manholelen" column="MANHOLELEN"/>
            <result property="manholewidth" column="MANHOLEWIDTH"/>
            <result property="welltype" column="WELLTYPE"/>
            <result property="wellmateial" column="WELLMATEIAL"/>
            <result property="wellneckdepth" column="WELLNECKDEPTH"/>
            <result property="wellmiameter" column="WELLMIAMETER"/>
            <result property="welllen" column="WELLLEN"/>
            <result property="wellwidth" column="WELLWIDTH"/>
            <result property="wellheight" column="WELLHEIGHT"/>
            <result property="wellcode" column="WELLCODE"/>
            <result property="groundlen" column="GROUNDLEN"/>
            <result property="groundwidth" column="GROUNDWIDTH"/>
            <result property="groundheight" column="GROUNDHEIGHT"/>
            <result property="mapno" column="MAPNO"/>
            <result property="areano" column="AREANO"/>
            <result property="district" column="DISTRICT"/>
            <result property="createUser" column="CREATE_USER"/>
            <result property="createTime" column="CREATE_TIME"/>
            <result property="remark" column="REMARK"/>
            <result property="objCode" column="OBJ_CODE"/>
            <result property="fileIds" column="FILE_IDS"/>
            <association property="createUserName" column="CREATE_USER" select="com.tofly.baseapi.mapper.ToflyCodeCommonMapper.getUserName" />
            <collection property="filePath" column="FILE_IDS" select="com.tofly.xrtymis.mapper.FileMapper.getFileByIds"/>
      </resultMap>

      <select id="selectPipenode" resultMap="tfYwpnPipenodeMap">
            SELECT distinct * FROM (
                  SELECT n.* FROM TF_YWPN_PIPENODE_W n left join TF_YWPN_PIPE_W p on(n.sid = p.STARTSID)
                  WHERE p.id in
                  <foreach collection="list" item="itcd" open="(" separator="," close=")">
                        #{itcd}
                  </foreach>
                  union all
                  SELECT n.* FROM TF_YWPN_PIPENODE_W n left join TF_YWPN_PIPE_W p on(n.sid = p.ENDSID)
                  WHERE p.id in
                  <foreach collection="list" item="itcd" open="(" separator="," close=")">
                        #{itcd}
                  </foreach>
                  ) t
      </select>

</mapper>
