日期:2014-05-17 浏览次数:20697 次
function reserveQuery(){
$.ajax({
type: "post",
url: "rsvqueryAjax.action",
data: "startdate="+$("#startdate").val()+"&enddate="+$("#enddate").val(),
success: function(json){
alert(1)
}
})
}
public static List<RoomType> getAvailableRoomTypes(String startDateStr,String endDateStr){
System.out.println("进入方法");
Session session = HibernateSessionFactory.getSession();
System.out.println("create session");
String hql1 = "select room.roomtype from Reservation where indate > :enddate or outdate < :startdate";
java.sql.Date startdate = java.sql.Date.valueOf(startDateStr);
java.sql.Date enddate = java.sql.Date.valueOf(endDateStr);
System.out.println("date success");
//list1表示状态为“已预订”的房间中在指定日期范围还可预订的房型
Query query = session.createQuery(hql1);
System.out.println("create query");
query.setDate("startdate", startdate);
query.setDate("enddate", enddate);
System.out.println("set date");
List<RoomType> list1 = query.list();
System.out.println("list get");
list1 = MyUtils.removeDuplicate(list1);
……