CASE WHEN LOWER(CONCAT('', s.status)) IN ('0', 'unbooked', 'available') THEN 0 WHEN LOWER(CONCAT('', s.status)) IN ('1', 'booked') THEN 1 WHEN LOWER(CONCAT('', s.status)) IN ('2', 'cancelled', 'canceled', 'stopped') THEN 2 WHEN LOWER(CONCAT('', s.status)) IN ('3', 'checked', 'checked_in', 'checkin') THEN 3 WHEN LOWER(CONCAT('', s.status)) IN ('4', 'locked') THEN 4 WHEN LOWER(CONCAT('', s.status)) IN ('5', 'returned') THEN 5 ELSE NULL END CASE WHEN LOWER(CONCAT('', o.status)) IN ('1', 'booked') THEN 1 WHEN LOWER(CONCAT('', o.status)) IN ('2', 'checked', 'checked_in', 'checkin') THEN 2 WHEN LOWER(CONCAT('', o.status)) IN ('3', 'cancelled', 'canceled') THEN 3 WHEN LOWER(CONCAT('', o.status)) IN ('4', 'returned') THEN 4 ELSE NULL END CASE WHEN LOWER(CONCAT('', p.status)) IN ('0', 'unbooked', 'available') THEN 0 WHEN LOWER(CONCAT('', p.status)) IN ('1', 'booked') THEN 1 WHEN LOWER(CONCAT('', p.status)) IN ('2', 'cancelled', 'canceled', 'stopped') THEN 2 WHEN LOWER(CONCAT('', p.status)) IN ('3', 'checked', 'checked_in', 'checkin') THEN 3 WHEN LOWER(CONCAT('', p.status)) IN ('4', 'locked') THEN 4 WHEN LOWER(CONCAT('', p.status)) IN ('5', 'returned') THEN 5 ELSE NULL END UPDATE adm_schedule_slot SET status = 1, update_time = now() WHERE id = #{slotId} AND status = 0 AND delete_flag = '0' UPDATE adm_schedule_slot SET status = #{status}, order_id = NULL, update_time = now() WHERE id = #{slotId} AND delete_flag = '0' UPDATE adm_schedule_slot SET status = #{status}, check_in_time = #{checkInTime}, update_time = NOW() WHERE id = #{slotId} AND delete_flag = '0' UPDATE adm_schedule_slot SET order_id = #{orderId}, update_time = now() WHERE id = #{slotId} AND status = 1 AND delete_flag = '0'