<?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.kiisoo.ic.region.mapper.RegionDOMapper">

    <select id="selectRegionsByShopId" resultType="com.kiisoo.ic.region.entity.RegionDO">
        SELECT t1.id,t1.`name`,t1.`code` from poi_region t1, poi_store_region t2
        where t1.id = t2.region_id and
        <choose>
            <when test="shopIds != null and shopIds.size > 0">
                 t2.store_id in
                <foreach collection="shopIds"  index="index" item="item" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </when>
            <otherwise>
                1 = 0
            </otherwise>
        </choose>
    </select>
</mapper>
