<?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.hc.business.mapper.AreaDistrictMapper">

    <resultMap type="areaDistrict" id="AreaDistrictMap">
        <result property="areaId" column="area_id" jdbcType="INTEGER"/>
        <result property="areaName" column="area_name" jdbcType="VARCHAR"/>
        <result property="parentId" column="parent_id" jdbcType="INTEGER"/>
        <result property="areaImage" column="area_image" jdbcType="VARCHAR"/>
        <result property="areaStatus" column="area_status" jdbcType="INTEGER"/>
        <result property="areaIndex" column="area_index" jdbcType="INTEGER"/>
    </resultMap>

    <sql id="Base_Column_List">
        area_id,
           area_name,
           parent_id,
           area_image,
           area_status,
           area_index
    </sql>

    <select id="queryAllByParentId" resultMap="AreaDistrictMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM area_district
        WHERE parent_id = #{parentId,jdbcType=INTEGER}
        ORDER BY area_index
    </select>

</mapper>