|
@@ -107,8 +107,8 @@
|
|
|
|
|
|
|
|
select l.id as layout_id,l.`name` as layoutName,DATE_FORMAT(lo.arrival_time,'%Y-%m-%d') as enter_date,DATE_FORMAT(lo.due_out_time,'%Y-%m-%d') as leave_date ,lo.settle_type,
|
|
select l.id as layout_id,l.`name` as layoutName,DATE_FORMAT(lo.arrival_time,'%Y-%m-%d') as enter_date,DATE_FORMAT(lo.due_out_time,'%Y-%m-%d') as leave_date ,lo.settle_type,
|
|
|
r.id as room_id,(r.`name`) as room_name, lo.id as living_id, living_order_no as order_no,1 as is_living,lo.contact_id,
|
|
r.id as room_id,(r.`name`) as room_name, lo.id as living_id, living_order_no as order_no,1 as is_living,lo.contact_id,
|
|
|
-cus.id as customer_id,cus.`name` as customer_name,lo.arrival_time,lo.due_out_time,
|
|
|
|
|
-lo.booking_order_id
|
|
|
|
|
|
|
+ cus.id as customer_id,cus.`name` as customer_name,lo.arrival_time,lo.due_out_time,
|
|
|
|
|
+ lo.booking_order_id
|
|
|
from bus_booking_rooms br inner join bus_rooms_living_order lo
|
|
from bus_booking_rooms br inner join bus_rooms_living_order lo
|
|
|
on br.id = lo.booking_room_id inner join ces_rooms r
|
|
on br.id = lo.booking_room_id inner join ces_rooms r
|
|
|
on r.id = br.room_id
|
|
on r.id = br.room_id
|
|
@@ -231,74 +231,82 @@ lo.booking_order_id
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="getKeLiLiving" resultType="org.jeecg.modules.business.vo.KeLiItemVo">
|
|
<select id="getKeLiLiving" resultType="org.jeecg.modules.business.vo.KeLiItemVo">
|
|
|
- select
|
|
|
|
|
- o.id,
|
|
|
|
|
- o.living_order_no as order_no,
|
|
|
|
|
- o.booking_order_id,
|
|
|
|
|
- cus.`name` as customer_name,
|
|
|
|
|
- cus.phone as customer_phone,
|
|
|
|
|
- o.customer_type,
|
|
|
|
|
- o.living_type as o_type,
|
|
|
|
|
- o.settle_type as settle_type,
|
|
|
|
|
- l.`name` as layout_name,
|
|
|
|
|
- r.id as room_id,
|
|
|
|
|
- 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
|
|
|
|
|
|
|
+ select * from (
|
|
|
|
|
+ select
|
|
|
|
|
+ o.id,
|
|
|
|
|
+ o.living_order_no as order_no,
|
|
|
|
|
+ o.booking_order_id,
|
|
|
|
|
+ cus.`name` as customer_name,
|
|
|
|
|
+ cus.phone as customer_phone,
|
|
|
|
|
+ o.customer_source,
|
|
|
|
|
+ o.customer_type,
|
|
|
|
|
+ o.living_type as o_type,
|
|
|
|
|
+ o.settle_type as settle_type,
|
|
|
|
|
+ l.`name` as layout_name,
|
|
|
|
|
+ r.id as room_id,
|
|
|
|
|
+ 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="thirdUserId != null and thirdUserId != ''">
|
|
|
|
|
- and o.third_login_user_id = #{thirdUserId}
|
|
|
|
|
- </if>
|
|
|
|
|
- <if test="customerType != null and customerType != ''">
|
|
|
|
|
- and o.customer_type = #{customerType}
|
|
|
|
|
- </if>
|
|
|
|
|
- <if test="layoutId != null and layoutId != ''">
|
|
|
|
|
- and l.id = #{layoutId}
|
|
|
|
|
- </if>
|
|
|
|
|
- /*正常入住 -1 已结: 1 先走未结: 2 联房退房: 3*/
|
|
|
|
|
- /*-1,"正常入住" 1,"结账退房" 2,"未结退房"*/
|
|
|
|
|
- <if test="status == -1 or status == 1 or status == 2">
|
|
|
|
|
- and o.settle_type = #{status}
|
|
|
|
|
- </if>
|
|
|
|
|
-<!-- <if test="status == 2">-->
|
|
|
|
|
-<!-- and br.is_main = 1-->
|
|
|
|
|
-<!-- </if>-->
|
|
|
|
|
-<!-- <if test="status == 3">-->
|
|
|
|
|
-<!-- -- 联防退房-->
|
|
|
|
|
-<!-- 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>
|
|
|
|
|
- <if test="startTime != null">
|
|
|
|
|
- and o.arrival_time >= #{startTime}
|
|
|
|
|
- </if>
|
|
|
|
|
- <if test="endTime != null">
|
|
|
|
|
- and o.arrival_time <= #{endTime}
|
|
|
|
|
|
|
+ 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 = #{kedanOrderDto.hotelId}
|
|
|
|
|
+ <if test="kedanOrderDto.thirdUserId != null and kedanOrderDto.thirdUserId != ''">
|
|
|
|
|
+ and o.third_login_user_id = #{kedanOrderDto.thirdUserId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="kedanOrderDto.livingType != null">
|
|
|
|
|
+ and o.living_type = #{kedanOrderDto.livingType}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="kedanOrderDto.customerSource != null and kedanOrderDto.customerSource != ''">
|
|
|
|
|
+ and o.customer_source = #{kedanOrderDto.customerSource}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="kedanOrderDto.customerType != null">
|
|
|
|
|
+ and o.customer_type = #{kedanOrderDto.customerType}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="kedanOrderDto.layoutId != null and kedanOrderDto.layoutId != ''">
|
|
|
|
|
+ and l.id = #{kedanOrderDto.layoutId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ /*正常入住 -1 已结: 1 先走未结: 2 联房退房: 3*/
|
|
|
|
|
+ /*-1,"正常入住" 1,"结账退房" 2,"未结退房"*/
|
|
|
|
|
+ <if test="kedanOrderDto.livingStatus == -1 or kedanOrderDto.livingStatus == 1 or kedanOrderDto.livingStatus == 2">
|
|
|
|
|
+ and o.settle_type = #{kedanOrderDto.livingStatus}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <!-- <if test="status == 2">-->
|
|
|
|
|
+ <!-- and br.is_main = 1-->
|
|
|
|
|
+ <!-- </if>-->
|
|
|
|
|
+ <!-- <if test="status == 3">-->
|
|
|
|
|
+ <!-- -- 联防退房-->
|
|
|
|
|
+ <!-- and (o.settle_type = 1 or o.settle_type = 2)-->
|
|
|
|
|
+ <!-- and is_union_settled = 1-->
|
|
|
|
|
+ <!-- </if>-->
|
|
|
|
|
+ <if test="kedanOrderDto.keyw != null and kedanOrderDto.keyw != ''" >
|
|
|
|
|
+ and (
|
|
|
|
|
+ cus.`name` like '%${kedanOrderDto.keyw}%' or cus.phone like '%${kedanOrderDto.keyw}%' or o.living_order_no like '%${kedanOrderDto.keyw}%'
|
|
|
|
|
+ )
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="kedanOrderDto.startTime != null">
|
|
|
|
|
+ and o.arrival_time >= #{kedanOrderDto.startTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="kedanOrderDto.endTime != null">
|
|
|
|
|
+ and o.arrival_time <= #{kedanOrderDto.endTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ GROUP BY o.id order by o.create_time desc) c
|
|
|
|
|
+ where 1 = 1
|
|
|
|
|
+ <if test="kedanOrderDto.onlyDebt">
|
|
|
|
|
+ and c.yu_e < 0
|
|
|
</if>
|
|
</if>
|
|
|
- GROUP BY o.id order by o.create_time desc
|
|
|
|
|
</select>
|
|
</select>
|
|
|
<select id="getKeBooking" resultType="org.jeecg.modules.business.vo.KeLiItemVo" >
|
|
<select id="getKeBooking" resultType="org.jeecg.modules.business.vo.KeLiItemVo" >
|
|
|
select
|
|
select
|
|
@@ -323,43 +331,43 @@ lo.booking_order_id
|
|
|
|
|
|
|
|
left join bus_rooms_living_order brlo on br.id = brlo.booking_room_id
|
|
left join bus_rooms_living_order brlo on br.id = brlo.booking_room_id
|
|
|
left join ces_rooms r
|
|
left join ces_rooms r
|
|
|
- on r.id = br.room_id and r.hotel_id = #{hotelId}
|
|
|
|
|
|
|
+ on r.id = br.room_id and r.hotel_id = #{kedanOrderDto.hotelId}
|
|
|
left join ces_room_layout l
|
|
left join ces_room_layout l
|
|
|
on l.id = r.layout_id
|
|
on l.id = r.layout_id
|
|
|
inner join bus_customer cus
|
|
inner join bus_customer cus
|
|
|
on cus.id = o.contact_id
|
|
on cus.id = o.contact_id
|
|
|
where 1 = 1
|
|
where 1 = 1
|
|
|
-- status: 1预定中 2已入住 3已取消 4已失效 5今日应到未到
|
|
-- status: 1预定中 2已入住 3已取消 4已失效 5今日应到未到
|
|
|
- <if test="status == 1 or status == 2 or status == 5">
|
|
|
|
|
|
|
+ <if test="kedanOrderDto.bookingStatus == 1 or kedanOrderDto.bookingStatus == 2 or kedanOrderDto.bookingStatus == 5">
|
|
|
and o.booking_status = 1
|
|
and o.booking_status = 1
|
|
|
</if>
|
|
</if>
|
|
|
- <if test="status == 1">
|
|
|
|
|
|
|
+ <if test="kedanOrderDto.bookingStatus == 1">
|
|
|
and (brlo.id is null or brlo.id = '') and o.due_out_time >= now()
|
|
and (brlo.id is null or brlo.id = '') and o.due_out_time >= now()
|
|
|
</if>
|
|
</if>
|
|
|
- <if test="status == 2">
|
|
|
|
|
|
|
+ <if test="kedanOrderDto.bookingStatus == 2">
|
|
|
and brlo.id is not null and brlo.id != ''
|
|
and brlo.id is not null and brlo.id != ''
|
|
|
</if>
|
|
</if>
|
|
|
- <if test="status == 3">
|
|
|
|
|
|
|
+ <if test="kedanOrderDto.bookingStatus == 3">
|
|
|
and o.booking_status = 2
|
|
and o.booking_status = 2
|
|
|
</if>
|
|
</if>
|
|
|
- <if test="status == 4">
|
|
|
|
|
|
|
+ <if test="kedanOrderDto.bookingStatus == 4">
|
|
|
-- 已失效
|
|
-- 已失效
|
|
|
and o.booking_status = 3
|
|
and o.booking_status = 3
|
|
|
</if>
|
|
</if>
|
|
|
- <if test="status == 5">
|
|
|
|
|
|
|
+ <if test="kedanOrderDto.bookingStatus == 5">
|
|
|
and o.due_out_time <= now()
|
|
and o.due_out_time <= now()
|
|
|
</if>
|
|
</if>
|
|
|
- <if test="thirdUserId != null and thirdUserId != ''">
|
|
|
|
|
- and o.third_login_user_id = #{thirdUserId}
|
|
|
|
|
|
|
+ <if test="kedanOrderDto.thirdUserId != null and kedanOrderDto.thirdUserId != ''">
|
|
|
|
|
+ and o.third_login_user_id = #{kedanOrderDto.thirdUserId}
|
|
|
</if>
|
|
</if>
|
|
|
- <if test="keyw != null and keyw != ''" >
|
|
|
|
|
- and (cus.`name` like '%${keyw}%' or cus.phone like '%${keyw}%' or o.booking_orders_no like '%${keyw}%')
|
|
|
|
|
|
|
+ <if test="kedanOrderDto.keyw != null and kedanOrderDto.keyw != ''" >
|
|
|
|
|
+ and (cus.`name` like '%${kedanOrderDto.keyw}%' or cus.phone like '%${kedanOrderDto.keyw}%' or o.booking_orders_no like '%${kedanOrderDto.keyw}%')
|
|
|
</if>
|
|
</if>
|
|
|
- <if test="startTime != null">
|
|
|
|
|
- and o.arrival_time >= #{startTime}
|
|
|
|
|
|
|
+ <if test="kedanOrderDto.startTime != null">
|
|
|
|
|
+ and o.arrival_time >= #{kedanOrderDto.startTime}
|
|
|
</if>
|
|
</if>
|
|
|
- <if test="endTime != null">
|
|
|
|
|
- and o.arrival_time <= #{endTime}
|
|
|
|
|
|
|
+ <if test="kedanOrderDto.endTime != null">
|
|
|
|
|
+ and o.arrival_time <= #{kedanOrderDto.endTime}
|
|
|
</if>
|
|
</if>
|
|
|
GROUP BY o.id,r.id,brlo.id order by o.create_time desc
|
|
GROUP BY o.id,r.id,brlo.id order by o.create_time desc
|
|
|
</select>
|
|
</select>
|