<?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.entity.Region">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <id column="ID" jdbcType="VARCHAR" property="id" />
    <result column="PARENT_ID" jdbcType="VARCHAR" property="parentId" />
    <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="LEVEL_TYPE" jdbcType="DECIMAL" property="levelType" />
    <result column="TEL_CODE" jdbcType="VARCHAR" property="telCode" />
    <result column="ZIP_CODE" jdbcType="VARCHAR" property="zipCode" />
    <result column="PIN_YIN" jdbcType="VARCHAR" property="pinYin" />
    <result column="LONGITUDE" jdbcType="FLOAT" property="longitude" />
    <result column="LATITUDE" jdbcType="FLOAT" property="latitude" />
    <result column="IS_ACTIVE" jdbcType="DECIMAL" 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, PARENT_ID, "NAME", SHORT_NAME, MERGER_NAME, LEVEL_TYPE, TEL_CODE, ZIP_CODE, PIN_YIN, 
    LONGITUDE, LATITUDE, IS_ACTIVE
  </sql>
  <select id="selectByExample" parameterType="pwc.taxtech.atms.entity.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="java.lang.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="java.lang.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.entity.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.entity.Region">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into REGION (ID, PARENT_ID, "NAME", 
      SHORT_NAME, MERGER_NAME, LEVEL_TYPE, 
      TEL_CODE, ZIP_CODE, PIN_YIN, 
      LONGITUDE, LATITUDE, IS_ACTIVE
      )
    values (#{id,jdbcType=VARCHAR}, #{parentId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, 
      #{shortName,jdbcType=VARCHAR}, #{mergerName,jdbcType=VARCHAR}, #{levelType,jdbcType=DECIMAL}, 
      #{telCode,jdbcType=VARCHAR}, #{zipCode,jdbcType=VARCHAR}, #{pinYin,jdbcType=VARCHAR}, 
      #{longitude,jdbcType=FLOAT}, #{latitude,jdbcType=FLOAT}, #{isActive,jdbcType=DECIMAL}
      )
  </insert>
  <insert id="insertSelective" parameterType="pwc.taxtech.atms.entity.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">
        PARENT_ID,
      </if>
      <if test="name != null">
        "NAME",
      </if>
      <if test="shortName != null">
        SHORT_NAME,
      </if>
      <if test="mergerName != null">
        MERGER_NAME,
      </if>
      <if test="levelType != null">
        LEVEL_TYPE,
      </if>
      <if test="telCode != null">
        TEL_CODE,
      </if>
      <if test="zipCode != null">
        ZIP_CODE,
      </if>
      <if test="pinYin != null">
        PIN_YIN,
      </if>
      <if test="longitude != null">
        LONGITUDE,
      </if>
      <if test="latitude != null">
        LATITUDE,
      </if>
      <if test="isActive != null">
        IS_ACTIVE,
      </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=DECIMAL},
      </if>
      <if test="telCode != null">
        #{telCode,jdbcType=VARCHAR},
      </if>
      <if test="zipCode != null">
        #{zipCode,jdbcType=VARCHAR},
      </if>
      <if test="pinYin != null">
        #{pinYin,jdbcType=VARCHAR},
      </if>
      <if test="longitude != null">
        #{longitude,jdbcType=FLOAT},
      </if>
      <if test="latitude != null">
        #{latitude,jdbcType=FLOAT},
      </if>
      <if test="isActive != null">
        #{isActive,jdbcType=DECIMAL},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="pwc.taxtech.atms.entity.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">
        PARENT_ID = #{record.parentId,jdbcType=VARCHAR},
      </if>
      <if test="record.name != null">
        "NAME" = #{record.name,jdbcType=VARCHAR},
      </if>
      <if test="record.shortName != null">
        SHORT_NAME = #{record.shortName,jdbcType=VARCHAR},
      </if>
      <if test="record.mergerName != null">
        MERGER_NAME = #{record.mergerName,jdbcType=VARCHAR},
      </if>
      <if test="record.levelType != null">
        LEVEL_TYPE = #{record.levelType,jdbcType=DECIMAL},
      </if>
      <if test="record.telCode != null">
        TEL_CODE = #{record.telCode,jdbcType=VARCHAR},
      </if>
      <if test="record.zipCode != null">
        ZIP_CODE = #{record.zipCode,jdbcType=VARCHAR},
      </if>
      <if test="record.pinYin != null">
        PIN_YIN = #{record.pinYin,jdbcType=VARCHAR},
      </if>
      <if test="record.longitude != null">
        LONGITUDE = #{record.longitude,jdbcType=FLOAT},
      </if>
      <if test="record.latitude != null">
        LATITUDE = #{record.latitude,jdbcType=FLOAT},
      </if>
      <if test="record.isActive != null">
        IS_ACTIVE = #{record.isActive,jdbcType=DECIMAL},
      </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},
      PARENT_ID = #{record.parentId,jdbcType=VARCHAR},
      "NAME" = #{record.name,jdbcType=VARCHAR},
      SHORT_NAME = #{record.shortName,jdbcType=VARCHAR},
      MERGER_NAME = #{record.mergerName,jdbcType=VARCHAR},
      LEVEL_TYPE = #{record.levelType,jdbcType=DECIMAL},
      TEL_CODE = #{record.telCode,jdbcType=VARCHAR},
      ZIP_CODE = #{record.zipCode,jdbcType=VARCHAR},
      PIN_YIN = #{record.pinYin,jdbcType=VARCHAR},
      LONGITUDE = #{record.longitude,jdbcType=FLOAT},
      LATITUDE = #{record.latitude,jdbcType=FLOAT},
      IS_ACTIVE = #{record.isActive,jdbcType=DECIMAL}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="pwc.taxtech.atms.entity.Region">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update REGION
    <set>
      <if test="parentId != null">
        PARENT_ID = #{parentId,jdbcType=VARCHAR},
      </if>
      <if test="name != null">
        "NAME" = #{name,jdbcType=VARCHAR},
      </if>
      <if test="shortName != null">
        SHORT_NAME = #{shortName,jdbcType=VARCHAR},
      </if>
      <if test="mergerName != null">
        MERGER_NAME = #{mergerName,jdbcType=VARCHAR},
      </if>
      <if test="levelType != null">
        LEVEL_TYPE = #{levelType,jdbcType=DECIMAL},
      </if>
      <if test="telCode != null">
        TEL_CODE = #{telCode,jdbcType=VARCHAR},
      </if>
      <if test="zipCode != null">
        ZIP_CODE = #{zipCode,jdbcType=VARCHAR},
      </if>
      <if test="pinYin != null">
        PIN_YIN = #{pinYin,jdbcType=VARCHAR},
      </if>
      <if test="longitude != null">
        LONGITUDE = #{longitude,jdbcType=FLOAT},
      </if>
      <if test="latitude != null">
        LATITUDE = #{latitude,jdbcType=FLOAT},
      </if>
      <if test="isActive != null">
        IS_ACTIVE = #{isActive,jdbcType=DECIMAL},
      </if>
    </set>
    where ID = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="pwc.taxtech.atms.entity.Region">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update REGION
    set PARENT_ID = #{parentId,jdbcType=VARCHAR},
      "NAME" = #{name,jdbcType=VARCHAR},
      SHORT_NAME = #{shortName,jdbcType=VARCHAR},
      MERGER_NAME = #{mergerName,jdbcType=VARCHAR},
      LEVEL_TYPE = #{levelType,jdbcType=DECIMAL},
      TEL_CODE = #{telCode,jdbcType=VARCHAR},
      ZIP_CODE = #{zipCode,jdbcType=VARCHAR},
      PIN_YIN = #{pinYin,jdbcType=VARCHAR},
      LONGITUDE = #{longitude,jdbcType=FLOAT},
      LATITUDE = #{latitude,jdbcType=FLOAT},
      IS_ACTIVE = #{isActive,jdbcType=DECIMAL}
    where ID = #{id,jdbcType=VARCHAR}
  </update>
  <select id="selectByExampleWithRowbounds" parameterType="pwc.taxtech.atms.entity.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>