<?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="INTEGER" 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="REAL" property="longitude" />
    <result column="latitude" jdbcType="REAL" property="latitude" />
    <result column="is_active" jdbcType="BIT" 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=INTEGER}, 
      #{telCode,jdbcType=VARCHAR}, #{zipCode,jdbcType=VARCHAR}, #{pinYin,jdbcType=VARCHAR}, 
      #{longitude,jdbcType=REAL}, #{latitude,jdbcType=REAL}, #{isActive,jdbcType=BIT}
      )
  </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=INTEGER},
      </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=REAL},
      </if>
      <if test="latitude != null">
        #{latitude,jdbcType=REAL},
      </if>
      <if test="isActive != null">
        #{isActive,jdbcType=BIT},
      </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=INTEGER},
      </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=REAL},
      </if>
      <if test="record.latitude != null">
        latitude = #{record.latitude,jdbcType=REAL},
      </if>
      <if test="record.isActive != null">
        is_active = #{record.isActive,jdbcType=BIT},
      </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=INTEGER},
      tel_code = #{record.telCode,jdbcType=VARCHAR},
      zip_code = #{record.zipCode,jdbcType=VARCHAR},
      pin_yin = #{record.pinYin,jdbcType=VARCHAR},
      longitude = #{record.longitude,jdbcType=REAL},
      latitude = #{record.latitude,jdbcType=REAL},
      is_active = #{record.isActive,jdbcType=BIT}
    <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=INTEGER},
      </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=REAL},
      </if>
      <if test="latitude != null">
        latitude = #{latitude,jdbcType=REAL},
      </if>
      <if test="isActive != null">
        is_active = #{isActive,jdbcType=BIT},
      </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=INTEGER},
      tel_code = #{telCode,jdbcType=VARCHAR},
      zip_code = #{zipCode,jdbcType=VARCHAR},
      pin_yin = #{pinYin,jdbcType=VARCHAR},
      longitude = #{longitude,jdbcType=REAL},
      latitude = #{latitude,jdbcType=REAL},
      is_active = #{isActive,jdbcType=BIT}
    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>