<?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.goafanti.common.dao.BranchOfficeInfoMapper">
  <resultMap id="BaseResultMap" type="com.goafanti.common.model.BranchOfficeInfo">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Aug 22 09:20:20 CST 2017.
    -->
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="website" jdbcType="VARCHAR" property="website" />
    <result column="contact_number" jdbcType="VARCHAR" property="contactNumber" />
    <result column="contact_address" jdbcType="VARCHAR" property="contactAddress" />
    <result column="logo_img" jdbcType="VARCHAR" property="logoImg" />
    <result column="qr_img" jdbcType="VARCHAR" property="qrImg" />
    <result column="province_id" jdbcType="INTEGER" property="provinceId" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Aug 22 09:20:20 CST 2017.
    -->
    <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.
      This element was generated on Tue Aug 22 09:20:20 CST 2017.
    -->
    <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.
      This element was generated on Tue Aug 22 09:20:20 CST 2017.
    -->
    id, name, website, contact_number, contact_address, logo_img, qr_img, province_id
  </sql>
  <select id="selectByExample" parameterType="com.goafanti.common.model.BranchOfficeInfoExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Aug 22 09:20:20 CST 2017.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from branch_office_info
    <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.Integer" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Aug 22 09:20:20 CST 2017.
    -->
    select 
    <include refid="Base_Column_List" />
    from branch_office_info
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Aug 22 09:20:20 CST 2017.
    -->
    delete from branch_office_info
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <delete id="deleteByExample" parameterType="com.goafanti.common.model.BranchOfficeInfoExample">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Aug 22 09:20:20 CST 2017.
    -->
    delete from branch_office_info
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.goafanti.common.model.BranchOfficeInfo">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Aug 22 09:20:20 CST 2017.
    -->
    insert into branch_office_info (id, name, website, 
      contact_number, contact_address, logo_img, 
      qr_img, province_id)
    values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{website,jdbcType=VARCHAR}, 
      #{contactNumber,jdbcType=VARCHAR}, #{contactAddress,jdbcType=VARCHAR}, #{logoImg,jdbcType=VARCHAR}, 
      #{qrImg,jdbcType=VARCHAR}, #{provinceId,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="com.goafanti.common.model.BranchOfficeInfo">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Aug 22 09:20:20 CST 2017.
    -->
    insert into branch_office_info
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="name != null">
        name,
      </if>
      <if test="website != null">
        website,
      </if>
      <if test="contactNumber != null">
        contact_number,
      </if>
      <if test="contactAddress != null">
        contact_address,
      </if>
      <if test="logoImg != null">
        logo_img,
      </if>
      <if test="qrImg != null">
        qr_img,
      </if>
      <if test="provinceId != null">
        province_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="website != null">
        #{website,jdbcType=VARCHAR},
      </if>
      <if test="contactNumber != null">
        #{contactNumber,jdbcType=VARCHAR},
      </if>
      <if test="contactAddress != null">
        #{contactAddress,jdbcType=VARCHAR},
      </if>
      <if test="logoImg != null">
        #{logoImg,jdbcType=VARCHAR},
      </if>
      <if test="qrImg != null">
        #{qrImg,jdbcType=VARCHAR},
      </if>
      <if test="provinceId != null">
        #{provinceId,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.goafanti.common.model.BranchOfficeInfoExample" resultType="java.lang.Long">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Aug 22 09:20:20 CST 2017.
    -->
    select count(*) from branch_office_info
    <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.
      This element was generated on Tue Aug 22 09:20:20 CST 2017.
    -->
    update branch_office_info
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=INTEGER},
      </if>
      <if test="record.name != null">
        name = #{record.name,jdbcType=VARCHAR},
      </if>
      <if test="record.website != null">
        website = #{record.website,jdbcType=VARCHAR},
      </if>
      <if test="record.contactNumber != null">
        contact_number = #{record.contactNumber,jdbcType=VARCHAR},
      </if>
      <if test="record.contactAddress != null">
        contact_address = #{record.contactAddress,jdbcType=VARCHAR},
      </if>
      <if test="record.logoImg != null">
        logo_img = #{record.logoImg,jdbcType=VARCHAR},
      </if>
      <if test="record.qrImg != null">
        qr_img = #{record.qrImg,jdbcType=VARCHAR},
      </if>
      <if test="record.provinceId != null">
        province_id = #{record.provinceId,jdbcType=INTEGER},
      </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.
      This element was generated on Tue Aug 22 09:20:20 CST 2017.
    -->
    update branch_office_info
    set id = #{record.id,jdbcType=INTEGER},
      name = #{record.name,jdbcType=VARCHAR},
      website = #{record.website,jdbcType=VARCHAR},
      contact_number = #{record.contactNumber,jdbcType=VARCHAR},
      contact_address = #{record.contactAddress,jdbcType=VARCHAR},
      logo_img = #{record.logoImg,jdbcType=VARCHAR},
      qr_img = #{record.qrImg,jdbcType=VARCHAR},
      province_id = #{record.provinceId,jdbcType=INTEGER}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.BranchOfficeInfo">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Aug 22 09:20:20 CST 2017.
    -->
    update branch_office_info
    <set>
      <if test="name != null">
        name = #{name,jdbcType=VARCHAR},
      </if>
      <if test="website != null">
        website = #{website,jdbcType=VARCHAR},
      </if>
      <if test="contactNumber != null">
        contact_number = #{contactNumber,jdbcType=VARCHAR},
      </if>
      <if test="contactAddress != null">
        contact_address = #{contactAddress,jdbcType=VARCHAR},
      </if>
      <if test="logoImg != null">
        logo_img = #{logoImg,jdbcType=VARCHAR},
      </if>
      <if test="qrImg != null">
        qr_img = #{qrImg,jdbcType=VARCHAR},
      </if>
      <if test="provinceId != null">
        province_id = #{provinceId,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.BranchOfficeInfo">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Aug 22 09:20:20 CST 2017.
    -->
    update branch_office_info
    set name = #{name,jdbcType=VARCHAR},
      website = #{website,jdbcType=VARCHAR},
      contact_number = #{contactNumber,jdbcType=VARCHAR},
      contact_address = #{contactAddress,jdbcType=VARCHAR},
      logo_img = #{logoImg,jdbcType=VARCHAR},
      qr_img = #{qrImg,jdbcType=VARCHAR},
      province_id = #{provinceId,jdbcType=INTEGER}
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>