<?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="jnpf.attendance.mapper.AttendanceLeaveRulesMapper" >
    <update id="updateState">
        update ftb_attendance_leave_rules
        set F_State = #{state},
            F_LastModifyUserId = #{userId},
            F_LastModifyTime = now()
        where F_Id = #{id}
    </update>
    <update id="updateByLeaveTypeId">
        update ftb_attendance_leave_rules
        set F_ScopeOfAdaptation = -1
        where F_LeaveTypeId = #{leaveTypeId}
    </update>

    <select id="list" resultType="jnpf.model.attendance.vo.attendance.AttendanceLeaveRulesVo">
        select F_Id as id,
               F_Name as name,
               F_Unit as unit,
               F_Duration as duration,
               F_DistributeBalance as distributeBalance,
               F_RetirementLeave as retirementLeave,
               F_ScopeOfAdaptation as scopeOfAdaptation,
               F_State as state
        from ftb_attendance_leave_rules
        where F_DeleteMark = 0 and F_LeaveTypeId = #{typeId}
        <if test="iText != null and iText != ''">
            and F_Name like concat('%', #{iText}, '%')
        </if>
        order by F_CreatorTime desc
    </select>
</mapper>