package com.flight.action; import java.util.Date; import java.util.List; import org.hibernate.criterion.DetachedCriteria; import org.hibernate.criterion.Restrictions; import com.flight.biz.FlightBiz; import com.flight.entity.FlightTickets; import com.flight.entity.Flights; import com.opensymphony.xwork2.ActionSupport; public class FlightAction extends ActionSupport { private Date flightriqi; //起飞日期 private String cityA; //起飞地 private String cityB; //降落地 private FlightBiz iflightBiz; private List<Flights> flightsList; private FlightTickets flightTickets; //航空公司 private int id; private String msg; public FlightTickets getFlightTickets() { return flightTickets; } public void setFlightTickets(FlightTickets flightTickets) { this.flightTickets = flightTickets; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public Date getFlightriqi() { return flightriqi; } public void setFlightriqi(Date flightriqi) { this.flightriqi = flightriqi; } public String getCityA() { return cityA; } public void setCityA(String cityA) { this.cityA = cityA; } public String getCityB() { return cityB; } public void setCityB(String cityB) { this.cityB = cityB; } public FlightBiz getIflightBiz() { return iflightBiz; } public void setIflightBiz(FlightBiz iflightBiz) { this.iflightBiz = iflightBiz; } public List<Flights> getFlightsList() { return flightsList; } public void setFlightsList(List<Flights> flightsList) { this.flightsList = flightsList; } @Override public String execute() throws Exception { // TODO Auto-generated method stub System.out.println(flightriqi); System.out.println(cityA); System.out.println(cityB); DetachedCriteria dc = DetachedCriteria.forClass(Flights.class, "d") .createAlias("d.airportsByTakeAirportId", "t") .createAlias("d.airportsByLandingAirportId", "l"); if (flightriqi != null) { dc.add(Restrictions.eq("d.flightDate", flightriqi)); } if (cityA != null) { dc.add(Restrictions.eq("t.cityName", cityA)); } if (cityB != null) { dc.add(Restrictions.eq("l.cityName", cityB)); } flightsList = iflightBiz.findAllSearch(dc); System.out.println(flightsList.size()); if (flightsList.size() > 0) { return SUCCESS; }else { msg = "没有查到相关内容!"; return INPUT; } } public String findIdInfo(){ try { System.out.println(id); flightTickets = iflightBiz.findIdByFlightTicketsInfo(id); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return SUCCESS; } public String findflight(){ flightsList = iflightBiz.findAllflight(); return SUCCESS; } }
最近下载更多
mmmmmmppp LV10
2022年11月16日
hfahiofha LV1
2022年8月22日
JohnAlex LV9
2022年2月19日
XcHyxa LV7
2021年7月19日
ASDZXZCDGSDFHUJD LV9
2020年5月9日
gonghongli LV9
2020年5月1日
helloxuzhou LV1
2020年4月13日
houliukou LV38
2020年3月3日
仙女小麋鹿 LV6
2019年12月23日
翱翔天空 LV3
2019年10月23日