<?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.practitioner.AgAclLifePractitionerSalaryMapper">
  <resultMap id="BaseResultMap" type="com.yd.dal.entity.practitioner.payscale.AgAclLifePractitionerSalary">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="practitioner_id" jdbcType="BIGINT" property="practitionerId" />
    <result column="practitioner_code" jdbcType="VARCHAR" property="practitionerCode" />
    <result column="year_month" jdbcType="VARCHAR" property="yearMonth" />
    <result column="payable_amount" jdbcType="DECIMAL" property="payableAmount" />
    <result column="taxout_amount" jdbcType="DECIMAL" property="taxoutAmount" />
    <result column="net_amount" jdbcType="DECIMAL" property="netAmount" />
    <result column="pdf_oss_path" jdbcType="VARCHAR" property="pdfOssPath" />
  </resultMap>
  <sql id="Base_Column_List">
    id, practitioner_id, practitioner_code, `year_month`, payable_amount, taxout_amount, 
    net_amount, pdf_oss_path
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from ag_acl_life_practitioner_salary
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from ag_acl_life_practitioner_salary
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.practitioner.payscale.AgAclLifePractitionerSalary" useGeneratedKeys="true">
    insert into ag_acl_life_practitioner_salary (practitioner_id, practitioner_code, 
      `year_month`, payable_amount, taxout_amount, 
      net_amount, pdf_oss_path)
    values (#{practitionerId,jdbcType=BIGINT}, #{practitionerCode,jdbcType=VARCHAR}, 
      #{yearMonth,jdbcType=VARCHAR}, #{payableAmount,jdbcType=DECIMAL}, #{taxoutAmount,jdbcType=DECIMAL}, 
      #{netAmount,jdbcType=DECIMAL}, #{pdfOssPath,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.practitioner.payscale.AgAclLifePractitionerSalary" useGeneratedKeys="true">
    insert into ag_acl_life_practitioner_salary
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="practitionerId != null">
        practitioner_id,
      </if>
      <if test="practitionerCode != null">
        practitioner_code,
      </if>
      <if test="yearMonth != null">
        `year_month`,
      </if>
      <if test="payableAmount != null">
        payable_amount,
      </if>
      <if test="taxoutAmount != null">
        taxout_amount,
      </if>
      <if test="netAmount != null">
        net_amount,
      </if>
      <if test="pdfOssPath != null">
        pdf_oss_path,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="practitionerId != null">
        #{practitionerId,jdbcType=BIGINT},
      </if>
      <if test="practitionerCode != null">
        #{practitionerCode,jdbcType=VARCHAR},
      </if>
      <if test="yearMonth != null">
        #{yearMonth,jdbcType=VARCHAR},
      </if>
      <if test="payableAmount != null">
        #{payableAmount,jdbcType=DECIMAL},
      </if>
      <if test="taxoutAmount != null">
        #{taxoutAmount,jdbcType=DECIMAL},
      </if>
      <if test="netAmount != null">
        #{netAmount,jdbcType=DECIMAL},
      </if>
      <if test="pdfOssPath != null">
        #{pdfOssPath,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.yd.dal.entity.practitioner.payscale.AgAclLifePractitionerSalary">
    update ag_acl_life_practitioner_salary
    <set>
      <if test="practitionerId != null">
        practitioner_id = #{practitionerId,jdbcType=BIGINT},
      </if>
      <if test="practitionerCode != null">
        practitioner_code = #{practitionerCode,jdbcType=VARCHAR},
      </if>
      <if test="yearMonth != null">
        `year_month` = #{yearMonth,jdbcType=VARCHAR},
      </if>
      <if test="payableAmount != null">
        payable_amount = #{payableAmount,jdbcType=DECIMAL},
      </if>
      <if test="taxoutAmount != null">
        taxout_amount = #{taxoutAmount,jdbcType=DECIMAL},
      </if>
      <if test="netAmount != null">
        net_amount = #{netAmount,jdbcType=DECIMAL},
      </if>
      <if test="pdfOssPath != null">
        pdf_oss_path = #{pdfOssPath,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.yd.dal.entity.practitioner.payscale.AgAclLifePractitionerSalary">
    update ag_acl_life_practitioner_salary
    set practitioner_id = #{practitionerId,jdbcType=BIGINT},
      practitioner_code = #{practitionerCode,jdbcType=VARCHAR},
      `year_month` = #{yearMonth,jdbcType=VARCHAR},
      payable_amount = #{payableAmount,jdbcType=DECIMAL},
      taxout_amount = #{taxoutAmount,jdbcType=DECIMAL},
      net_amount = #{netAmount,jdbcType=DECIMAL},
      pdf_oss_path = #{pdfOssPath,jdbcType=VARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>

    <select id="queryListByPractitionerId" resultMap="BaseResultMap">
        select <include refid="Base_Column_List" />
        from  ag_acl_life_practitioner_salary
        where practitioner_id = #{practitionerId,jdbcType=BIGINT}
    </select>
</mapper>