HotelMapper.xml 2.4 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.sibu.orderHelper.hotel.dao.HotelDao">
    
    <select id="listHotel" resultMap="listHotelResponse"  parameterType="map">
    	SELECT
			ho.hotel_id,ho.hotel_name,ho.short_name,ho.thumb_url,ho.sort_index 
		FROM
			hotel ho
		WHERE
			ho.is_show = 1 and ho.is_delete = 1
		ORDER BY 
			ho.sort_index asc
		LIMIT 0,30
    </select>
    <resultMap type="com.sibu.orderHelper.hotel.response.HotelListResponse" id="listHotelResponse">
        <id column="hotel_id" property="hotelId" />
        <result column="hotel_name" property="hotelName" />
        <result column="short_name" property="shortName" />
        <result column="thumb_url" property="thumbUrl" />
        <result column="sort_index" property="sortIndex" />
    </resultMap>
    
    <!-- 酒店详情 -->
    <select id="getHotelDetail" resultMap="hotelDetailResponse" parameterType="map">
    	SELECT
			ho.* 
		FROM
			hotel ho
		WHERE ho.hotel_id = #{hotelId}
    </select>
    <select id="getHotelBySubOrderId" resultMap="hotelDetailResponse" parameterType="map">
    	select * from hotel where hotel_id = (select hotel_id from room_type where room_id = 
    	(select room_id from room_order_detail where sub_order_id = #{subOrderId}))
    </select>
    <resultMap type="com.sibu.orderHelper.hotel.response.HotelDetailResponse" id="hotelDetailResponse">
        <id column="hotel_id" property="hotelId" />
        <result column="hotel_name" property="hotelName" />
        <result column="open_time" property="openTime" />
        <result column="hotel_star" property="hotelStar" />
        <result column="hotel_address" property="hotelAddress" />
        <result column="hotel_telphone" property="hotelTelphone" />
        <result column="check_in_time" property="checkInTime" />
        <result column="check_out_time" property="checkOutTime" />
        <result column="intro" property="intro" />
        <result column="room_equipment" property="roomEquipment" />
        <result column="hotel_service" property="hotelService" />
        <result column="short_name" property="shortName" />
    </resultMap>
    
    <!-- 酒店图片 -->
    <select id="listHotelImage" resultType="String" parameterType="map">
    	select image_url from hotel_image where hotel_id = #{hotelId} 
    </select>
</mapper>