<?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.yd.dal.mapper.customer.AclPractitionerHiringWorkingExperienceMapper">
  <resultMap id="BaseResultMap" type="com.yd.dal.entity.customer.AclPractitionerHiringWorkingExperience">
    <!--@mbg.generated-->
    <!--@Table ag_acl_practitioner_hiring_working_experience-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="hiring_basic_info_id" jdbcType="BIGINT" property="hiringBasicInfoId" />
    <result column="working_company" jdbcType="VARCHAR" property="workingCompany" />
    <result column="position" jdbcType="VARCHAR" property="position" />
    <result column="working_start" jdbcType="VARCHAR" property="workingStart" />
    <result column="working_end" jdbcType="VARCHAR" property="workingEnd" />
    <result column="seq" jdbcType="BIGINT" property="seq" />
    <result column="is_active" jdbcType="INTEGER" property="isActive" />
    <result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
    <result column="created_by" jdbcType="BIGINT" property="createdBy" />
    <result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
    <result column="updated_by" jdbcType="BIGINT" property="updatedBy" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, hiring_basic_info_id, working_company, `position`, working_start, working_end, 
    seq, is_active, created_at, created_by, updated_at, updated_by
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select 
    <include refid="Base_Column_List" />
    from ag_acl_practitioner_hiring_working_experience
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from ag_acl_practitioner_hiring_working_experience
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.AclPractitionerHiringWorkingExperience" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into ag_acl_practitioner_hiring_working_experience (hiring_basic_info_id, working_company, 
      `position`, working_start, working_end, 
      seq, is_active, created_at, 
      created_by, updated_at, updated_by
      )
    values (#{hiringBasicInfoId,jdbcType=BIGINT}, #{workingCompany,jdbcType=VARCHAR}, 
      #{position,jdbcType=VARCHAR}, #{workingStart,jdbcType=VARCHAR}, #{workingEnd,jdbcType=VARCHAR},
      #{seq,jdbcType=BIGINT}, #{isActive,jdbcType=INTEGER}, #{createdAt,jdbcType=TIMESTAMP}, 
      #{createdBy,jdbcType=BIGINT}, #{updatedAt,jdbcType=TIMESTAMP}, #{updatedBy,jdbcType=BIGINT}
      )
  </insert>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.AclPractitionerHiringWorkingExperience" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into ag_acl_practitioner_hiring_working_experience
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="hiringBasicInfoId != null">
        hiring_basic_info_id,
      </if>
      <if test="workingCompany != null">
        working_company,
      </if>
      <if test="position != null">
        `position`,
      </if>
      <if test="workingStart != null">
        working_start,
      </if>
      <if test="workingEnd != null">
        working_end,
      </if>
      <if test="seq != null">
        seq,
      </if>
      <if test="isActive != null">
        is_active,
      </if>
      <if test="createdAt != null">
        created_at,
      </if>
      <if test="createdBy != null">
        created_by,
      </if>
      <if test="updatedAt != null">
        updated_at,
      </if>
      <if test="updatedBy != null">
        updated_by,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="hiringBasicInfoId != null">
        #{hiringBasicInfoId,jdbcType=BIGINT},
      </if>
      <if test="workingCompany != null">
        #{workingCompany,jdbcType=VARCHAR},
      </if>
      <if test="position != null">
        #{position,jdbcType=VARCHAR},
      </if>
      <if test="workingStart != null">
        #{workingStart,jdbcType=VARCHAR},
      </if>
      <if test="workingEnd != null">
        #{workingEnd,jdbcType=VARCHAR},
      </if>
      <if test="seq != null">
        #{seq,jdbcType=BIGINT},
      </if>
      <if test="isActive != null">
        #{isActive,jdbcType=INTEGER},
      </if>
      <if test="createdAt != null">
        #{createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="createdBy != null">
        #{createdBy,jdbcType=BIGINT},
      </if>
      <if test="updatedAt != null">
        #{updatedAt,jdbcType=TIMESTAMP},
      </if>
      <if test="updatedBy != null">
        #{updatedBy,jdbcType=BIGINT},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.yd.dal.entity.customer.AclPractitionerHiringWorkingExperience">
    <!--@mbg.generated-->
    update ag_acl_practitioner_hiring_working_experience
    <set>
      <if test="hiringBasicInfoId != null">
        hiring_basic_info_id = #{hiringBasicInfoId,jdbcType=BIGINT},
      </if>
      <if test="workingCompany != null">
        working_company = #{workingCompany,jdbcType=VARCHAR},
      </if>
      <if test="position != null">
        `position` = #{position,jdbcType=VARCHAR},
      </if>
      <if test="workingStart != null">
        working_start = #{workingStart,jdbcType=VARCHAR},
      </if>
      <if test="workingEnd != null">
        working_end = #{workingEnd,jdbcType=VARCHAR},
      </if>
      <if test="seq != null">
        seq = #{seq,jdbcType=BIGINT},
      </if>
      <if test="isActive != null">
        is_active = #{isActive,jdbcType=INTEGER},
      </if>
      <if test="createdAt != null">
        created_at = #{createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="createdBy != null">
        created_by = #{createdBy,jdbcType=BIGINT},
      </if>
      <if test="updatedAt != null">
        updated_at = #{updatedAt,jdbcType=TIMESTAMP},
      </if>
      <if test="updatedBy != null">
        updated_by = #{updatedBy,jdbcType=BIGINT},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.yd.dal.entity.customer.AclPractitionerHiringWorkingExperience">
    <!--@mbg.generated-->
    update ag_acl_practitioner_hiring_working_experience
    set hiring_basic_info_id = #{hiringBasicInfoId,jdbcType=BIGINT},
      working_company = #{workingCompany,jdbcType=VARCHAR},
      `position` = #{position,jdbcType=VARCHAR},
      working_start = #{workingStart,jdbcType=VARCHAR},
      working_end = #{workingEnd,jdbcType=VARCHAR},
      seq = #{seq,jdbcType=BIGINT},
      is_active = #{isActive,jdbcType=INTEGER},
      created_at = #{createdAt,jdbcType=TIMESTAMP},
      created_by = #{createdBy,jdbcType=BIGINT},
      updated_at = #{updatedAt,jdbcType=TIMESTAMP},
      updated_by = #{updatedBy,jdbcType=BIGINT}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateBatch" parameterType="java.util.List">
    <!--@mbg.generated-->
    update ag_acl_practitioner_hiring_working_experience
    <trim prefix="set" suffixOverrides=",">
      <trim prefix="hiring_basic_info_id = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.hiringBasicInfoId,jdbcType=BIGINT}
        </foreach>
      </trim>
      <trim prefix="working_company = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.workingCompany,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="`position` = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.position,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="working_start = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.workingStart,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="working_end = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.workingEnd,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="seq = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.seq,jdbcType=BIGINT}
        </foreach>
      </trim>
      <trim prefix="is_active = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.isActive,jdbcType=INTEGER}
        </foreach>
      </trim>
      <trim prefix="created_at = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.createdAt,jdbcType=TIMESTAMP}
        </foreach>
      </trim>
      <trim prefix="created_by = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.createdBy,jdbcType=BIGINT}
        </foreach>
      </trim>
      <trim prefix="updated_at = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.updatedAt,jdbcType=TIMESTAMP}
        </foreach>
      </trim>
      <trim prefix="updated_by = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.updatedBy,jdbcType=BIGINT}
        </foreach>
      </trim>
    </trim>
    where id in
    <foreach close=")" collection="list" item="item" open="(" separator=", ">
      #{item.id,jdbcType=BIGINT}
    </foreach>
  </update>
  <update id="updateBatchSelective" parameterType="java.util.List">
    <!--@mbg.generated-->
    update ag_acl_practitioner_hiring_working_experience
    <trim prefix="set" suffixOverrides=",">
      <trim prefix="hiring_basic_info_id = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.hiringBasicInfoId != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.hiringBasicInfoId,jdbcType=BIGINT}
          </if>
        </foreach>
      </trim>
      <trim prefix="working_company = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.workingCompany != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.workingCompany,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="`position` = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.position != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.position,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="working_start = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.workingStart != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.workingStart,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="working_end = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.workingEnd != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.workingEnd,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="seq = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.seq != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.seq,jdbcType=BIGINT}
          </if>
        </foreach>
      </trim>
      <trim prefix="is_active = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.isActive != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.isActive,jdbcType=INTEGER}
          </if>
        </foreach>
      </trim>
      <trim prefix="created_at = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.createdAt != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.createdAt,jdbcType=TIMESTAMP}
          </if>
        </foreach>
      </trim>
      <trim prefix="created_by = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.createdBy != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.createdBy,jdbcType=BIGINT}
          </if>
        </foreach>
      </trim>
      <trim prefix="updated_at = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.updatedAt != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.updatedAt,jdbcType=TIMESTAMP}
          </if>
        </foreach>
      </trim>
      <trim prefix="updated_by = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.updatedBy != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.updatedBy,jdbcType=BIGINT}
          </if>
        </foreach>
      </trim>
    </trim>
    where id in
    <foreach close=")" collection="list" item="item" open="(" separator=", ">
      #{item.id,jdbcType=BIGINT}
    </foreach>
  </update>
  <insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into ag_acl_practitioner_hiring_working_experience
    (hiring_basic_info_id, working_company, `position`, working_start, working_end, seq, 
      is_active, created_at, created_by, updated_at, updated_by)
    values
    <foreach collection="list" item="item" separator=",">
      (#{item.hiringBasicInfoId,jdbcType=BIGINT}, #{item.workingCompany,jdbcType=VARCHAR}, 
        #{item.position,jdbcType=VARCHAR}, #{item.workingStart,jdbcType=VARCHAR}, #{item.workingEnd,jdbcType=VARCHAR},
        #{item.seq,jdbcType=BIGINT}, #{item.isActive,jdbcType=INTEGER}, #{item.createdAt,jdbcType=TIMESTAMP}, 
        #{item.createdBy,jdbcType=BIGINT}, #{item.updatedAt,jdbcType=TIMESTAMP}, #{item.updatedBy,jdbcType=BIGINT}
        )
    </foreach>
  </insert>

  <select id="selectByHiringBasicInfoId" resultMap="BaseResultMap">
    select <include refid="Base_Column_List" />
    from  ag_acl_practitioner_hiring_working_experience
    where hiring_basic_info_id = #{hiringBasicInfoId,jdbcType=BIGINT}
    order by working_end desc
  </select>

  <delete id="deleteBatchByIds">
    delete from ag_acl_practitioner_hiring_working_experience
    where id in
    <foreach close=")" collection="list" item="item" open="(" separator=", ">
      #{item.id,jdbcType=BIGINT}
    </foreach>
  </delete>
</mapper>