<?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.tsi.sig.server.mapper.MainMapper">

	<select id="getNodeList" resultType="com.tsi.sig.server.vo.CvibNodeVO">
		SELECT nodeid as nodeid, name as name, FORMAT(latitude, 10) as lat, FORMAT(longitude, 9) as lng, addr1, addr2, addr3, addnode, ipaddr, nodetype, region_id as regionid
          FROM tb_tsc_node
         WHERE useyn  = 'Y'
           AND nodeyn = 'Y'	
	</select>

	<select id="getCvibNodeInfo" parameterType="java.util.HashMap" resultType="com.tsi.sig.server.vo.CvibNodeVO">
		SELECT nodeid, name, FORMAT(latitude, 10) as LAT, FORMAT(longitude, 9) as LNG, addr1, addr2, addr3, addnode, ipaddr, nodetype
		  FROM tb_tsc_node
		 WHERE useyn  = 'Y'
           AND nodeyn = 'Y'
        <if test='nodeId != null'>
		   AND nodeid = #{nodeId}
		</if>
	</select>

	<select id="getCvibMapNodeList" parameterType="java.util.HashMap" resultType="com.tsi.sig.server.vo.CvibNodeVO">
		SELECT nodeid,name, latitude AS lat, longitude AS lng , addr1,addr2,addr3,addnode,ipaddr
		  FROM tb_tsc_node
		WHERE 1=1
		  AND longitude BETWEEN #{minX} AND  #{maxX}
		  AND  latitude BETWEEN #{minY}  AND #{maxY}
		  AND useyn  = 'Y'
          AND nodeyn = 'Y'
	</select>

</mapper>