<?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.PersonnelDossierMapper">
  <resultMap id="BaseResultMap" type="com.goafanti.common.model.PersonnelDossier">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed May 20 08:47:14 CST 2020.
    -->
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="aid" jdbcType="VARCHAR" property="aid" />
    <result column="door_id" jdbcType="INTEGER" property="doorId" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="birthday" jdbcType="TIMESTAMP" property="birthday" />
    <result column="sex" jdbcType="INTEGER" property="sex" />
    <result column="mobile" jdbcType="VARCHAR" property="mobile" />
    <result column="fixed_tel" jdbcType="VARCHAR" property="fixedTel" />
    <result column="nation" jdbcType="VARCHAR" property="nation" />
    <result column="residence_province" jdbcType="INTEGER" property="residenceProvince" />
    <result column="residence_city" jdbcType="INTEGER" property="residenceCity" />
    <result column="residence_area" jdbcType="INTEGER" property="residenceArea" />
    <result column="residence_address" jdbcType="VARCHAR" property="residenceAddress" />
    <result column="native_place_province" jdbcType="INTEGER" property="nativePlaceProvince" />
    <result column="native_place_city" jdbcType="INTEGER" property="nativePlaceCity" />
    <result column="now_province" jdbcType="INTEGER" property="nowProvince" />
    <result column="now_city" jdbcType="INTEGER" property="nowCity" />
    <result column="now_area" jdbcType="INTEGER" property="nowArea" />
    <result column="now_address" jdbcType="VARCHAR" property="nowAddress" />
    <result column="id_card" jdbcType="VARCHAR" property="idCard" />
    <result column="certification_authority" jdbcType="VARCHAR" property="certificationAuthority" />
    <result column="marriage" jdbcType="INTEGER" property="marriage" />
    <result column="political_outlook" jdbcType="INTEGER" property="politicalOutlook" />
    <result column="son" jdbcType="INTEGER" property="son" />
    <result column="girl" jdbcType="INTEGER" property="girl" />
    <result column="status" jdbcType="INTEGER" property="status" />
    <result column="system" jdbcType="INTEGER" property="system" />
    <result column="job_nature" jdbcType="INTEGER" property="jobNature" />
    <result column="job_nature_remarks" jdbcType="VARCHAR" property="jobNatureRemarks" />
    <result column="entry_time" jdbcType="TIMESTAMP" property="entryTime" />
    <result column="promotion_time" jdbcType="TIMESTAMP" property="promotionTime" />
    <result column="company" jdbcType="VARCHAR" property="company" />
    <result column="lvl" jdbcType="INTEGER" property="lvl" />
    <result column="jobs" jdbcType="INTEGER" property="jobs" />
    <result column="star" jdbcType="INTEGER" property="star" />
    <result column="allowance" jdbcType="DECIMAL" property="allowance" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="employee_id" jdbcType="INTEGER" property="employeeId" />
  </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 Wed May 20 08:47:14 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 Wed May 20 08:47:14 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 Wed May 20 08:47:14 CST 2020.
    -->
    id, aid, door_id, name, birthday, sex, mobile, fixed_tel, nation, residence_province, 
    residence_city, residence_area, residence_address, native_place_province, native_place_city, 
    now_province, now_city, now_area, now_address, id_card, certification_authority, 
    marriage, political_outlook, son, girl, status, system, job_nature, job_nature_remarks, 
    entry_time, promotion_time, company, lvl, jobs, star, allowance, create_time, employee_id
  </sql>
  <select id="selectByExample" parameterType="com.goafanti.common.model.PersonnelDossierExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed May 20 08:47:14 CST 2020.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from personnel_dossier
    <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 Wed May 20 08:47:14 CST 2020.
    -->
    select 
    <include refid="Base_Column_List" />
    from personnel_dossier
    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 Wed May 20 08:47:14 CST 2020.
    -->
    delete from personnel_dossier
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <delete id="deleteByExample" parameterType="com.goafanti.common.model.PersonnelDossierExample">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed May 20 08:47:14 CST 2020.
    -->
    delete from personnel_dossier
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.goafanti.common.model.PersonnelDossier">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed May 20 08:47:14 CST 2020.
    -->
    insert into personnel_dossier (id, aid, door_id, 
      name, birthday, sex, 
      mobile, fixed_tel, nation, 
      residence_province, residence_city, residence_area, 
      residence_address, native_place_province, 
      native_place_city, now_province, now_city, 
      now_area, now_address, id_card, 
      certification_authority, marriage, political_outlook, 
      son, girl, status, 
      system, job_nature, job_nature_remarks, 
      entry_time, promotion_time, company, 
      lvl, jobs, star, allowance, 
      create_time, employee_id)
    values (#{id,jdbcType=INTEGER}, #{aid,jdbcType=VARCHAR}, #{doorId,jdbcType=INTEGER}, 
      #{name,jdbcType=VARCHAR}, #{birthday,jdbcType=TIMESTAMP}, #{sex,jdbcType=INTEGER}, 
      #{mobile,jdbcType=VARCHAR}, #{fixedTel,jdbcType=VARCHAR}, #{nation,jdbcType=VARCHAR}, 
      #{residenceProvince,jdbcType=INTEGER}, #{residenceCity,jdbcType=INTEGER}, #{residenceArea,jdbcType=INTEGER}, 
      #{residenceAddress,jdbcType=VARCHAR}, #{nativePlaceProvince,jdbcType=INTEGER}, 
      #{nativePlaceCity,jdbcType=INTEGER}, #{nowProvince,jdbcType=INTEGER}, #{nowCity,jdbcType=INTEGER}, 
      #{nowArea,jdbcType=INTEGER}, #{nowAddress,jdbcType=VARCHAR}, #{idCard,jdbcType=VARCHAR}, 
      #{certificationAuthority,jdbcType=VARCHAR}, #{marriage,jdbcType=INTEGER}, #{politicalOutlook,jdbcType=INTEGER}, 
      #{son,jdbcType=INTEGER}, #{girl,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, 
      #{system,jdbcType=INTEGER}, #{jobNature,jdbcType=INTEGER}, #{jobNatureRemarks,jdbcType=VARCHAR}, 
      #{entryTime,jdbcType=TIMESTAMP}, #{promotionTime,jdbcType=TIMESTAMP}, #{company,jdbcType=VARCHAR}, 
      #{lvl,jdbcType=INTEGER}, #{jobs,jdbcType=INTEGER}, #{star,jdbcType=INTEGER}, #{allowance,jdbcType=DECIMAL}, 
      #{createTime,jdbcType=TIMESTAMP}, #{employeeId,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="com.goafanti.common.model.PersonnelDossier">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed May 20 08:47:14 CST 2020.
    -->
    insert into personnel_dossier
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="aid != null">
        aid,
      </if>
      <if test="doorId != null">
        door_id,
      </if>
      <if test="name != null">
        name,
      </if>
      <if test="birthday != null">
        birthday,
      </if>
      <if test="sex != null">
        sex,
      </if>
      <if test="mobile != null">
        mobile,
      </if>
      <if test="fixedTel != null">
        fixed_tel,
      </if>
      <if test="nation != null">
        nation,
      </if>
      <if test="residenceProvince != null">
        residence_province,
      </if>
      <if test="residenceCity != null">
        residence_city,
      </if>
      <if test="residenceArea != null">
        residence_area,
      </if>
      <if test="residenceAddress != null">
        residence_address,
      </if>
      <if test="nativePlaceProvince != null">
        native_place_province,
      </if>
      <if test="nativePlaceCity != null">
        native_place_city,
      </if>
      <if test="nowProvince != null">
        now_province,
      </if>
      <if test="nowCity != null">
        now_city,
      </if>
      <if test="nowArea != null">
        now_area,
      </if>
      <if test="nowAddress != null">
        now_address,
      </if>
      <if test="idCard != null">
        id_card,
      </if>
      <if test="certificationAuthority != null">
        certification_authority,
      </if>
      <if test="marriage != null">
        marriage,
      </if>
      <if test="politicalOutlook != null">
        political_outlook,
      </if>
      <if test="son != null">
        son,
      </if>
      <if test="girl != null">
        girl,
      </if>
      <if test="status != null">
        status,
      </if>
      <if test="system != null">
        system,
      </if>
      <if test="jobNature != null">
        job_nature,
      </if>
      <if test="jobNatureRemarks != null">
        job_nature_remarks,
      </if>
      <if test="entryTime != null">
        entry_time,
      </if>
      <if test="promotionTime != null">
        promotion_time,
      </if>
      <if test="company != null">
        company,
      </if>
      <if test="lvl != null">
        lvl,
      </if>
      <if test="jobs != null">
        jobs,
      </if>
      <if test="star != null">
        star,
      </if>
      <if test="allowance != null">
        allowance,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="employeeId != null">
        employee_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="aid != null">
        #{aid,jdbcType=VARCHAR},
      </if>
      <if test="doorId != null">
        #{doorId,jdbcType=INTEGER},
      </if>
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="birthday != null">
        #{birthday,jdbcType=TIMESTAMP},
      </if>
      <if test="sex != null">
        #{sex,jdbcType=INTEGER},
      </if>
      <if test="mobile != null">
        #{mobile,jdbcType=VARCHAR},
      </if>
      <if test="fixedTel != null">
        #{fixedTel,jdbcType=VARCHAR},
      </if>
      <if test="nation != null">
        #{nation,jdbcType=VARCHAR},
      </if>
      <if test="residenceProvince != null">
        #{residenceProvince,jdbcType=INTEGER},
      </if>
      <if test="residenceCity != null">
        #{residenceCity,jdbcType=INTEGER},
      </if>
      <if test="residenceArea != null">
        #{residenceArea,jdbcType=INTEGER},
      </if>
      <if test="residenceAddress != null">
        #{residenceAddress,jdbcType=VARCHAR},
      </if>
      <if test="nativePlaceProvince != null">
        #{nativePlaceProvince,jdbcType=INTEGER},
      </if>
      <if test="nativePlaceCity != null">
        #{nativePlaceCity,jdbcType=INTEGER},
      </if>
      <if test="nowProvince != null">
        #{nowProvince,jdbcType=INTEGER},
      </if>
      <if test="nowCity != null">
        #{nowCity,jdbcType=INTEGER},
      </if>
      <if test="nowArea != null">
        #{nowArea,jdbcType=INTEGER},
      </if>
      <if test="nowAddress != null">
        #{nowAddress,jdbcType=VARCHAR},
      </if>
      <if test="idCard != null">
        #{idCard,jdbcType=VARCHAR},
      </if>
      <if test="certificationAuthority != null">
        #{certificationAuthority,jdbcType=VARCHAR},
      </if>
      <if test="marriage != null">
        #{marriage,jdbcType=INTEGER},
      </if>
      <if test="politicalOutlook != null">
        #{politicalOutlook,jdbcType=INTEGER},
      </if>
      <if test="son != null">
        #{son,jdbcType=INTEGER},
      </if>
      <if test="girl != null">
        #{girl,jdbcType=INTEGER},
      </if>
      <if test="status != null">
        #{status,jdbcType=INTEGER},
      </if>
      <if test="system != null">
        #{system,jdbcType=INTEGER},
      </if>
      <if test="jobNature != null">
        #{jobNature,jdbcType=INTEGER},
      </if>
      <if test="jobNatureRemarks != null">
        #{jobNatureRemarks,jdbcType=VARCHAR},
      </if>
      <if test="entryTime != null">
        #{entryTime,jdbcType=TIMESTAMP},
      </if>
      <if test="promotionTime != null">
        #{promotionTime,jdbcType=TIMESTAMP},
      </if>
      <if test="company != null">
        #{company,jdbcType=VARCHAR},
      </if>
      <if test="lvl != null">
        #{lvl,jdbcType=INTEGER},
      </if>
      <if test="jobs != null">
        #{jobs,jdbcType=INTEGER},
      </if>
      <if test="star != null">
        #{star,jdbcType=INTEGER},
      </if>
      <if test="allowance != null">
        #{allowance,jdbcType=DECIMAL},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="employeeId != null">
        #{employeeId,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.goafanti.common.model.PersonnelDossierExample" resultType="java.lang.Long">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed May 20 08:47:14 CST 2020.
    -->
    select count(*) from personnel_dossier
    <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 Wed May 20 08:47:14 CST 2020.
    -->
    update personnel_dossier
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=INTEGER},
      </if>
      <if test="record.aid != null">
        aid = #{record.aid,jdbcType=VARCHAR},
      </if>
      <if test="record.doorId != null">
        door_id = #{record.doorId,jdbcType=INTEGER},
      </if>
      <if test="record.name != null">
        name = #{record.name,jdbcType=VARCHAR},
      </if>
      <if test="record.birthday != null">
        birthday = #{record.birthday,jdbcType=TIMESTAMP},
      </if>
      <if test="record.sex != null">
        sex = #{record.sex,jdbcType=INTEGER},
      </if>
      <if test="record.mobile != null">
        mobile = #{record.mobile,jdbcType=VARCHAR},
      </if>
      <if test="record.fixedTel != null">
        fixed_tel = #{record.fixedTel,jdbcType=VARCHAR},
      </if>
      <if test="record.nation != null">
        nation = #{record.nation,jdbcType=VARCHAR},
      </if>
      <if test="record.residenceProvince != null">
        residence_province = #{record.residenceProvince,jdbcType=INTEGER},
      </if>
      <if test="record.residenceCity != null">
        residence_city = #{record.residenceCity,jdbcType=INTEGER},
      </if>
      <if test="record.residenceArea != null">
        residence_area = #{record.residenceArea,jdbcType=INTEGER},
      </if>
      <if test="record.residenceAddress != null">
        residence_address = #{record.residenceAddress,jdbcType=VARCHAR},
      </if>
      <if test="record.nativePlaceProvince != null">
        native_place_province = #{record.nativePlaceProvince,jdbcType=INTEGER},
      </if>
      <if test="record.nativePlaceCity != null">
        native_place_city = #{record.nativePlaceCity,jdbcType=INTEGER},
      </if>
      <if test="record.nowProvince != null">
        now_province = #{record.nowProvince,jdbcType=INTEGER},
      </if>
      <if test="record.nowCity != null">
        now_city = #{record.nowCity,jdbcType=INTEGER},
      </if>
      <if test="record.nowArea != null">
        now_area = #{record.nowArea,jdbcType=INTEGER},
      </if>
      <if test="record.nowAddress != null">
        now_address = #{record.nowAddress,jdbcType=VARCHAR},
      </if>
      <if test="record.idCard != null">
        id_card = #{record.idCard,jdbcType=VARCHAR},
      </if>
      <if test="record.certificationAuthority != null">
        certification_authority = #{record.certificationAuthority,jdbcType=VARCHAR},
      </if>
      <if test="record.marriage != null">
        marriage = #{record.marriage,jdbcType=INTEGER},
      </if>
      <if test="record.politicalOutlook != null">
        political_outlook = #{record.politicalOutlook,jdbcType=INTEGER},
      </if>
      <if test="record.son != null">
        son = #{record.son,jdbcType=INTEGER},
      </if>
      <if test="record.girl != null">
        girl = #{record.girl,jdbcType=INTEGER},
      </if>
      <if test="record.status != null">
        status = #{record.status,jdbcType=INTEGER},
      </if>
      <if test="record.system != null">
        system = #{record.system,jdbcType=INTEGER},
      </if>
      <if test="record.jobNature != null">
        job_nature = #{record.jobNature,jdbcType=INTEGER},
      </if>
      <if test="record.jobNatureRemarks != null">
        job_nature_remarks = #{record.jobNatureRemarks,jdbcType=VARCHAR},
      </if>
      <if test="record.entryTime != null">
        entry_time = #{record.entryTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.promotionTime != null">
        promotion_time = #{record.promotionTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.company != null">
        company = #{record.company,jdbcType=VARCHAR},
      </if>
      <if test="record.lvl != null">
        lvl = #{record.lvl,jdbcType=INTEGER},
      </if>
      <if test="record.jobs != null">
        jobs = #{record.jobs,jdbcType=INTEGER},
      </if>
      <if test="record.star != null">
        star = #{record.star,jdbcType=INTEGER},
      </if>
      <if test="record.allowance != null">
        allowance = #{record.allowance,jdbcType=DECIMAL},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.employeeId != null">
        employee_id = #{record.employeeId,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 Wed May 20 08:47:14 CST 2020.
    -->
    update personnel_dossier
    set id = #{record.id,jdbcType=INTEGER},
      aid = #{record.aid,jdbcType=VARCHAR},
      door_id = #{record.doorId,jdbcType=INTEGER},
      name = #{record.name,jdbcType=VARCHAR},
      birthday = #{record.birthday,jdbcType=TIMESTAMP},
      sex = #{record.sex,jdbcType=INTEGER},
      mobile = #{record.mobile,jdbcType=VARCHAR},
      fixed_tel = #{record.fixedTel,jdbcType=VARCHAR},
      nation = #{record.nation,jdbcType=VARCHAR},
      residence_province = #{record.residenceProvince,jdbcType=INTEGER},
      residence_city = #{record.residenceCity,jdbcType=INTEGER},
      residence_area = #{record.residenceArea,jdbcType=INTEGER},
      residence_address = #{record.residenceAddress,jdbcType=VARCHAR},
      native_place_province = #{record.nativePlaceProvince,jdbcType=INTEGER},
      native_place_city = #{record.nativePlaceCity,jdbcType=INTEGER},
      now_province = #{record.nowProvince,jdbcType=INTEGER},
      now_city = #{record.nowCity,jdbcType=INTEGER},
      now_area = #{record.nowArea,jdbcType=INTEGER},
      now_address = #{record.nowAddress,jdbcType=VARCHAR},
      id_card = #{record.idCard,jdbcType=VARCHAR},
      certification_authority = #{record.certificationAuthority,jdbcType=VARCHAR},
      marriage = #{record.marriage,jdbcType=INTEGER},
      political_outlook = #{record.politicalOutlook,jdbcType=INTEGER},
      son = #{record.son,jdbcType=INTEGER},
      girl = #{record.girl,jdbcType=INTEGER},
      status = #{record.status,jdbcType=INTEGER},
      system = #{record.system,jdbcType=INTEGER},
      job_nature = #{record.jobNature,jdbcType=INTEGER},
      job_nature_remarks = #{record.jobNatureRemarks,jdbcType=VARCHAR},
      entry_time = #{record.entryTime,jdbcType=TIMESTAMP},
      promotion_time = #{record.promotionTime,jdbcType=TIMESTAMP},
      company = #{record.company,jdbcType=VARCHAR},
      lvl = #{record.lvl,jdbcType=INTEGER},
      jobs = #{record.jobs,jdbcType=INTEGER},
      star = #{record.star,jdbcType=INTEGER},
      allowance = #{record.allowance,jdbcType=DECIMAL},
      create_time = #{record.createTime,jdbcType=TIMESTAMP},
      employee_id = #{record.employeeId,jdbcType=INTEGER}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.PersonnelDossier">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed May 20 08:47:14 CST 2020.
    -->
    update personnel_dossier
    <set>
      <if test="aid != null">
        aid = #{aid,jdbcType=VARCHAR},
      </if>
      <if test="doorId != null">
        door_id = #{doorId,jdbcType=INTEGER},
      </if>
      <if test="name != null">
        name = #{name,jdbcType=VARCHAR},
      </if>
      <if test="birthday != null">
        birthday = #{birthday,jdbcType=TIMESTAMP},
      </if>
      <if test="sex != null">
        sex = #{sex,jdbcType=INTEGER},
      </if>
      <if test="mobile != null">
        mobile = #{mobile,jdbcType=VARCHAR},
      </if>
      <if test="fixedTel != null">
        fixed_tel = #{fixedTel,jdbcType=VARCHAR},
      </if>
      <if test="nation != null">
        nation = #{nation,jdbcType=VARCHAR},
      </if>
      <if test="residenceProvince != null">
        residence_province = #{residenceProvince,jdbcType=INTEGER},
      </if>
      <if test="residenceCity != null">
        residence_city = #{residenceCity,jdbcType=INTEGER},
      </if>
      <if test="residenceArea != null">
        residence_area = #{residenceArea,jdbcType=INTEGER},
      </if>
      <if test="residenceAddress != null">
        residence_address = #{residenceAddress,jdbcType=VARCHAR},
      </if>
      <if test="nativePlaceProvince != null">
        native_place_province = #{nativePlaceProvince,jdbcType=INTEGER},
      </if>
      <if test="nativePlaceCity != null">
        native_place_city = #{nativePlaceCity,jdbcType=INTEGER},
      </if>
      <if test="nowProvince != null">
        now_province = #{nowProvince,jdbcType=INTEGER},
      </if>
      <if test="nowCity != null">
        now_city = #{nowCity,jdbcType=INTEGER},
      </if>
      <if test="nowArea != null">
        now_area = #{nowArea,jdbcType=INTEGER},
      </if>
      <if test="nowAddress != null">
        now_address = #{nowAddress,jdbcType=VARCHAR},
      </if>
      <if test="idCard != null">
        id_card = #{idCard,jdbcType=VARCHAR},
      </if>
      <if test="certificationAuthority != null">
        certification_authority = #{certificationAuthority,jdbcType=VARCHAR},
      </if>
      <if test="marriage != null">
        marriage = #{marriage,jdbcType=INTEGER},
      </if>
      <if test="politicalOutlook != null">
        political_outlook = #{politicalOutlook,jdbcType=INTEGER},
      </if>
      <if test="son != null">
        son = #{son,jdbcType=INTEGER},
      </if>
      <if test="girl != null">
        girl = #{girl,jdbcType=INTEGER},
      </if>
      <if test="status != null">
        status = #{status,jdbcType=INTEGER},
      </if>
      <if test="system != null">
        system = #{system,jdbcType=INTEGER},
      </if>
      <if test="jobNature != null">
        job_nature = #{jobNature,jdbcType=INTEGER},
      </if>
      <if test="jobNatureRemarks != null">
        job_nature_remarks = #{jobNatureRemarks,jdbcType=VARCHAR},
      </if>
      <if test="entryTime != null">
        entry_time = #{entryTime,jdbcType=TIMESTAMP},
      </if>
      <if test="promotionTime != null">
        promotion_time = #{promotionTime,jdbcType=TIMESTAMP},
      </if>
      <if test="company != null">
        company = #{company,jdbcType=VARCHAR},
      </if>
      <if test="lvl != null">
        lvl = #{lvl,jdbcType=INTEGER},
      </if>
      <if test="jobs != null">
        jobs = #{jobs,jdbcType=INTEGER},
      </if>
      <if test="star != null">
        star = #{star,jdbcType=INTEGER},
      </if>
      <if test="allowance != null">
        allowance = #{allowance,jdbcType=DECIMAL},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="employeeId != null">
        employee_id = #{employeeId,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.PersonnelDossier">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed May 20 08:47:14 CST 2020.
    -->
    update personnel_dossier
    set aid = #{aid,jdbcType=VARCHAR},
      door_id = #{doorId,jdbcType=INTEGER},
      name = #{name,jdbcType=VARCHAR},
      birthday = #{birthday,jdbcType=TIMESTAMP},
      sex = #{sex,jdbcType=INTEGER},
      mobile = #{mobile,jdbcType=VARCHAR},
      fixed_tel = #{fixedTel,jdbcType=VARCHAR},
      nation = #{nation,jdbcType=VARCHAR},
      residence_province = #{residenceProvince,jdbcType=INTEGER},
      residence_city = #{residenceCity,jdbcType=INTEGER},
      residence_area = #{residenceArea,jdbcType=INTEGER},
      residence_address = #{residenceAddress,jdbcType=VARCHAR},
      native_place_province = #{nativePlaceProvince,jdbcType=INTEGER},
      native_place_city = #{nativePlaceCity,jdbcType=INTEGER},
      now_province = #{nowProvince,jdbcType=INTEGER},
      now_city = #{nowCity,jdbcType=INTEGER},
      now_area = #{nowArea,jdbcType=INTEGER},
      now_address = #{nowAddress,jdbcType=VARCHAR},
      id_card = #{idCard,jdbcType=VARCHAR},
      certification_authority = #{certificationAuthority,jdbcType=VARCHAR},
      marriage = #{marriage,jdbcType=INTEGER},
      political_outlook = #{politicalOutlook,jdbcType=INTEGER},
      son = #{son,jdbcType=INTEGER},
      girl = #{girl,jdbcType=INTEGER},
      status = #{status,jdbcType=INTEGER},
      system = #{system,jdbcType=INTEGER},
      job_nature = #{jobNature,jdbcType=INTEGER},
      job_nature_remarks = #{jobNatureRemarks,jdbcType=VARCHAR},
      entry_time = #{entryTime,jdbcType=TIMESTAMP},
      promotion_time = #{promotionTime,jdbcType=TIMESTAMP},
      company = #{company,jdbcType=VARCHAR},
      lvl = #{lvl,jdbcType=INTEGER},
      jobs = #{jobs,jdbcType=INTEGER},
      star = #{star,jdbcType=INTEGER},
      allowance = #{allowance,jdbcType=DECIMAL},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      employee_id = #{employeeId,jdbcType=INTEGER}
    where id = #{id,jdbcType=INTEGER}
  </update>
  
  <select id="checkDoorId" resultType="java.lang.Integer">
  select count(*) from personnel_dossier where door_id= #{doorId,jdbcType=INTEGER}
  <if test="id != null">
  and id != #{id}
  </if> 
  </select>
  
  <select id="checkEmployeeId" resultType="java.lang.Integer">
  select count(*) from personnel_dossier where employee_id= #{employeeId,jdbcType=INTEGER} 
<if test="id != null">
  and id != #{id}
  </if>  
  </select>
  
  <select id="selectPersonnelByList" resultType="com.goafanti.personnel.bo.OutPersonnelListBo">
 	select a.id,a.door_id doorId,a.name,a.status,a.`system`,a.company,dep.name depName,a.marriage,a.job_nature jobNature,
	a.job_nature_remarks jobNatureRemarks,b.jobs_name jobsName,a.lvl,b.lvl_name starName,date_format(a.entry_time,'%Y-%m-%d')entryTimes,
	date_format(a.promotion_time,'%Y-%m-%d')promotionTimes,date_format(a.birthday,'%Y-%m-%d')birthdays,
	a.entry_time entryTime, a.sex,a.son,a.girl,a.political_outlook politicalOutlook,d.education,
	d.school,d.major,d.title,pm.promotion_remarks promotionRemarks,a.mobile,a.fixed_tel fixedTel,
	date_format(pm.promotion_time,'%Y-%m-%d') promotionTime,a.id_card idCard,a.birthday,a.employee_id employeeId,
	date_format(pm.contract_start_time, '%Y-%m-%d') contractStart,date_format(pm.contract_end_time,'%Y-%m-%d')contractEnd,
	a.certification_authority certificationAuthority,  a.residence_address residenceAddress,a.now_address nowAddress,
	a.residence_province residenceProvince, a.residence_city residenceCity,a.residence_area residenceArea,
	da1.name rpName,da2.name rcName,da3.name raName,db1.name nppName,db2.name npcName,dc1.name npName,dc2.name ncName,
	dc3.name naName,a.native_place_province nativePlaceProvince, a.native_place_city nativePlaceCity,
	a.now_province nowProvince, a.now_city nowCity,a.now_area nowArea, date_format(pm.quit_time,'%Y-%m-%d') quitTime,
	pm.emergency_contact emergencyContact,pm.emergency_mobile emergencyMobile,
	date_format(pm.insurance_start_time,'%Y-%m-%d') insuranceStartTimes,date_format(pm.insurance_end_time,'%Y-%m-%d') insuranceEndTimes,
	date_format(pm.fund_start_time,'%Y-%m-%d') fundStartTimes,date_format(pm.fund_end_time,'%Y-%m-%d') fundEndTimes
	from personnel_dossier a left join  admin_level b  on a.jobs=b.jobs and a.star=b.lvl left join department dep on a.company = dep.id
	left join personnel_entry d on a.id=d.id  	left join personnel_mid pm on a.id=pm.id left join district_glossory da1 on a.residence_province=da1.id  
	left join district_glossory da2 on a.residence_city=da2.id	left join district_glossory da3 on a.residence_area=da3.id
	left join district_glossory db1 on a.native_place_province=db1.id	left join district_glossory db2 on a.native_place_city=db2.id
 	left join district_glossory dc1 on a.now_province=dc1.id left join district_glossory dc2 on a.now_city=dc2.id	
 	left join district_glossory dc3 on a.now_area=dc3.id
	<if test="aid !=null">
		left join admin ad on dep.id=ad.department_id
	</if>
	where 1=1
	<if test="aid !=null">
	and ad.id= #{aid}
	</if>
	<if test="i.name != null">
	and a.name like concat(#{i.name},'%')
	</if>
	<if test="i.company !=null">
	and a.company= #{i.company}
	</if>
	<if test="i.status !=null">
	and a.status= #{i.status}
	</if>
	<if test="i.sex !=null">
	and a.sex= #{i.sex}
	</if>
	<if test="i.marriage !=null">
	and a.marriage= #{i.marriage}
	</if>
	<if test="i.politicalOutlook !=null">
	and a.political_outlook= #{i.politicalOutlook}
	</if>
	<if test="i.birthdayMonth !=null">
	and month(a.birthday)= #{i.birthdayMonth}
	</if>
	<if test="i.promotionStart !=null and i.promotionEnd !=null">
	and a.promotion_time between #{i.promotionStart} and #{i.promotionEnd}
	</if>
	<if test="i.entryStart !=null and i.entryEnd !=null">
	and a.entry_time	between #{i.entryStart} and #{i.entryEnd}
	</if>
	<if test="i.system !=null">
	and a.`system`= #{i.system}
	</if>
	<if test="i.workingYears ==0">
	and TIMESTAMPDIFF(year,a.entry_time,now()) between 0 and 1
	</if>
	<if test="i.workingYears ==1">
	and TIMESTAMPDIFF(year,a.entry_time,now()) between 1 and 3
	</if>
	<if test="i.workingYears ==2">
	and TIMESTAMPDIFF(year,a.entry_time,now()) between 3 and 10
	</if>
	<if test="i.workingYears ==3">
	and TIMESTAMPDIFF(year,a.entry_time,now()) between 10 and 99
	</if>
	<if test="i.quitStart !=null and i.quitEnd !=null">
	and pm.quit_time	between #{i.quitStart} and #{i.quitEnd}
	</if>
	<if test="i.contractStart !=null and i.contractEnd !=null">
	and pm.contract_end_time between #{i.contractStart} and #{i.contractEnd}
	</if>
	<if test="i.education !=null">
	and d.education= #{i.education}
	</if>
	order by a.create_time desc
	<if test="page_sql!=null">
			${page_sql}
	</if>
  </select>
  
   <select id="selectPersonnelByCount" resultType="java.lang.Integer">
	  select count(*)
	from personnel_dossier a left join  admin_level b  on a.jobs=b.jobs and a.star=b.lvl left join department dep on a.company = dep.id
	left join personnel_entry d on a.id=d.id  	left join personnel_mid pm on a.id=pm.id
	<if test="aid !=null">
		left join admin ad on dep.id=ad.department_id
	</if>
	where 1=1
	<if test="aid !=null">
	and ad.id= #{aid}
	</if>
	<if test="i.name != null">
	and a.name like concat(#{i.name},'%')
	</if>
	<if test="i.company !=null">
	and a.company= #{i.company}
	</if>
	<if test="i.status !=null">
	and a.status= #{i.status}
	</if>
	<if test="i.sex !=null">
	and a.sex= #{i.sex}
	</if>
	<if test="i.marriage !=null">
	and a.marriage= #{i.marriage}
	</if>
	<if test="i.politicalOutlook !=null">
	and a.political_outlook= #{i.politicalOutlook}
	</if>
	<if test="i.birthdayMonth !=null">
	and month(a.birthday)= #{i.birthdayMonth}
	</if>
	<if test="i.promotionStart !=null and i.promotionEnd !=null">
	and a.promotion_time between #{i.promotionStart} and #{i.promotionEnd}
	</if>
	<if test="i.entryStart !=null and i.entryEnd !=null">
	and a.entry_time	between #{i.entryStart} and #{i.entryEnd}
	</if>
	<if test="i.system !=null">
	and a.`system`= #{i.system}
	</if>
	<if test="i.workingYears ==0">
	and TIMESTAMPDIFF(year,a.entry_time,now()) between 0 and 1
	</if>
	<if test="i.workingYears ==1">
	and TIMESTAMPDIFF(year,a.entry_time,now()) between 1 and 3
	</if>
	<if test="i.workingYears ==2">
	and TIMESTAMPDIFF(year,a.entry_time,now()) between 3 and 10
	</if>
	<if test="i.workingYears ==3">
	and TIMESTAMPDIFF(year,a.entry_time,now()) between 10 and 99
	</if>
	<if test="i.quitStart !=null and i.quitEnd !=null">
	and pm.quit_time	between #{i.quitStart} and #{i.quitEnd}
	</if>
	<if test="i.contractStart !=null and i.contractEnd !=null">
	and f.contract_end_time between #{i.contractStart} and #{i.contractEnd}
	</if>
	<if test="i.education !=null">
	and d.education= #{i.education}
	</if>
  </select>
  <select id="selectBypdId" resultType="com.goafanti.personnel.bo.OutPersonnelBo">
	select a.id,a.door_id doorId,a.name,a.status,a.`system`,a.company,dep.name depName,a.nation,a.marriage,a.job_nature jobNature,
	a.job_nature_remarks jobNatureRemarks, b.jobs_name jobsName,a.lvl,b.lvl_name starName,date_format(a.entry_time,'%Y-%m-%d')entryTimes,
	date_format(a.promotion_time,'%Y-%m-%d')promotionTimes,date_format(a.birthday,'%Y-%m-%d')birthdays,a.star,a.jobs,
	a.entry_time entryTime, a.sex,a.son,a.girl,a.political_outlook politicalOutlook,d.education,a.employee_id employeeId,
	d.school,d.major,d.title,m.promotion_remarks promotionRemarks,a.mobile,a.fixed_tel fixedTel,da1.name rpName,da2.name rcName,
	da3.name raName,db1.name nppName,db2.name npcName,dc1.name npName,dc2.name ncName, dc3.name naName,
	date_format(m.promotion_time,'%Y-%m-%d') promotionTime,a.id_card idCard,a.birthday,a.allowance,m.welfare_remarks welfareRemarks,
	a.certification_authority certificationAuthority, a.residence_province residenceProvince,m.welfare_annex_name welfareAnnexName,
	a.residence_city residenceCity,a.residence_area residenceArea, a.residence_address residenceAddress,
	a.native_place_province nativePlaceProvince, a.native_place_city nativePlaceCity,a.now_province nowProvince,
	a.now_city nowCity,a.now_area nowArea, a.now_address nowAddress,m.welfare_annex_url welfareAnnexUrl
	from personnel_dossier a left join  admin_level b  on a.jobs=b.jobs and a.star=b.lvl 
	left join department dep on a.company = dep.id left join personnel_mid m on a.id=m.id
	left join personnel_entry d on a.id=d.id  left join district_glossory da1 on a.residence_province=da1.id  
	left join district_glossory da2 on a.residence_city=da2.id	left join district_glossory da3 on a.residence_area=da3.id
	left join district_glossory db1 on a.native_place_province=db1.id	left join district_glossory db2 on a.native_place_city=db2.id
 	left join district_glossory dc1 on a.now_province=dc1.id left join district_glossory dc2 on a.now_city=dc2.id	
 	left join district_glossory dc3 on a.now_area=dc3.id
	where 1=1
	and a.id= #{id}
  </select>
</mapper>