<?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.community.huiju.dao.HotelRoomMapper">
    <select id="hotelRoomLiset" resultType="com.community.huiju.model.HotelRoom">
        select
        *
        from tp_hotel_room
        <where>
            <if test="hotelRoom.roomNo !=null and hotelRoom.roomNo !=''">
                AND  room_no like concat('%',#{hotelRoom.roomNo},'%')
            </if>
            <if test="hotelRoom.roomName !=null and hotelRoom.roomName !=''">
                AND  room_name like concat('%',#{hotelRoom.roomName},'%')
            </if>
            <if test="hotelRoom.price !=null and hotelRoom.price !=''">
                AND price = #{hotelRoom.price}
            </if>
            <if test="hotelRoom.roomStatus !=null and hotelRoom.roomStatus !=''">
                AND room_status = #{hotelRoom.roomStatus}
            </if>
            <if test="beginTime !=null  and endTime !=null ">
                AND date_format(create_date, '%Y-%m-%d') <![CDATA[>= ]]> date_format(#{beginTime}, '%Y-%m-%d')
                AND date_format(create_date, '%Y-%m-%d')<![CDATA[<= ]]> date_format(#{endTime}, '%Y-%m-%d')
            </if>
            and community_id = #{communityId}
        </where>
        order by sort desc,update_date desc
    </select>

</mapper>
