<?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="pwc.taxtech.atms.dao.RegionMapper">
  <resultMap id="BaseResultMap" type="pwc.taxtech.atms.entitiy.Region">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <id column="ID" jdbcType="VARCHAR" property="ID" />
    <result column="ParentID" jdbcType="VARCHAR" property="parentID" />
    <result column="Name" jdbcType="VARCHAR" property="name" />
    <result column="ShortName" jdbcType="VARCHAR" property="shortName" />
    <result column="MergerName" jdbcType="VARCHAR" property="mergerName" />
    <result column="LevelType" jdbcType="INTEGER" property="levelType" />
    <result column="TelCode" jdbcType="VARCHAR" property="telCode" />
    <result column="ZipCode" jdbcType="INTEGER" property="zipCode" />
    <result column="PinYin" jdbcType="VARCHAR" property="pinYin" />
    <result column="Longitude" jdbcType="REAL" property="longitude" />
    <result column="Latitude" jdbcType="REAL" property="latitude" />
    <result column="IsActive" jdbcType="SMALLINT" property="isActive" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    ID, ParentID, Name, ShortName, MergerName, LevelType, TelCode, ZipCode, PinYin, Longitude, 
    Latitude, IsActive
  </sql>
  <select id="selectByExample" parameterType="pwc.taxtech.atms.entitiy.RegionExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from Region
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="String" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select 
    <include refid="Base_Column_List" />
    from Region
    where ID = #{ID,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="String">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    delete from Region
    where ID = #{ID,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="pwc.taxtech.atms.entitiy.RegionExample">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    delete from Region
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="pwc.taxtech.atms.entitiy.Region">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into Region (ID, ParentID, Name, 
      ShortName, MergerName, LevelType, 
      TelCode, ZipCode, PinYin, 
      Longitude, Latitude, IsActive
      )
    values (#{ID,jdbcType=VARCHAR}, #{parentID,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, 
      #{shortName,jdbcType=VARCHAR}, #{mergerName,jdbcType=VARCHAR}, #{levelType,jdbcType=INTEGER}, 
      #{telCode,jdbcType=VARCHAR}, #{zipCode,jdbcType=INTEGER}, #{pinYin,jdbcType=VARCHAR}, 
      #{longitude,jdbcType=REAL}, #{latitude,jdbcType=REAL}, #{isActive,jdbcType=SMALLINT}
      )
  </insert>
  <insert id="insertSelective" parameterType="pwc.taxtech.atms.entitiy.Region">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into Region
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="ID != null">
        ID,
      </if>
      <if test="parentID != null">
        ParentID,
      </if>
      <if test="name != null">
        Name,
      </if>
      <if test="shortName != null">
        ShortName,
      </if>
      <if test="mergerName != null">
        MergerName,
      </if>
      <if test="levelType != null">
        LevelType,
      </if>
      <if test="telCode != null">
        TelCode,
      </if>
      <if test="zipCode != null">
        ZipCode,
      </if>
      <if test="pinYin != null">
        PinYin,
      </if>
      <if test="longitude != null">
        Longitude,
      </if>
      <if test="latitude != null">
        Latitude,
      </if>
      <if test="isActive != null">
        IsActive,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="ID != null">
        #{ID,jdbcType=VARCHAR},
      </if>
      <if test="parentID != null">
        #{parentID,jdbcType=VARCHAR},
      </if>
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="shortName != null">
        #{shortName,jdbcType=VARCHAR},
      </if>
      <if test="mergerName != null">
        #{mergerName,jdbcType=VARCHAR},
      </if>
      <if test="levelType != null">
        #{levelType,jdbcType=INTEGER},
      </if>
      <if test="telCode != null">
        #{telCode,jdbcType=VARCHAR},
      </if>
      <if test="zipCode != null">
        #{zipCode,jdbcType=INTEGER},
      </if>
      <if test="pinYin != null">
        #{pinYin,jdbcType=VARCHAR},
      </if>
      <if test="longitude != null">
        #{longitude,jdbcType=REAL},
      </if>
      <if test="latitude != null">
        #{latitude,jdbcType=REAL},
      </if>
      <if test="isActive != null">
        #{isActive,jdbcType=SMALLINT},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="pwc.taxtech.atms.entitiy.RegionExample" resultType="java.lang.Long">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select count(*) from Region
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update Region
    <set>
      <if test="record.ID != null">
        ID = #{record.ID,jdbcType=VARCHAR},
      </if>
      <if test="record.parentID != null">
        ParentID = #{record.parentID,jdbcType=VARCHAR},
      </if>
      <if test="record.name != null">
        Name = #{record.name,jdbcType=VARCHAR},
      </if>
      <if test="record.shortName != null">
        ShortName = #{record.shortName,jdbcType=VARCHAR},
      </if>
      <if test="record.mergerName != null">
        MergerName = #{record.mergerName,jdbcType=VARCHAR},
      </if>
      <if test="record.levelType != null">
        LevelType = #{record.levelType,jdbcType=INTEGER},
      </if>
      <if test="record.telCode != null">
        TelCode = #{record.telCode,jdbcType=VARCHAR},
      </if>
      <if test="record.zipCode != null">
        ZipCode = #{record.zipCode,jdbcType=INTEGER},
      </if>
      <if test="record.pinYin != null">
        PinYin = #{record.pinYin,jdbcType=VARCHAR},
      </if>
      <if test="record.longitude != null">
        Longitude = #{record.longitude,jdbcType=REAL},
      </if>
      <if test="record.latitude != null">
        Latitude = #{record.latitude,jdbcType=REAL},
      </if>
      <if test="record.isActive != null">
        IsActive = #{record.isActive,jdbcType=SMALLINT},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update Region
    set ID = #{record.ID,jdbcType=VARCHAR},
      ParentID = #{record.parentID,jdbcType=VARCHAR},
      Name = #{record.name,jdbcType=VARCHAR},
      ShortName = #{record.shortName,jdbcType=VARCHAR},
      MergerName = #{record.mergerName,jdbcType=VARCHAR},
      LevelType = #{record.levelType,jdbcType=INTEGER},
      TelCode = #{record.telCode,jdbcType=VARCHAR},
      ZipCode = #{record.zipCode,jdbcType=INTEGER},
      PinYin = #{record.pinYin,jdbcType=VARCHAR},
      Longitude = #{record.longitude,jdbcType=REAL},
      Latitude = #{record.latitude,jdbcType=REAL},
      IsActive = #{record.isActive,jdbcType=SMALLINT}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="pwc.taxtech.atms.entitiy.Region">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update Region
    <set>
      <if test="parentID != null">
        ParentID = #{parentID,jdbcType=VARCHAR},
      </if>
      <if test="name != null">
        Name = #{name,jdbcType=VARCHAR},
      </if>
      <if test="shortName != null">
        ShortName = #{shortName,jdbcType=VARCHAR},
      </if>
      <if test="mergerName != null">
        MergerName = #{mergerName,jdbcType=VARCHAR},
      </if>
      <if test="levelType != null">
        LevelType = #{levelType,jdbcType=INTEGER},
      </if>
      <if test="telCode != null">
        TelCode = #{telCode,jdbcType=VARCHAR},
      </if>
      <if test="zipCode != null">
        ZipCode = #{zipCode,jdbcType=INTEGER},
      </if>
      <if test="pinYin != null">
        PinYin = #{pinYin,jdbcType=VARCHAR},
      </if>
      <if test="longitude != null">
        Longitude = #{longitude,jdbcType=REAL},
      </if>
      <if test="latitude != null">
        Latitude = #{latitude,jdbcType=REAL},
      </if>
      <if test="isActive != null">
        IsActive = #{isActive,jdbcType=SMALLINT},
      </if>
    </set>
    where ID = #{ID,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="pwc.taxtech.atms.entitiy.Region">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update Region
    set ParentID = #{parentID,jdbcType=VARCHAR},
      Name = #{name,jdbcType=VARCHAR},
      ShortName = #{shortName,jdbcType=VARCHAR},
      MergerName = #{mergerName,jdbcType=VARCHAR},
      LevelType = #{levelType,jdbcType=INTEGER},
      TelCode = #{telCode,jdbcType=VARCHAR},
      ZipCode = #{zipCode,jdbcType=INTEGER},
      PinYin = #{pinYin,jdbcType=VARCHAR},
      Longitude = #{longitude,jdbcType=REAL},
      Latitude = #{latitude,jdbcType=REAL},
      IsActive = #{isActive,jdbcType=SMALLINT}
    where ID = #{ID,jdbcType=VARCHAR}
  </update>
  <select id="selectByExampleWithRowbounds" parameterType="pwc.taxtech.atms.entitiy.RegionExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from Region
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
</mapper>