<?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.AttendanceApproveMapper" >
<!--    查前天的加班出勤规则找这些出勤规则对应的加班结果表数据-->
    <select id="getOvertimeVouchersList" resultType="jnpf.model.attendance.vo.OvertimeVouchersVo">
        SELECT r.F_RuleId ruleId, r.F_EffectiveTime effectiveTime ,r.F_ClockInType clockInType, r.F_RestMinute restMinute,dr.F_GroupId groupId ,r.F_UserId userId
        FROM ftb_attendance_clock_in_result r
        LEFT JOIN ftb_attendance_daily_rule dr ON r.F_RuleId = dr.F_Id
        WHERE r.F_RuleId IN (
            SELECT F_Id
            FROM ftb_attendance_daily_rule
            WHERE
                <![CDATA[
                DATE_FORMAT(F_Day, '%Y-%m-%d') <= DATE_FORMAT(#{date}, '%Y-%m-%d')   AND	F_AttendanceType = 4 AND F_ApplyViewEnable IN(1,9,10) AND F_DeleteMark = 0
            ]]>
        ) AND 	r.F_ClockInStatus IN (1,-2) AND r.F_DeleteMark = 0

    </select>
<!--    校验是否重复发放加班劵-->
    <select id="getOvertimeByRuleId" resultType="java.lang.Integer">
        SELECT COUNT(0) from  ftb_attendance_balance_record
        where F_Type = #{code} and F_Object_Id = #{ruleId}
    </select>
</mapper>