<?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.ruoyi.oa.mapper.SysOaHolidayMapper">

    <resultMap type="com.ruoyi.oa.domain.SysOaHoliday" id="SysOaHolidayResult">
        <result property="holidayId" column="holiday_id"/>
        <result property="type" column="type"/>
        <result property="holidayTime" column="holiday_time"/>
        <result property="name" column="name"/>
        <result property="createTime" column="create_time"/>
        <result property="createBy" column="create_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="remark" column="remark"/>
        <result property="delFlag" column="del_flag"/>
    </resultMap>

    <resultMap type="com.ruoyi.oa.domain.vo.SysHolidayVo" id="SysOaHolidayVoResult">
        <result property="holidayType" column="type"/>
        <result property="holidayName" column="name"/>
        <collection property="holidayVoList" ofType="com.ruoyi.oa.domain.SysOaHoliday">
            <result property="holidayTime" column="holiday_time"/>
        </collection>
    </resultMap>



    <select id="queryVoList" resultMap="SysOaHolidayVoResult">
        SELECT
            soh.name,
            soh.type,
            soh.holiday_time
        FROM sys_oa_holiday soh
        where soh.type !='0'
        ORDER BY soh.name, soh.type,soh.holiday_time
    </select>


    <select id="queryWorkDayNumByMonth" resultType="java.lang.Long">
        SELECT
            count(*)
        FROM sys_oa_holiday soh
        where (soh.type ='0' or soh.type ='3')
          and YEAR(#{payTime}) = YEAR(soh.holiday_time)
          and MONTH(#{payTime}) = MONTH(soh.holiday_time)
    </select>


</mapper>
