<?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.xxfc.platform.universal.mapper.SysRegionMapper">

    <select id="getAllByPage" parameterType="java.util.Map"
            resultType="com.xxfc.platform.universal.entity.SysRegion">
        select `id`, parent_id, `name`, `type`, agency_id from sys_region limit #{pageStart},${pageSize}
    </select>

    <select id="getByIdList" parameterType="java.util.List"
            resultType="com.xxfc.platform.universal.entity.SysRegion">
        select `id`, parent_id, `name`, `type`, agency_id from sys_region where id in
        <foreach collection="list" index="i" item="item" open="(" close=")" separator=",">
            #{item}
        </foreach>
    </select>

    <select id="getNumber" resultType="Integer">
        select `id` from sys_region  where  name  like  CONCAT('%',#{name},'%') limit 1
    </select>
    <select id="getNumberV2" resultType="Integer">
        select `id` from sys_region  where  name  like  CONCAT('%',#{name},'%') and type=#{type} limit 1
    </select>

    <select id="findByCityName" resultType="com.xxfc.platform.universal.dto.RegionDTO">
        select `id`,`parent_id` as `parentId` from  `sys_region` where `type`=2  and `name` like concat('%',#{city} ,'%')
    </select>
</mapper>