<?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="locationSqlMapper">
	<sql id="base_column">
		id,
		location,
		location_t as locationT,
		location1,
		location2,
		location3,
		country,
		cn,
		cn_city as cnCity,
		cn_district as cnDistrict,
		py,
		en_city as enCity,
		en_district as enDistrict,
		en
	</sql>
	
	<select id="findAll" resultType="com.cloudcross.ssp.model.Location">
		select
		<include refid="base_column" />
		from t_location where country = #{country}  
	</select>
	
	<select id="findByProvince" resultType="com.cloudcross.ssp.model.Location">
		select
		<include refid="base_column" />
		from t_location where location1 = #{location1}
		and location2 = #{location2}
	</select>
	
	
	<select id="findByLocationT" parameterType="String" resultType="com.cloudcross.ssp.model.Location">
		select <include refid="base_column" /> 
		from t_location
		where location_t = #{locationT}
	</select>
	<select id="findByCnAndCnCity" parameterType="map" resultType="com.cloudcross.ssp.model.Location">
		select <include refid="base_column" />
		from t_location where cn = #{cn} and cn_city =#{cnCity} 
	</select>
	
	<select id="findCityByProvince" parameterType="String" resultType="String">
		 select cn_city from t_location where cn=#{province}
	</select>
	
	<select id="findAllProvince" resultType="String">
		select cn from t_location where location1='CN' group by cn order by location2 asc
	</select>
</mapper>