240 lines
8.4 KiB
XML
240 lines
8.4 KiB
XML
<?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.zhwl.hotel.homestay.mapper.ZdyHotelHomestayRoomStatusMapper">
|
|
|
|
<resultMap type="ZdyHotelHomestayRoomStatus" id="ZdyHotelHomestayRoomStatusResult">
|
|
<result property="id" column="id"/>
|
|
<result property="roomId" column="room_id"/>
|
|
<result property="status" column="status"/>
|
|
<result property="startTime" column="start_time"/>
|
|
<result property="endTime" column="end_time"/>
|
|
</resultMap>
|
|
|
|
|
|
<resultMap type="ZdyHotelHomestayRoomStatusVO" id="ZdyHotelHomestayRoomStatusVOResult">
|
|
<result property="roomStatusId" column="room_status_id"/>
|
|
<result property="roomId" column="room_id"/>
|
|
<result property="roomClassifyId" column="room_classify_id"/>
|
|
<result property="status" column="status"/>
|
|
<result property="label" column="label"/>
|
|
<result property="number" column="number"/>
|
|
<result property="level1Name" column="level1_name"/>
|
|
<result property="level2Name" column="level2_name"/>
|
|
<result property="startTime" column="start_time"/>
|
|
<result property="endTime" column="end_time"/>
|
|
</resultMap>
|
|
|
|
<sql id="selectZdyHotelHomestayRoomStatusVo">
|
|
select id, room_id, status, start_time, end_time
|
|
from zdy_hotel_homestay_room_status
|
|
</sql>
|
|
|
|
<select id="selectZdyHotelHomestayRoomStatusList"
|
|
parameterType="com.zhwl.hotel.homestay.domain.dto.ZdyHotelHomestayRoomStatusQueryDTO"
|
|
resultMap="ZdyHotelHomestayRoomStatusVOResult">
|
|
select
|
|
rs.id room_status_id,
|
|
rs.start_time,
|
|
rs.end_time,
|
|
r.id room_id,
|
|
r.hotel_homestay_room_classify_id room_classify_id,
|
|
r.number,
|
|
r.label,
|
|
case
|
|
when rs.status is null then 1
|
|
else rs.status end status,
|
|
rc.level1_name,
|
|
rc.level2_name
|
|
from zdy_hotel_homestay_room r
|
|
left join zdy_hotel_homestay_room_status rs on r.id = rs.room_id
|
|
left join zdy_hotel_homestay_room_classify rc
|
|
on r.dept_id = rc.dept_id
|
|
and r.hotel_homestay_id = rc.hotel_homestay_id
|
|
and r.hotel_homestay_room_classify_id = rc.id
|
|
<where>
|
|
r.del_flag = '0'
|
|
<if test="hotelHomestayRoomClassifyId != null ">
|
|
and rc.id = #{hotelHomestayRoomClassifyId}
|
|
</if>
|
|
<if test="floor != null and floor !=''">
|
|
and rc.floor = #{floor}
|
|
</if>
|
|
<if test="label != null">
|
|
and r.label = #{label}
|
|
</if>
|
|
and
|
|
<![CDATA[
|
|
(
|
|
(start_time <= #{params.startTime}
|
|
and
|
|
end_time >= #{params.endTime})
|
|
or
|
|
(start_time >= #{params.startTime}
|
|
and
|
|
end_time <= #{params.endTime})
|
|
or
|
|
(start_time <= #{params.startTime}
|
|
and
|
|
end_time >= #{params.startTime})
|
|
or
|
|
(start_time <= #{params.endTime}
|
|
and
|
|
end_time >= #{params.endTime})
|
|
)
|
|
]]>
|
|
${params.dataScope}
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectZdyHotelHomestayRoomStatusList2"
|
|
parameterType="com.zhwl.hotel.homestay.domain.dto.ZdyHotelHomestayRoomStatusQueryDTO"
|
|
resultMap="ZdyHotelHomestayRoomStatusVOResult">
|
|
select
|
|
rs.id room_status_id,
|
|
rs.start_time,
|
|
rs.end_time,
|
|
r.id room_id,
|
|
r.number,
|
|
rs.status,
|
|
r.label,
|
|
rc.level1_name,
|
|
rc.level2_name
|
|
from zdy_hotel_homestay_room r
|
|
left join zdy_hotel_homestay_room_status rs on r.id = rs.room_id
|
|
left join zdy_hotel_homestay_room_classify rc
|
|
on r.dept_id = rc.dept_id
|
|
and r.hotel_homestay_id = rc.hotel_homestay_id
|
|
and r.hotel_homestay_room_classify_id = rc.id
|
|
<where>
|
|
r.del_flag = '0'
|
|
<if test="hotelHomestayRoomClassifyId != null ">
|
|
and rc.id = #{hotelHomestayRoomClassifyId}
|
|
</if>
|
|
<if test="floor != null and floor !='' ">
|
|
and rc.floor = #{floor}
|
|
</if>
|
|
<if test="label != null">
|
|
and r.label = #{label}
|
|
</if>
|
|
and (
|
|
(rs.status = 2 and rs.start_time >= #{params.endTime})
|
|
or rs.end_time <= #{params.startTime}
|
|
)
|
|
${params.dataScope}
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectZdyHotelHomestayRoomStatusById" parameterType="Long"
|
|
resultMap="ZdyHotelHomestayRoomStatusResult">
|
|
<include refid="selectZdyHotelHomestayRoomStatusVo"/>
|
|
where id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertZdyHotelHomestayRoomStatus" parameterType="ZdyHotelHomestayRoomStatus" useGeneratedKeys="true"
|
|
keyProperty="id">
|
|
insert into zdy_hotel_homestay_room_status
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="roomId != null">room_id,
|
|
</if>
|
|
<if test="status != null">status,
|
|
</if>
|
|
<if test="startTime != null">start_time,
|
|
</if>
|
|
<if test="endTime != null">end_time,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="roomId != null">#{roomId},
|
|
</if>
|
|
<if test="status != null">#{status},
|
|
</if>
|
|
<if test="startTime != null">#{startTime},
|
|
</if>
|
|
<if test="endTime != null">#{endTime},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateZdyHotelHomestayRoomStatus" parameterType="ZdyHotelHomestayRoomStatus">
|
|
update zdy_hotel_homestay_room_status
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="roomId != null">room_id =
|
|
#{roomId},
|
|
</if>
|
|
<if test="status != null">status =
|
|
#{status},
|
|
</if>
|
|
<if test="startTime != null">start_time =
|
|
#{startTime},
|
|
</if>
|
|
<if test="endTime != null">end_time =
|
|
#{endTime},
|
|
</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteZdyHotelHomestayRoomStatusById" parameterType="Long">
|
|
delete
|
|
from zdy_hotel_homestay_room_status
|
|
where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteZdyHotelHomestayRoomStatusByIds" parameterType="String">
|
|
delete from zdy_hotel_homestay_room_status where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<select id="statusList" resultMap="ZdyHotelHomestayRoomStatusVOResult">
|
|
select r.id room_id,
|
|
rs.id room_status_id,
|
|
rs.status,
|
|
rs.start_time,
|
|
rs.end_time
|
|
from zdy_hotel_homestay_room r
|
|
left join zdy_hotel_homestay_room_status rs on r.id = rs.room_id
|
|
where r.del_flag = '0'
|
|
and
|
|
<![CDATA[
|
|
(
|
|
(start_time <= #{params.startTime}
|
|
and
|
|
end_time >= #{params.endTime})
|
|
or
|
|
(start_time >= #{params.startTime}
|
|
and
|
|
end_time <= #{params.endTime})
|
|
or
|
|
(start_time <= #{params.startTime}
|
|
and
|
|
end_time >= #{params.startTime})
|
|
or
|
|
(start_time <= #{params.endTime}
|
|
and
|
|
end_time >= #{params.endTime})
|
|
) ]]>
|
|
${params.dataScope}
|
|
</select>
|
|
|
|
<select id="labelList" resultType="com.zhwl.hotel.homestay.domain.vo.RoomLabelQuantityVO">
|
|
select count(r.id) quantity,
|
|
r.label
|
|
from zdy_hotel_homestay_room r
|
|
where r.del_flag = '0'
|
|
and r.label is not null
|
|
${params.dataScope}
|
|
group by r.label
|
|
</select>
|
|
|
|
<select id="updateRoomStatusByIds">
|
|
update zdy_hotel_homestay_room_status set status = #{status}
|
|
where id in
|
|
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</select>
|
|
</mapper> |