<?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.sckw.system.dao.SysAreaDao">
  <resultMap id="BaseResultMap" type="com.sckw.system.model.SysArea">
    <id column="code" jdbcType="INTEGER" property="code" />
    <result column="pcode" jdbcType="INTEGER" property="pcode" />
    <result column="province_code" jdbcType="INTEGER" property="provinceCode" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="short_name" jdbcType="VARCHAR" property="shortName" />
    <result column="merger_name" jdbcType="VARCHAR" property="mergerName" />
    <result column="province" jdbcType="VARCHAR" property="province" />
    <result column="city" jdbcType="VARCHAR" property="city" />
    <result column="hot" jdbcType="INTEGER" property="hot" />
    <result column="level" jdbcType="INTEGER" property="level" />
    <result column="lng" jdbcType="VARCHAR" property="lng" />
    <result column="lat" jdbcType="VARCHAR" property="lat" />
    <result column="letter" jdbcType="VARCHAR" property="letter" />
    <result column="pinyin" jdbcType="VARCHAR" property="pinyin" />
    <result column="firstchar" jdbcType="VARCHAR" property="firstchar" />
    <result column="status" jdbcType="INTEGER" property="status" />
    <result column="create_by" jdbcType="VARCHAR" property="createBy" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="update_by" jdbcType="VARCHAR" property="updateBy" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
    <result column="del_flag" jdbcType="INTEGER" property="delFlag" />
  </resultMap>

  <sql id="Base_Column_List">
    code, pcode, province_code, name, short_name, merger_name, province, city, hot, level,
    lng, lat, letter, pinyin, firstchar, status, create_by, create_time, update_by, update_time,
    del_flag
  </sql>

  <select id="findList" resultType="java.util.Map" parameterType="java.util.Map" >
    SELECT
    code , pcode , name, code, hot, level, lng, lat, letter, merger_name mergerName,
    short_name shortName
    from sys_area
    where del_flag = 0
    <if test="code != null and code != ''" >
      and code = #{code, jdbcType=VARCHAR}
    </if>
    <if test="name != null and name != ''" >
      and name = #{name, jdbcType=VARCHAR}
    </if>
    <if test="level != null and level != ''" >
      and level = #{level, jdbcType=VARCHAR}
    </if>
    <if test="pcode != null and pcode != ''" >
      and pcode = #{pcode, jdbcType=VARCHAR}
    </if>
  </select>

  <select id="selectById" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from sys_area
    where code = #{code,jdbcType=INTEGER}
  </select>
</mapper>