<?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.willalp.vacation.mapper.HsVacationSurplusMapper">

    <resultMap type="com.willalp.vacation.domain.HsVacationSurplus" id="HsVacationSurplusResult">
                    <result property="id" column="id"/>
                    <result property="name" column="name"/>
                    <result property="jobNo" column="job_no"/>
                    <result property="department" column="department"/>
                    <result property="entryTime" column="entry_time"/>
                    <result property="firstTime" column="first_time"/>
                    <result property="annualLeave" column="annual_leave"/>
                    <result property="matterLeave" column="matter_leave"/>
                    <result property="illnessLeave" column="illness_leave"/>
                    <result property="adjustLeave" column="adjust_leave"/>
                    <result property="bearLeave" column="bear_leave"/>
                    <result property="accompanyBearLeave" column="accompany_bear_leave"/>
                    <result property="marriedLeave" column="married_leave"/>
                    <result property="funeralLeave" column="funeral_leave"/>
                    <result property="lactationLeave" column="lactation_leave"/>
                    <result property="childcareLeave" column="childcare_leave"/>
                    <result property="isDelete" column="is_delete"/>
                    <result property="createBy" column="create_by"/>
                    <result property="createTime" column="create_time"/>
                    <result property="updateBy" column="update_by"/>
                    <result property="updateTime" column="update_time"/>
                    <result property="remark" column="remark"/>
            </resultMap>
    
    <sql id="selectHsVacationSurplusVo">
        select id, name, job_no, department, entry_time, first_time, annual_leave, matter_leave, illness_leave, adjust_leave, bear_leave, accompany_bear_leave, married_leave, funeral_leave, lactation_leave, childcare_leave, is_delete, create_by, create_time, update_by, update_time, remark        from hs_vacation_surplus
    </sql>

    <select id="selectHsVacationSurplusList" parameterType="HsVacationSurplus" resultMap="HsVacationSurplusResult">
        <include refid="selectHsVacationSurplusVo"/>
        <where>
            is_delete = 0
                                                                                                    <if test="name != null  and name != ''">
                            and name like concat('%', #{name}, '%')
                        </if>
                                                                                                            <if test="jobNo != null  and jobNo != ''">
                            and job_no = #{jobNo}
                        </if>
                                                                                                            <if test="department != null  and department != ''">
                            and department = #{department}
                        </if>
                                                                                                            <if test="entryTime != null ">
                            and entry_time = #{entryTime}
                        </if>
                                                                                                            <if test="firstTime != null ">
                            and first_time = #{firstTime}
                        </if>
                                                                                                            <if test="annualLeave != null  and annualLeave != ''">
                            and annual_leave = #{annualLeave}
                        </if>
                                                                                                            <if test="matterLeave != null  and matterLeave != ''">
                            and matter_leave = #{matterLeave}
                        </if>
                                                                                                            <if test="illnessLeave != null  and illnessLeave != ''">
                            and illness_leave = #{illnessLeave}
                        </if>
                                                                                                            <if test="adjustLeave != null  and adjustLeave != ''">
                            and adjust_leave = #{adjustLeave}
                        </if>
                                                                                                            <if test="bearLeave != null  and bearLeave != ''">
                            and bear_leave = #{bearLeave}
                        </if>
                                                                                                            <if test="accompanyBearLeave != null  and accompanyBearLeave != ''">
                            and accompany_bear_leave = #{accompanyBearLeave}
                        </if>
                                                                                                            <if test="marriedLeave != null  and marriedLeave != ''">
                            and married_leave = #{marriedLeave}
                        </if>
                                                                                                            <if test="funeralLeave != null  and funeralLeave != ''">
                            and funeral_leave = #{funeralLeave}
                        </if>
                                                                                                            <if test="lactationLeave != null  and lactationLeave != ''">
                            and lactation_leave = #{lactationLeave}
                        </if>
                                                                                                            <if test="childcareLeave != null  and childcareLeave != ''">
                            and childcare_leave = #{childcareLeave}
                        </if>
                                                                                                            <if test="isDelete != null ">
                            and is_delete = #{isDelete}
                        </if>
                                                                                                                                                                                                    </where>
    </select>
</mapper>
