|
|
@@ -124,4 +124,79 @@ cus.id as customer_id,cus.`name` as customer_name,lo.arrival_time,lo.due_out_tim
|
|
|
where l.hotel_id = #{hotelId}
|
|
|
group by l.id
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="getRiliFangTai" resultType="org.jeecg.modules.business.vo.RiLiFangTaiVo">
|
|
|
+ select * from
|
|
|
+ (
|
|
|
+ select lo.id as order_id,
|
|
|
+ lo.arrival_time,lo.due_out_time, l.market_price,l.`name` as layout_name,
|
|
|
+ r.id as room_id,b.id as floor_id,cus.`name` as customer_name, cus.phone as customer_phone,
|
|
|
+ sum(if(fee.fee_type = 1,fee.money,0)) as xiaofei,
|
|
|
+ sum(if(fee.fee_type = 2 and fee.subject_type != 1,fee.money,0)) as yushou,
|
|
|
+ sum(if(fee.fee_type = 2 and fee.subject_type = 1,fee.money,0)) as yajin,
|
|
|
+ (sum(if(fee.fee_type = 2 and fee.subject_type != 1,fee.money,0))
|
|
|
+ +
|
|
|
+ sum(if(fee.fee_type = 2 and fee.subject_type = 1,fee.money,0))
|
|
|
+ -
|
|
|
+ sum(if(fee.fee_type = 1,fee.money,0))
|
|
|
+ ) as yu_e,
|
|
|
+ 1 as is_living ,
|
|
|
+ ifNULL(lo.settle_type,-1) as settle_type
|
|
|
+ from
|
|
|
+ ces_room_building_floor b inner join
|
|
|
+ ces_room_building_floor b1 on b.parent_id = b1.id
|
|
|
+ inner join ces_rooms r on b.id = r.floor_id and r.invalid = 0
|
|
|
+ inner join ces_room_layout l on l.id = r.layout_id
|
|
|
+ inner join bus_booking_rooms br
|
|
|
+
|
|
|
+ on br.room_id= r.id
|
|
|
+ inner join bus_rooms_living_order lo
|
|
|
+ on br.id = lo.booking_room_id
|
|
|
+ inner join bus_order_fee fee
|
|
|
+ on fee.living_order_id = lo.id
|
|
|
+ inner join bus_customer cus
|
|
|
+ on cus.id = lo.contact_id
|
|
|
+ where
|
|
|
+ r.hotel_id = #{hotelId}
|
|
|
+ and ((lo.arrival_time >= #{start} and lo.arrival_time <=#{end}) or
|
|
|
+ (lo.due_out_time >= #{start} and lo.due_out_time <=#{end}))
|
|
|
+ GROUP BY lo.id,r.id
|
|
|
+
|
|
|
+ union all
|
|
|
+
|
|
|
+ select lo.id as order_id,
|
|
|
+ lo.arrival_time,lo.due_out_time, l.market_price,l.`name` as layout_name,
|
|
|
+ r.id as room_id,b.id as floor_id,cus.`name` as customer_name, cus.phone as customer_phone,
|
|
|
+ 0 as xiaofei,
|
|
|
+ 0 as yushou,
|
|
|
+ 0 as yajin,
|
|
|
+ 0 as yu_e,
|
|
|
+ 0 as is_living ,
|
|
|
+ -2 as settle_type
|
|
|
+ from
|
|
|
+ ces_room_building_floor b inner join
|
|
|
+ ces_room_building_floor b1 on b.parent_id = b1.id
|
|
|
+ inner join ces_rooms r on b.id = r.floor_id and r.invalid = 0
|
|
|
+ inner join ces_room_layout l on l.id = r.layout_id
|
|
|
+ inner join bus_booking_rooms br
|
|
|
+
|
|
|
+ on br.room_id= r.id
|
|
|
+ and br.id not in (
|
|
|
+ select booking_room_id from bus_rooms_living_order
|
|
|
+ )
|
|
|
+ inner join bus_room_booking_orders lo
|
|
|
+ on br.booking_orders_id = lo.id
|
|
|
+ inner join bus_customer cus
|
|
|
+ on cus.id = lo.contact_id
|
|
|
+ where
|
|
|
+ r.hotel_id = #{hotelId}
|
|
|
+ and ((lo.arrival_time >= #{start} and lo.arrival_time <=#{end}) or
|
|
|
+ (lo.due_out_time >= #{start} and lo.due_out_time <=#{end}))
|
|
|
+
|
|
|
+ GROUP BY lo.id,r.id
|
|
|
+
|
|
|
+
|
|
|
+ ) as t
|
|
|
+ order by t.is_living, t.order_id desc
|
|
|
+ </select>
|
|
|
</mapper>
|