HolidaysMapper.xml 1.69 KB
<?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.lframework.xingyun.sc.mappers.HolidaysMapper">

    <resultMap id="Holidays" type="com.lframework.xingyun.sc.entity.Holidays">
        <id column="id" property="id"/>
        <result column="year" property="year"/>
        <result column="holiday_date" property="holidayDate"/>
        <result column="rest" property="rest"/>
        <result column="holiday_name" property="holidayName"/>
        <result column="create_by_id" property="createById"/>
        <result column="create_by" property="createBy"/>
        <result column="update_by_id" property="updateById"/>
        <result column="update_by" property="updateBy"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
    </resultMap>

    <sql id="Holidays_sql">
        SELECT tb.id,
               tb.year,
               tb.holiday_date,
               tb.rest,
               tb.holiday_name,
               tb.create_by_id,
               tb.create_by,
               tb.update_by_id,
               tb.update_by,
               tb.create_time,
               tb.update_time
        FROM tbl_holidays AS tb
    </sql>

    <select id="query" resultMap="Holidays">
        <include refid="Holidays_sql"/>
        <where>
            <if test="vo.year != null">
                AND tb.year = #{vo.year}
            </if>
            <if test="vo.holidayDate != null">
                AND tb.holiday_date = #{vo.holidayDate}
            </if>
        </where>
        order by tb.year,tb.holiday_date
    </select>
</mapper>