<?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="cn.pluss.platform.mapper.RegionCodeLsMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="cn.pluss.platform.entity.RegionCodeLs">
        <id column="id" property="id"/>
        <result column="province" property="province"/>
        <result column="provinceCode" property="provinceCode"/>
        <result column="city" property="city"/>
        <result column="cityCode" property="cityCode"/>
        <result column="area" property="area"/>
        <result column="areaCode" property="areaCode"/>
    </resultMap>

    <select id="selectRegionCode" resultType="cn.pluss.platform.entity.RegionCodeLs">
        SELECT ls.id, ls.province, ls.provinceCode, ls.city, ls.cityCode, ls.area, ls.areaCode
        FROM tb_pluss_region_code_ls ls
        WHERE ls.province LIKE CONCAT(#{province}, "%")
          AND ls.city = #{city}
          AND ls.area = #{area}
    </select>


    <select id="selectProvince" resultType="java.lang.String">
        SELECT province FROM tb_pluss_region_code_ls
    </select>


    <select id="selectCity" resultType="java.lang.String">
        SELECT city FROM tb_pluss_region_code_ls
        WHERE province LIKE CONCAT(#{provice}, '%')
    </select>


    <select id="selectArea" resultType="java.lang.String">
        SELECT area FROM tb_pluss_region_code_ls
        WHERE province LIKE CONCAT(#{provice}, '%')
        AND city LIKE CONCAT(#{city}, '%')
    </select>
</mapper>
