<?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.ruoyi.oa.mapper.OaEmployeeTemplateBindingMapper">

    <resultMap type="com.ruoyi.oa.domain.OaEmployeeTemplateBinding" id="OaEmployeeTemplateBindingResult">
        <result property="bindingId" column="binding_id"/>
        <result property="employeeId" column="employee_id"/>
        <result property="insuranceTemplateId" column="insurance_template_id"/>
        <result property="salaryTemplateId" column="salary_template_id"/>
        <result property="payYear" column="pay_year"/>
        <result property="payMonth" column="pay_month"/>
        <result property="netSalary" column="net_salary"/>
        <result property="totalCompanyCost" column="total_company_cost"/>
        <result property="status" column="status"/>
        <result property="delFlag" column="del_flag"/>
        <result property="remark" column="remark"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
    </resultMap>
    <insert id="insertBinding">
        INSERT INTO oa_employee_template_binding
        (employee_id, insurance_template_id, salary_template_id, pay_year, pay_month, net_salary, total_company_cost, status)
        VALUES (#{employeeId}, #{insuranceTemplateId}, #{salaryTemplateId}, #{payYear}, #{payMonth}, #{netSalary}, #{totalCompanyCost}, #{status})
    </insert>
    <select id="findByEmployeeAndMonth" resultType="com.ruoyi.oa.domain.OaEmployeeTemplateBinding">
        SELECT * FROM oa_employee_template_binding
        WHERE employee_id = #{employeeId}
          AND pay_year = #{payYear}
          AND pay_month = #{payMonth}
        LIMIT 1
    </select>


</mapper>
