<?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.PersonnelMidMapper">
  <resultMap id="BaseResultMap" type="com.goafanti.common.model.PersonnelMid">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu May 07 14:15:57 CST 2020.
    -->
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="welfare_annex_url" jdbcType="VARCHAR" property="welfareAnnexUrl" />
    <result column="welfare_annex_name" jdbcType="VARCHAR" property="welfareAnnexName" />
    <result column="insurance_start_time" jdbcType="TIMESTAMP" property="insuranceStartTime" />
    <result column="insurance_end_time" jdbcType="TIMESTAMP" property="insuranceEndTime" />
    <result column="fund_start_time" jdbcType="TIMESTAMP" property="fundStartTime" />
    <result column="fund_end_time" jdbcType="TIMESTAMP" property="fundEndTime" />
    <result column="employer_start_time" jdbcType="TIMESTAMP" property="employerStartTime" />
    <result column="employer_end_time" jdbcType="TIMESTAMP" property="employerEndTime" />
    <result column="contract_start_time" jdbcType="TIMESTAMP" property="contractStartTime" />
    <result column="contract_end_time" jdbcType="TIMESTAMP" property="contractEndTime" />
    <result column="promotion_time" jdbcType="TIMESTAMP" property="promotionTime" />
    <result column="promotion_remarks" jdbcType="VARCHAR" property="promotionRemarks" />
    <result column="emergency_contact" jdbcType="VARCHAR" property="emergencyContact" />
    <result column="emergency_mobile" jdbcType="VARCHAR" property="emergencyMobile" />
    <result column="quit_time" jdbcType="TIMESTAMP" property="quitTime" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="welfare_remarks" jdbcType="VARCHAR" property="welfareRemarks" />
  </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 Thu May 07 14:15:57 CST 2020.
    -->
    <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 Thu May 07 14:15:57 CST 2020.
    -->
    <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 Thu May 07 14:15:57 CST 2020.
    -->
    id, welfare_annex_url, welfare_annex_name, insurance_start_time, insurance_end_time, 
    fund_start_time, fund_end_time, employer_start_time, employer_end_time, contract_start_time, 
    contract_end_time, promotion_time, promotion_remarks, emergency_contact, emergency_mobile, 
    quit_time, create_time, welfare_remarks
  </sql>
  <select id="selectByExample" parameterType="com.goafanti.common.model.PersonnelMidExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu May 07 14:15:57 CST 2020.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from personnel_mid
    <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 Thu May 07 14:15:57 CST 2020.
    -->
    select 
    <include refid="Base_Column_List" />
    from personnel_mid
    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 Thu May 07 14:15:57 CST 2020.
    -->
    delete from personnel_mid
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <delete id="deleteByExample" parameterType="com.goafanti.common.model.PersonnelMidExample">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu May 07 14:15:57 CST 2020.
    -->
    delete from personnel_mid
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.goafanti.common.model.PersonnelMid">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu May 07 14:15:57 CST 2020.
    -->
    insert into personnel_mid (id, welfare_annex_url, welfare_annex_name, 
      insurance_start_time, insurance_end_time, 
      fund_start_time, fund_end_time, employer_start_time, 
      employer_end_time, contract_start_time, 
      contract_end_time, promotion_time, promotion_remarks, 
      emergency_contact, emergency_mobile, quit_time, 
      create_time, welfare_remarks)
    values (#{id,jdbcType=INTEGER}, #{welfareAnnexUrl,jdbcType=VARCHAR}, #{welfareAnnexName,jdbcType=VARCHAR}, 
      #{insuranceStartTime,jdbcType=TIMESTAMP}, #{insuranceEndTime,jdbcType=TIMESTAMP}, 
      #{fundStartTime,jdbcType=TIMESTAMP}, #{fundEndTime,jdbcType=TIMESTAMP}, #{employerStartTime,jdbcType=TIMESTAMP}, 
      #{employerEndTime,jdbcType=TIMESTAMP}, #{contractStartTime,jdbcType=TIMESTAMP}, 
      #{contractEndTime,jdbcType=TIMESTAMP}, #{promotionTime,jdbcType=TIMESTAMP}, #{promotionRemarks,jdbcType=VARCHAR}, 
      #{emergencyContact,jdbcType=VARCHAR}, #{emergencyMobile,jdbcType=VARCHAR}, #{quitTime,jdbcType=TIMESTAMP}, 
      #{createTime,jdbcType=TIMESTAMP}, #{welfareRemarks,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.goafanti.common.model.PersonnelMid">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu May 07 14:15:57 CST 2020.
    -->
    insert into personnel_mid
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="welfareAnnexUrl != null">
        welfare_annex_url,
      </if>
      <if test="welfareAnnexName != null">
        welfare_annex_name,
      </if>
      <if test="insuranceStartTime != null">
        insurance_start_time,
      </if>
      <if test="insuranceEndTime != null">
        insurance_end_time,
      </if>
      <if test="fundStartTime != null">
        fund_start_time,
      </if>
      <if test="fundEndTime != null">
        fund_end_time,
      </if>
      <if test="employerStartTime != null">
        employer_start_time,
      </if>
      <if test="employerEndTime != null">
        employer_end_time,
      </if>
      <if test="contractStartTime != null">
        contract_start_time,
      </if>
      <if test="contractEndTime != null">
        contract_end_time,
      </if>
      <if test="promotionTime != null">
        promotion_time,
      </if>
      <if test="promotionRemarks != null">
        promotion_remarks,
      </if>
      <if test="emergencyContact != null">
        emergency_contact,
      </if>
      <if test="emergencyMobile != null">
        emergency_mobile,
      </if>
      <if test="quitTime != null">
        quit_time,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="welfareRemarks != null">
        welfare_remarks,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="welfareAnnexUrl != null">
        #{welfareAnnexUrl,jdbcType=VARCHAR},
      </if>
      <if test="welfareAnnexName != null">
        #{welfareAnnexName,jdbcType=VARCHAR},
      </if>
      <if test="insuranceStartTime != null">
        #{insuranceStartTime,jdbcType=TIMESTAMP},
      </if>
      <if test="insuranceEndTime != null">
        #{insuranceEndTime,jdbcType=TIMESTAMP},
      </if>
      <if test="fundStartTime != null">
        #{fundStartTime,jdbcType=TIMESTAMP},
      </if>
      <if test="fundEndTime != null">
        #{fundEndTime,jdbcType=TIMESTAMP},
      </if>
      <if test="employerStartTime != null">
        #{employerStartTime,jdbcType=TIMESTAMP},
      </if>
      <if test="employerEndTime != null">
        #{employerEndTime,jdbcType=TIMESTAMP},
      </if>
      <if test="contractStartTime != null">
        #{contractStartTime,jdbcType=TIMESTAMP},
      </if>
      <if test="contractEndTime != null">
        #{contractEndTime,jdbcType=TIMESTAMP},
      </if>
      <if test="promotionTime != null">
        #{promotionTime,jdbcType=TIMESTAMP},
      </if>
      <if test="promotionRemarks != null">
        #{promotionRemarks,jdbcType=VARCHAR},
      </if>
      <if test="emergencyContact != null">
        #{emergencyContact,jdbcType=VARCHAR},
      </if>
      <if test="emergencyMobile != null">
        #{emergencyMobile,jdbcType=VARCHAR},
      </if>
      <if test="quitTime != null">
        #{quitTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="welfareRemarks != null">
        #{welfareRemarks,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.goafanti.common.model.PersonnelMidExample" resultType="java.lang.Long">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu May 07 14:15:57 CST 2020.
    -->
    select count(*) from personnel_mid
    <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 Thu May 07 14:15:57 CST 2020.
    -->
    update personnel_mid
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=INTEGER},
      </if>
      <if test="record.welfareAnnexUrl != null">
        welfare_annex_url = #{record.welfareAnnexUrl,jdbcType=VARCHAR},
      </if>
      <if test="record.welfareAnnexName != null">
        welfare_annex_name = #{record.welfareAnnexName,jdbcType=VARCHAR},
      </if>
      <if test="record.insuranceStartTime != null">
        insurance_start_time = #{record.insuranceStartTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.insuranceEndTime != null">
        insurance_end_time = #{record.insuranceEndTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.fundStartTime != null">
        fund_start_time = #{record.fundStartTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.fundEndTime != null">
        fund_end_time = #{record.fundEndTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.employerStartTime != null">
        employer_start_time = #{record.employerStartTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.employerEndTime != null">
        employer_end_time = #{record.employerEndTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.contractStartTime != null">
        contract_start_time = #{record.contractStartTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.contractEndTime != null">
        contract_end_time = #{record.contractEndTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.promotionTime != null">
        promotion_time = #{record.promotionTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.promotionRemarks != null">
        promotion_remarks = #{record.promotionRemarks,jdbcType=VARCHAR},
      </if>
      <if test="record.emergencyContact != null">
        emergency_contact = #{record.emergencyContact,jdbcType=VARCHAR},
      </if>
      <if test="record.emergencyMobile != null">
        emergency_mobile = #{record.emergencyMobile,jdbcType=VARCHAR},
      </if>
      <if test="record.quitTime != null">
        quit_time = #{record.quitTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.welfareRemarks != null">
        welfare_remarks = #{record.welfareRemarks,jdbcType=VARCHAR},
      </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 Thu May 07 14:15:57 CST 2020.
    -->
    update personnel_mid
    set id = #{record.id,jdbcType=INTEGER},
      welfare_annex_url = #{record.welfareAnnexUrl,jdbcType=VARCHAR},
      welfare_annex_name = #{record.welfareAnnexName,jdbcType=VARCHAR},
      insurance_start_time = #{record.insuranceStartTime,jdbcType=TIMESTAMP},
      insurance_end_time = #{record.insuranceEndTime,jdbcType=TIMESTAMP},
      fund_start_time = #{record.fundStartTime,jdbcType=TIMESTAMP},
      fund_end_time = #{record.fundEndTime,jdbcType=TIMESTAMP},
      employer_start_time = #{record.employerStartTime,jdbcType=TIMESTAMP},
      employer_end_time = #{record.employerEndTime,jdbcType=TIMESTAMP},
      contract_start_time = #{record.contractStartTime,jdbcType=TIMESTAMP},
      contract_end_time = #{record.contractEndTime,jdbcType=TIMESTAMP},
      promotion_time = #{record.promotionTime,jdbcType=TIMESTAMP},
      promotion_remarks = #{record.promotionRemarks,jdbcType=VARCHAR},
      emergency_contact = #{record.emergencyContact,jdbcType=VARCHAR},
      emergency_mobile = #{record.emergencyMobile,jdbcType=VARCHAR},
      quit_time = #{record.quitTime,jdbcType=TIMESTAMP},
      create_time = #{record.createTime,jdbcType=TIMESTAMP},
      welfare_remarks = #{record.welfareRemarks,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.PersonnelMid">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu May 07 14:15:57 CST 2020.
    -->
    update personnel_mid
    <set>
      <if test="welfareAnnexUrl != null">
        welfare_annex_url = #{welfareAnnexUrl,jdbcType=VARCHAR},
      </if>
      <if test="welfareAnnexName != null">
        welfare_annex_name = #{welfareAnnexName,jdbcType=VARCHAR},
      </if>
      <if test="insuranceStartTime != null">
        insurance_start_time = #{insuranceStartTime,jdbcType=TIMESTAMP},
      </if>
      <if test="insuranceEndTime != null">
        insurance_end_time = #{insuranceEndTime,jdbcType=TIMESTAMP},
      </if>
      <if test="fundStartTime != null">
        fund_start_time = #{fundStartTime,jdbcType=TIMESTAMP},
      </if>
      <if test="fundEndTime != null">
        fund_end_time = #{fundEndTime,jdbcType=TIMESTAMP},
      </if>
      <if test="employerStartTime != null">
        employer_start_time = #{employerStartTime,jdbcType=TIMESTAMP},
      </if>
      <if test="employerEndTime != null">
        employer_end_time = #{employerEndTime,jdbcType=TIMESTAMP},
      </if>
      <if test="contractStartTime != null">
        contract_start_time = #{contractStartTime,jdbcType=TIMESTAMP},
      </if>
      <if test="contractEndTime != null">
        contract_end_time = #{contractEndTime,jdbcType=TIMESTAMP},
      </if>
      <if test="promotionTime != null">
        promotion_time = #{promotionTime,jdbcType=TIMESTAMP},
      </if>
      <if test="promotionRemarks != null">
        promotion_remarks = #{promotionRemarks,jdbcType=VARCHAR},
      </if>
      <if test="emergencyContact != null">
        emergency_contact = #{emergencyContact,jdbcType=VARCHAR},
      </if>
      <if test="emergencyMobile != null">
        emergency_mobile = #{emergencyMobile,jdbcType=VARCHAR},
      </if>
      <if test="quitTime != null">
        quit_time = #{quitTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="welfareRemarks != null">
        welfare_remarks = #{welfareRemarks,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.PersonnelMid">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu May 07 14:15:57 CST 2020.
    -->
    update personnel_mid
    set welfare_annex_url = #{welfareAnnexUrl,jdbcType=VARCHAR},
      welfare_annex_name = #{welfareAnnexName,jdbcType=VARCHAR},
      insurance_start_time = #{insuranceStartTime,jdbcType=TIMESTAMP},
      insurance_end_time = #{insuranceEndTime,jdbcType=TIMESTAMP},
      fund_start_time = #{fundStartTime,jdbcType=TIMESTAMP},
      fund_end_time = #{fundEndTime,jdbcType=TIMESTAMP},
      employer_start_time = #{employerStartTime,jdbcType=TIMESTAMP},
      employer_end_time = #{employerEndTime,jdbcType=TIMESTAMP},
      contract_start_time = #{contractStartTime,jdbcType=TIMESTAMP},
      contract_end_time = #{contractEndTime,jdbcType=TIMESTAMP},
      promotion_time = #{promotionTime,jdbcType=TIMESTAMP},
      promotion_remarks = #{promotionRemarks,jdbcType=VARCHAR},
      emergency_contact = #{emergencyContact,jdbcType=VARCHAR},
      emergency_mobile = #{emergencyMobile,jdbcType=VARCHAR},
      quit_time = #{quitTime,jdbcType=TIMESTAMP},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      welfare_remarks = #{welfareRemarks,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
  
  <update id="updateByidTime" >
   
    update personnel_mid
    <set>
    	<if test="type==null">
      <if test="m.welfareAnnexUrl != null">
        welfare_annex_url = #{m.welfareAnnexUrl,jdbcType=VARCHAR},
      </if>
      <if test="m.welfareAnnexName != null">
        welfare_annex_name = #{m.welfareAnnexName,jdbcType=VARCHAR},
      </if>
       <if test="m.welfareRemarks != null">
        welfare_remarks = #{m.welfareRemarks,jdbcType=VARCHAR},
      </if>
    	</if>
      <if test="type==0">
        insurance_start_time = #{m.insuranceStartTime,jdbcType=TIMESTAMP},
        insurance_end_time = #{m.insuranceEndTime,jdbcType=TIMESTAMP},
      </if>
      <if test="type==1">
        fund_start_time = #{m.fundStartTime,jdbcType=TIMESTAMP},
        fund_end_time = #{m.fundEndTime,jdbcType=TIMESTAMP},
      </if>
      <if test="type==2">
        employer_start_time = #{m.employerStartTime,jdbcType=TIMESTAMP},
        employer_end_time = #{m.employerEndTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{m.id,jdbcType=INTEGER}
  </update>
</mapper>