<?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.boman.web.core.mapper.SysRegionMapper">

    <resultMap type="SysRegion" id="SysRegionResult">
        <result property="areaId"    column="area_id"    />
        <result property="name"    column="name"    />
        <result property="pid"    column="pid"    />
        <result property="sort"    column="sort"    />
    </resultMap>
    <insert id="insertSysRegion"  useGeneratedKeys="true"
            keyProperty="id">
        INSERT INTO  `qianshan_data_bureau`.`china_area`(`area_id`, `name`, `pid`, `sort`) VALUES (#{id}, #{name}, #{pid}, #{sort}) on duplicate key update sort = #{sort}
    </insert>

    <select id="selectSysRegionByName" parameterType="string" resultMap="SysRegionResult">
        select area_id,name,pid,sort from china_area where name = #{name}
    </select>

    <select id="selectSysRegionByNameLike" parameterType="string" resultMap="SysRegionResult">
        select area_id,name,pid from china_area where name like concat(#{name}, '%') and pid like '340882%'
    </select>

</mapper>