<?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.qy.worksheetsystem.model.mapper.WorkSheetMapper">
    <select id="getReportDateWorkHoursByPerson" resultType="java.util.Map" parameterType="String">
        select jbk.*
        from CT_WOR_JobBookingEntry jbk
        where
            jbk.CFPersonID=#{personId} and CFReportDate = #{reportDate} and FID &lt;&gt; #{id}
        order by FSeq
    </select>

    <select id="getEntryByParentId" resultType="java.util.Map" parameterType="String">
        select jbk.*
        from CT_WOR_JobBookingEntry jbk
        where
            jbk.FParentID=#{id}
        order by FSeq
    </select>

    <select id="getEntryById" resultType="java.util.Map" parameterType="String">
        select jbk.*
        from CT_WOR_JobBookingEntry jbk
        where
            jbk.fid=#{id}
    </select>

    <select id="getJobBookingById" resultType="java.util.Map" parameterType="String">
        select *
        from CT_WOR_JobBooking
        where
            fid=#{id}
    </select>

    <update id="updateEntryStatusById" >
        update CT_WOR_JobBookingEntry set CFStatus =#{status} where fid = #{id}
    </update>

    <update id="updateEntryStatusByParentId" >
        update CT_WOR_JobBookingEntry set CFStatus =#{status} where FParentID = #{id}
    </update>
    <update id="updateEntryAudiByParentId" >
        update CT_WOR_JobBookingEntry set CFStatus =#{status},CFAuditorAndNumber=#{auditorAndNumber} where FParentID = #{id}
    </update>
    <update id="updateStatusById" >
        update CT_WOR_JobBooking set CFStatus =#{status} where fid = #{id}
    </update>
    <update id="updateStatusAndAuditorById" >
        update CT_WOR_JobBooking set CFStatus =#{status},CFAuditorAndNumber=#{auditorAndNumber} where fid = #{id}
    </update>
    <update id="updateEntryParentIdById" >
        update CT_WOR_JobBookingEntry set FParentID =#{parentId} where fid = #{id}
    </update>

    <update id="updateJobBooking" parameterType="java.util.Map">
        update CT_WOR_JobBooking set CFTitle =#{CFTitle},
                                          CFStatus =#{CFStatus},
                                          CFBeginDate =#{CFBeginDate},
                                          CFEndDate =#{CFEndDate},
                                     CFWorkingHours =#{CFWorkingHours},
                                     CFAttendanceID=#{CFAttendanceID}
        where fid = #{FID}
    </update>

    <update id="updateEntry" parameterType="java.util.Map">
        update CT_WOR_JobBookingEntry set CFAttendanceID =#{CFAttendanceID},
                                          CFWorkingHours =#{CFWorkingHours},
                                          CFOrgID =#{CFOrgID},
                                          CFStatus =#{CFStatus}
        where fid = #{FID}
    </update>
</mapper>