| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?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.chuanghai.ihotel.dao.RoomRealtimeStatuDao">
- <!-- 可根据自己的需求,是否要使用 -->
- <resultMap type="com.chuanghai.ihotel.entity.RoomRealtimeStatuEntity" id="roomRealtimeStatuMap">
- <result property="id" column="id"/>
- <result property="roomId" column="room_id"/>
- <result property="roomTypeId" column="room_type_id"/>
- <result property="startTime" column="start_time"/>
- <result property="endTime" column="end_time"/>
- <result property="statu" column="statu"/>
- <result property="remark" column="remark"/>
- <result property="bizId" column="biz_id"/>
- </resultMap>
- <select id="getBusyNum" resultType="int">
- select count(1)
- from room_realtime_statu
- where
- room_type_id = #{roomTypeId}
- and statu != '1'
- and not(end_time <![CDATA[<]]> #{startTime} or start_time <![CDATA[>]]> #{endTime})
- </select>
- <!-- 查询指定时间段内处于繁忙状态的房间id -->
- <select id="getBusyRoomId" resultType="java.lang.Long">
- select room_id
- from room_realtime_statu
- where
- room_type_id = #{roomTypeId}
- and statu != '1'
- and not(end_time <![CDATA[<]]> #{startTime} or start_time <![CDATA[>]]> #{endTime})
- </select>
- <!-- <select id="getByRoomIdsAndTime" resultMap="roomRealtimeStatuMap">-->
- <!-- select *-->
- <!-- from room_realtime_statu-->
- <!-- where-->
- <!-- (statu = '4')-->
- <!-- or-->
- <!-- (-->
- <!-- (statu != '1' and statu != '4')-->
- <!-- and room_id in-->
- <!-- <foreach collection="roomIds" item="item" open="(" close=")" index="i" separator=","> #{item}-->
- <!-- </foreach>-->
- <!-- and not(end_time <![CDATA[<]]> #{startTime} or start_time <![CDATA[>]]> #{endTime})-->
- <!-- )-->
- <!-- ORDER BY id DESC-->
- <!-- LIMIT 1-->
- <!-- </select>-->
- <select id="getByRoomIdsAndTime" resultMap="roomRealtimeStatuMap">
- select *
- from room_realtime_statu
- where
- statu != '1' and room_id in
- <foreach collection="roomIds" item="item" open="(" close=")" index="i" separator=","> #{item}
- </foreach>
- and (NOT(end_time <![CDATA[<]]> #{startTime} OR start_time <![CDATA[>]]> #{endTime}) OR (start_time <![CDATA[>=]]> #{startTime} AND start_time <![CDATA[<]]> #{endTime}))
- </select>
- <!-- 查询当前时间段内房间状态 -->
- <select id="getByRoomIdAndTime" resultMap="roomRealtimeStatuMap">
- select *
- from room_realtime_statu
- where
- room_id = #{roomId}
- and not(end_time <![CDATA[<]]> #{startTime} or start_time <![CDATA[>]]> #{endTime})
- ORDER BY id DESC
- limit 1
- </select>
- </mapper>
|