<?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.reptileclient.jlifeapp.dao.region.RegionStoreMapper">
    <select id="selectByCityId" parameterType="java.lang.Long" resultType="java.lang.Long">
        select region_store.id
        from region_store
        where city_id = #{cityId,jdbcType=BIGINT}
          and state = 0
          and if(city_id = 5, store_name = '江苏苏州', store_name = (
                select left(city_name, 2)
                from sys_city
                where sys_city.id = #{cityId,jdbcType=BIGINT}
                ))
    </select>

    <select id="selectCityIdByCityName" resultType="java.lang.Long">
        select id
        from sys_city
        where city_name regexp #{province,jdbcType=VARCHAR}
        limit 1
    </select>
</mapper>
