|
|
@@ -199,4 +199,104 @@ cus.id as customer_id,cus.`name` as customer_name,lo.arrival_time,lo.due_out_tim
|
|
|
) as t
|
|
|
order by t.is_living, t.order_id desc
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="getKeLiLiving" resultType="org.jeecg.modules.business.vo.KeLiItemVo">
|
|
|
+ select
|
|
|
+ o.id,
|
|
|
+ o.living_order_no as oder_no,
|
|
|
+ cus.`name` as customer_name,
|
|
|
+ cus.phone as customer_phone,
|
|
|
+ o.customer_type,
|
|
|
+ o.living_type as o_type,
|
|
|
+ l.`name` as layout_name,
|
|
|
+ concat(IFNULL(r.prefix,''),r.`name`) as room_name,
|
|
|
+ o.arrival_time,
|
|
|
+ o.due_out_time,
|
|
|
+ 1 as is_living,
|
|
|
+ sum(if(fee.fee_type = 2 ,fee.money,0)) as yushou,
|
|
|
+ (
|
|
|
+ sum(if(fee.fee_type = 2 ,fee.money,0))
|
|
|
+ -
|
|
|
+ sum(if(fee.fee_type = 1,fee.money,0))
|
|
|
+ ) as yu_e
|
|
|
+
|
|
|
+ from bus_rooms_living_order o
|
|
|
+ inner join bus_customer cus
|
|
|
+ on o.contact_id = cus.id
|
|
|
+ inner join bus_order_fee fee
|
|
|
+ on fee.living_order_id = o.id
|
|
|
+ inner join bus_booking_rooms br
|
|
|
+ on br.id = o.booking_room_id
|
|
|
+ inner join ces_rooms r
|
|
|
+ on r.id = br.room_id
|
|
|
+ inner join ces_room_layout l
|
|
|
+ on l.id = r.layout_id
|
|
|
+ where o.hotel_id = #{hotelId}
|
|
|
+ <if test="status != 4">
|
|
|
+ and o.settle_type = #{status}
|
|
|
+ </if>
|
|
|
+ <if test="status == 4">
|
|
|
+ -- 联防退房
|
|
|
+ and (o.settle_type = 1 or o.settle_type = 2)
|
|
|
+ and is_union_settled = 1
|
|
|
+ </if>
|
|
|
+ <if test="keyw != null and keyw != ''" >
|
|
|
+ and (
|
|
|
+ cus.`name` like '%#{keyw}%' or cus.phone like '%#{keyw}%' or o.living_order_no like '%#{keyw}%'
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ GROUP BY o.id
|
|
|
+ </select>
|
|
|
+ <select id="getKeBooking" resultType="org.jeecg.modules.business.vo.KeLiItemVo" >
|
|
|
+ select
|
|
|
+ o.id,
|
|
|
+ l.id as layout_id,
|
|
|
+ o.booking_orders_no as order_no,
|
|
|
+ cus.`name` as customer_name,
|
|
|
+ cus.phone as customer_phone,
|
|
|
+ o.customer_type,
|
|
|
+ o.booking_type as o_type,
|
|
|
+ l.`name` as layout_name,
|
|
|
+ concat(IFNULL(r.prefix,''),r.`name`) as room_name,
|
|
|
+ o.arrival_time,
|
|
|
+ o.due_out_time,
|
|
|
+ 0 as is_living,
|
|
|
+ 0 as yushou,
|
|
|
+ 0 as yu_e
|
|
|
+ from bus_room_booking_orders o
|
|
|
+ inner join bus_booking_rooms br
|
|
|
+ on o.id = br.booking_orders_id
|
|
|
+ and br.id
|
|
|
+ <if test="status == 1">
|
|
|
+ not
|
|
|
+ </if>
|
|
|
+ in (
|
|
|
+ select booking_room_id from bus_rooms_living_order
|
|
|
+ )
|
|
|
+ left join ces_rooms r
|
|
|
+ on r.id = br.room_id and r.hotel_id = #{hotelId}
|
|
|
+ left join ces_room_layout l
|
|
|
+ on l.id = r.layout_id
|
|
|
+ inner join bus_customer cus
|
|
|
+ on cus.id = o.contact_id
|
|
|
+ where 1 = 1
|
|
|
+ <if test="status == 1 or status == 2">
|
|
|
+ and o.booking_status = 1
|
|
|
+ </if>
|
|
|
+ <if test="status == 3">
|
|
|
+ and o.booking_status = 2
|
|
|
+ </if>
|
|
|
+ <if test="status==1">
|
|
|
+ -- 预定中
|
|
|
+ and (
|
|
|
+ o.due_out_time >= now()
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="keyw != null and keyw != ''" >
|
|
|
+ and (
|
|
|
+ cus.`name` like '%#{keyw}%' or cus.phone like '%#{keyw}%' or o.booking_order_no like '%#{keyw}%'
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ GROUP BY o.id,r.id
|
|
|
+ </select>
|
|
|
</mapper>
|