<?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.THRATSWorkCalendarItemMapper">
    <select id="selectWorkCalendar" parameterType="java.util.Map" resultType="java.util.Map">
    SELECT
        item.fid,
        CONVERT(varchar(20) , item.FDate, 120 ) as FDate,
        CAST (item.FDayType as varchar) as dateType,
        item.FWEEK
    FROM
	T_HR_ATS_WorkCalendarItem item
    left join T_HR_ATS_WorkCalendar w on w.fid=item.FCALENDARGROUPID
    WHERE
        item.FDate BETWEEN #{startDate}
        AND #{endDate}
        AND w.FISDEFAULT=1
   </select>
    <select id="selectWorkCalendarV2" parameterType="String" resultType="java.util.Map">
        SELECT
            item.fid,
            CONVERT(varchar(20) , item.FDate, 120 ) as FDate,
            CAST (item.FDayType as varchar) as dateType,
            item.FWEEK
        FROM
            T_HR_ATS_WorkCalendarItem item
                left join T_HR_ATS_WorkCalendar w on w.fid=item.FCALENDARGROUPID
        WHERE
            item.FDate BETWEEN #{startDate}
                AND #{endDate}
          AND w.FISDEFAULT=1
    </select>
    <select id="getWorkCalendar" parameterType="String" resultType="java.util.Map">
        SELECT
            item.fid,
            CONVERT(varchar(20) , item.FDate, 120 ) FDate,
            CAST (item.FDayType as varchar) dateType,
            item.FWEEK
        FROM
            T_HR_ATS_WorkCalendarItem item
            left join T_HR_ATS_WorkCalendar w on w.fid=item.FCALENDARGROUPID
        WHERE
            item.FDate = #{calDate}
          and w.FISDEFAULT=1
    </select>
    <select id="getWorkDay" parameterType="String" resultType="java.util.Map">
        SELECT
        count(*) dayLen,
        item.FDayType
        FROM
        T_HR_ATS_WorkCalendarItem item
        left join T_HR_ATS_WorkCalendar w on w.fid=item.FCALENDARGROUPID
        WHERE
        item.FDate &lt;=#{endDate}
        and item.FDate &gt;=#{startDate}
        and w.FISDEFAULT=1
        group by item.FDayType
    </select>

</mapper>