<?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.repair.mapper.RepairNoticeSettingMapper">

    <resultMap type="com.repair.model.vo.NoticePageVo" id="repairNoticePageMap">
        <result property="id" column="id"/>
        <result property="content" column="content"/>
        <result property="userName" column="username"/>
        <result property="updateTime" column="update_time"/>
        <result property="isTop" column="is_top"/>
    </resultMap>

    <select id="queryNoticePageList" resultType="com.repair.model.vo.NoticePageVo" resultMap="repairNoticePageMap">
        SELECT rns.id,rns.content,ra.username,rns.create_time update_time,rns.is_top FROM repair_notice_setting rns
        left join repair_admin ra on ra.id = rns.update_user and ra.deleted = 0
        <where>
            and rns.deleted =0
            <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
                and rns.update_time BETWEEN #{startTime} and #{endTime}
            </if>
        </where>
        order by rns.create_time desc
    </select>
</mapper>
