<?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="cn.ezhizao.project.business.salary.mapper.BizFinancialSalaryDetailEmployeeMapper">

    <resultMap type="cn.ezhizao.project.business.salary.domain.BizFinancialSalaryDetailEmployee" id="BizFinancialSalaryDetailEmployeeResult">
        <id column="id" property="id"/>
    </resultMap>


    <select id="getList" parameterType="BizFinancialSalaryDetailEmployee" resultMap="BizFinancialSalaryDetailEmployeeResult">
        SELECT * FROM biz_financial_salary_detail_employee
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            deleted = 0
            <if test="id != null "> AND id = #{id}</if>
            <if test="financialSalaryId != null "> AND financial_salary_id = #{financialSalaryId}</if>
            <if test="financialSalaryDetailId != null "> AND financial_salary_detail_id = #{financialSalaryDetailId}</if>
            <if test="employeeName != null  and employeeName != ''"> AND employee_name like concat('%', #{employeeName}, '%')</if>
            <if test="departmentName != null  and departmentName != ''"> AND department_name like concat('%', #{departmentName}, '%')</if>
            <if test="idCode != null  and idCode != ''"> AND id_code = #{idCode}</if>
            <if test="salaryAmount != null "> AND salary_amount = #{salaryAmount}</if>
            <if test="bonusAmount != null "> AND bonus_amount = #{bonusAmount}</if>
            <if test="allowanceAmount != null "> AND allowance_amount = #{allowanceAmount}</if>
            <if test="subsidyAmount != null "> AND subsidy_amount = #{subsidyAmount}</if>
            <if test="absenceCut != null "> AND absence_cut = #{absenceCut}</if>
            <if test="planSalary != null "> AND plan_salary = #{planSalary}</if>
            <if test="actuallySalary != null "> AND actually_salary = #{actuallySalary}</if>
            <if test="endowmentInsurance != null "> AND endowment_insurance = #{endowmentInsurance}</if>
            <if test="medicalInsurance != null "> AND medical_insurance = #{medicalInsurance}</if>
            <if test="unemploymentBenefit != null "> AND unemployment_benefit = #{unemploymentBenefit}</if>
            <if test="seriousIllnessInsurance != null "> AND serious_illness_insurance = #{seriousIllnessInsurance}</if>
            <if test="housingFund != null "> AND housing_fund = #{housingFund}</if>
            <if test="otherCut != null "> AND other_cut = #{otherCut}</if>
            <if test="cumulativeIncome != null "> AND cumulative_income = #{cumulativeIncome}</if>
            <if test="cumulativeSpecialCut != null "> AND cumulative_special_cut = #{cumulativeSpecialCut}</if>
            <if test="cumulativeChildEduCut != null "> AND cumulative_child_edu_cut = #{cumulativeChildEduCut}</if>
            <if test="cumulativeHouseLoanInterestCut != null "> AND cumulative_house_loan_interest_cut = #{cumulativeHouseLoanInterestCut}</if>
            <if test="cumulativeHouseRentCut != null "> AND cumulative_house_rent_cut = #{cumulativeHouseRentCut}</if>
            <if test="cumulativeSupportElderCut != null "> AND cumulative_support_elder_cut = #{cumulativeSupportElderCut}</if>
            <if test="cumulativeContinuingEduCut != null "> AND cumulative_continuing_edu_cut = #{cumulativeContinuingEduCut}</if>
            <if test="cumulativeBabyCareCut != null "> AND cumulative_baby_care_cut = #{cumulativeBabyCareCut}</if>
            <if test="sumSpecialCumulativeCut != null "> AND sum_special_cumulative_cut = #{sumSpecialCumulativeCut}</if>
            <if test="cumulativeOtherCut != null "> AND cumulative_other_cut = #{cumulativeOtherCut}</if>
            <if test="cumulativeIndividualIncomeTax != null "> AND cumulative_individual_income_tax = #{cumulativeIndividualIncomeTax}</if>
            <if test="cumulativeHasPaidIit != null "> AND cumulative_has_paid_iit = #{cumulativeHasPaidIit}</if>
            <if test="currentIndividualIncomeTax != null "> AND current_individual_income_tax = #{currentIndividualIncomeTax}</if>
            <if test="idiograph != null  and idiograph != ''"> AND idiograph = #{idiograph}</if>
            <if test="individualIncomeTaxConfirm != null "> AND individual_income_tax_confirm = #{individualIncomeTaxConfirm}</if>
            <if test="companyId != null "> AND company_id = #{companyId}</if>
            <if test="financialSalaryDetailIds != null and financialSalaryDetailIds.size() > 0">
                AND financial_salary_detail_id IN
                <foreach collection="financialSalaryDetailIds" index="index" item="item" separator="," open="(" close=")">
                    #{item,jdbcType=BIGINT}
                </foreach>
            </if>
        </trim>
    </select>

    <delete id="physicalDelete">
        DELETE FROM biz_financial_salary_detail_employee
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            <if test="id != null">
                id = #{id} AND
            </if>
            <if test="financialSalaryDetailId != null "> financial_salary_detail_id = #{financialSalaryDetailId} AND</if>
       <!-- 删除条件为其他外键可以在这里加 -->
        </trim>
    </delete>
</mapper>
