<?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.backendsys.modules.system.dao.SysMobileAreaDao">

    <sql id="includeMobileAreaCode">
        id,
        area_name,
        area_name_en,
        COALESCE(area_name_abbr, '') area_name_abbr,
        area_code
    </sql>
    <resultMap id="resultMapMobileAreaCode" type="java.util.LinkedHashMap">
        <id property="id" column="id" jdbcType="BIGINT" />
        <result property="area_name" column="area_name" />
        <result property="area_name_en" column="area_name_en" />
        <result property="area_name_abbr" column="area_name_abbr" />
        <result property="area_code" column="area_code" javaType="java.lang.Integer" />
    </resultMap>
    <select id="selectMobileAreaList" resultMap="resultMapMobileAreaCode">
        SELECT <include refid="includeMobileAreaCode" />
        FROM sys_mobile_area_code
        <where>
            <if test="area_name != null and area_name != ''">
                AND area_name = #{area_name}
            </if>
            <if test="area_name_en != null and area_name_en != ''">
                AND area_name_en = #{area_name_en}
            </if>
            <if test="area_name_abbr != null and area_name_abbr != ''">
                AND area_name_abbr = #{area_name_abbr}
            </if>
            <if test="area_code != null and area_code != ''">
                AND area_code = #{area_code}
            </if>
        </where>
    </select>

</mapper>