<?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.zxwl.drug.data.Province">
<resultMap type="Province" id="provinceResultMap">
<id property="id" column="ID"/>
<result property="code" column="CODE"/>
<result property="name" column="NAME"/>
<collection property="citys" column="CODE" select="searchCity"></collection>
</resultMap>
<resultMap type="City" id="cityResultMap">
<id property="id" column="ID"/>
<result property="provinceId" column="PROVINCEID"/>
<result property="code" column="CODE"/>
<result property="name" column="NAME"/>
<collection property="areas" column="CODE" select="searchArea"></collection>
</resultMap>
<resultMap type="Area" id="areaResultMap">
<id property="id" column="ID"/>
<result property="cityId" column="CITYID"/>
<result property="code" column="CODE"/>
<result property="name" column="NAME"/>
</resultMap>
<resultMap type="CityPoint" id="cityPointResultMap">
<id property="id" column="ID"/>
<result property="cityId" column="CITYID"/>
<result property="code" column="CODE"/>
<result property="name" column="NAME"/>
</resultMap>
<select id="searchProvince" resultMap="provinceResultMap">
<![CDATA[
SELECT ID,CODE,NAME FROM PROVINCE
]]>
</select>
<select id="searchCity" resultMap="cityResultMap" parameterType="java.lang.Integer">
<![CDATA[
SELECT ID,PROVINCEID,CODE,NAME FROM CITY WHERE PROVINCEID = #{CODE}
]]>
</select>
<select id="searchArea" resultMap="areaResultMap" parameterType="java.lang.Integer">
<![CDATA[
SELECT ID,CITYID,CODE,NAME FROM AREA WHERE CITYID = #{CODE}
]]>
</select>
<select id="searchCityPoint" resultMap="cityPointResultMap">
<![CDATA[
SELECT CITYNAME,LAT,LNG FROM CITYPOINT
]]>
</select>
</mapper>
转载于:https://blog.51cto.com/1306733/1765540