<?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="org.dromara.system.mapper.RoomMapper">

    <resultMap type="org.dromara.system.domain.vo.RoomVo" id="RoomResult">
    </resultMap>

    <select id="selectListByRoomBo" resultType="org.dromara.system.domain.vo.RoomVo">
        SELECT
            distinct r.room_id,
            r.room_name,
            r.room_title,
            r.room_desc,
            r.is_hot,
            r.direction,
            r.room_size,
            r.floor_num,
            rr.type_id,
            rr.region_name,
            s.oss_id,
            s.url,
            s.file_name
        FROM
            room r
                 JOIN room_region rr ON r.room_id = rr.room_id
                 JOIN img_type i ON i.type_id = r.room_id
                 JOIN sys_img s ON i.img_id = s.oss_id
        WHERE
          i.type_c = '1'
          AND s.img_type = '1'
        <if test="bo.roomId != null and bo.roomId != ''">
            and r.room_id = #{roomId}
        </if>
        <if test="bo.roomName != null and bo.roomName != ''">
            and r.room_name = #{roomName})
        </if>
        <if test="bo.roomTitle != null and bo.roomTitle != ''">
            and r.room_title = #{roomTitle})
        </if>
        <if test="bo.isHot != null and bo.isHot != ''">
            and r.is_hot = #{isHot})
        </if>
        <if test="bo.floorNum != null and bo.floorNum != ''">
            and r.floor_num = #{floorNum})
        </if>
        <if test="bo.floorNum != null and fbo.loorNum != ''">
            and r.floor_num = #{floorNum})
        </if>
<!--        <if test="bo.regionName != null and bo.regionName != ''">-->
<!--            and rr.region_name = #{regionName})-->
<!--        </if>-->
    </select>

    <select id="selectListByRoomBoByCommunityId" parameterType="list" resultMap="RoomResult">
        SELECT
            r.*
        FROM
                room r
        WHERE
            r.room_id in
        <foreach item="item" collection="list" open="(" separator="," close=")">
            #{item}
        </foreach>
    </select>

</mapper>
