<?xml version="1.0" encoding="UTF-8"?>
	<!DOCTYPE mapper
	  PUBLIC "-//mybatis.org//DTD Mapper 3.1//EN"
	  "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.mapper.configuration.SubStationMapper">


	<select id="selectMaxIndex" parameterType="String" resultType="Long" >
		select max(sub_index) from PQ_SUBSTATION
	</select>

	<select id="testName" resultType="SubStation" >
		select * from PQ_SUBSTATION where name = #{name} and sub_index != #{subIndex}
	</select>

	<select id="getSubDetail" resultType="SubInfo">
		SELECT
		a.NAME,
		b.map_index AS mapIndex,
		b.latitude,
		b.longitude,
		a.scale
		FROM
		pq_substation a
		LEFT JOIN pqs_map b ON b.sub_index = a.sub_index
		AND b.state = 1
		WHERE
		a.sub_index = #{subIndex}
	</select>

</mapper>
