package cn.buk.hotel.entity;
import cn.buk.util.DateUtil;
import javax.persistence.*;
import java.util.Date;
import java.util.List;
/**
* Created by william on 2015-2-7.
*/
@Entity
@Table(name="hotel_order")
public class HotelOrder {
@Id
@GeneratedValue
private int id;
/**
* 预订人
*/
@Column(name="user_id")
private Integer userId;
/**
* 酒店城市
*/
@Column(length=3)
private String cityCode;
private String cityName;
/**
* 入住时间
*/
@Temporal(TemporalType.DATE)
private Date checkInDate;
/**
* 离店日期
*/
@Temporal(TemporalType.DATE)
private Date checkOutDate;
/**
* 入住酒店
*/
@ManyToOne
@JoinColumn(name="hotel_id")
private HotelInfo hotel;
@Column(length=10)
private String hotelCode;
@Column(length=100)
private String hotelName;
/**
* 入住房型的代码
*/
private String roomTypeCode;
/**
* 入住房型名称
*/
private String roomTypeName;
/**
* 预订的价格所属的价格计划
*/
private String ratePlanCode;
/**
* 房价(单间总价)
*/
private int price;
/**
* 房间数
*/
private int roomCount;
/**
* 总价 = 房价 * 间
*/
private int total;
/**
* 入住酒店的客人
*/
@OneToMany(mappedBy="order", cascade={CascadeType.ALL})
private List<HotelOrderGuest> guests;
/**
* 最晚到店时间
*/
@Column(length=8)
private String lateArriveTime;
@Embedded
private ContactInfo contactInfo;
/**
* 订单创建时间
*/
@Temporal(TemporalType.TIMESTAMP)
private Date createTime = DateUtil.getCurDateTime();
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getCityCode() {
return cityCode;
}
public void setCityCode(String cityCode) {
this.cityCode = cityCode;
}
public String getCityName() {
return cityName;
}
public void setCityName(String cityName) {
this.cityName = cityName;
}
public Date getCheckInDate() {
return checkInDate;
}
public void setCheckInDate(Date checkInDate) {
this.checkInDate = checkInDate;
}
public Date getCheckOutDate() {
return checkOutDate;
}
public void setCheckOutDate(Date checkOutDate) {
this.checkOutDate = checkOutDate;
}
public HotelInfo getHotel() {
return hotel;
}
public void setHotel(HotelInfo hotel) {
this.hotel = hotel;
}
public String getHotelCode() {
return hotelCode;
}
public void setHotelCode(String hotelCode) {
this.hotelCode = hotelCode;
}
public String getHotelName() {
return hotelName;
}
public void setHotelName(String hotelName) {
this.hotelName = hotelName;
}
public String getRoomTypeCode() {
return roomTypeCode;
}
public void setRoomTypeCode(String roomTypeCode) {
this.roomTypeCode = roomTypeCode;
}
public String getRoomTypeName() {
return roomTypeName;
}
public void setRoomTypeName(String roomTypeName) {
this.roomTypeName = roomTypeName;
}
public String getRatePlanCode() {
return ratePlanCode;
}
public void setRatePlanCode(String ratePlanCode) {
this.ratePlanCode = ratePlanCode;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public List<HotelOrderGuest> getGuests() {
return guests;
}
public void setGuests(List<HotelOrderGuest> guests) {
this.guests = guests;
}
public String getLateArriveTime() {
return lateArriveTime;
}
public void setLateArriveTime(String lateArriveTime) {
this.lateArriveTime = lateArriveTime;
}
public ContactInfo getContactInfo() {
return contactInfo;
}
public void setContactInfo(ContactInfo contactInfo) {
this.contactInfo = contactInfo;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public int getRoomCount() {
return roomCount;
}
public void setRoomCount(int roomCount) {
this.roomCount = roomCount;
}
}