<?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="cn.wisenergy.mapper.WorkHolidayMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="cn.wisenergy.model.app.WorkHoliday">
        <id column="id" property="id" />
        <result column="day_start" property="dayStart" />
        <result column="day_end" property="dayEnd" />
        <result column="day_type" property="dayType" />
        <result column="des" property="des" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, day_start, day_end, day_type, des
    </sql>

    <sql id="table" >
        work_holiday
    </sql>

    <select id="getByDate" resultMap="BaseResultMap">
        select <include refid="Base_Column_List"/>
        from <include refid="table"/>
        where (year(day_start) = year(#{startDay}) AND month(day_start) = month(#{startDay})) OR
        (year(day_end) = year(#{endDay}) AND month(day_end) = month(#{endDay}))
    </select>

</mapper>
