//后台买票 public List<String[]> buy(Integer lid,String radio1) { List<String[]> result=new ArrayList<String[]>(); if(radio1.toString().equals("头等舱")) { String sql="SELECT b.`name`,a.linename, " + " a.startplace,a.endplace,a.planedate,a.starttime,a.endtime " + ",a.id,d.planetype,d.tdcprice"+ " from line a,aircompany b,plane d " + " where a.id=? AND b.id=a.pid AND d.lname=a.linename;"; Query q=gs().createSQLQuery(sql); q.setParameter(0, lid); result=q.list(); } else if(radio1.toString().equals("商务舱")) { String sql="SELECT b.`name`,a.linename, " + " a.startplace,a.endplace,a.planedate,a.starttime,a.endtime " + ",a.id,d.planetype,d.swcprice"+ " from line a,aircompany b,plane d " + " where a.id=? AND b.id=a.pid AND d.lname=a.linename;"; Query q=gs().createSQLQuery(sql); q.setParameter(0, lid); result=q.list(); } else if(radio1.toString().equals("经济舱")) { String sql="SELECT b.`name`,a.linename, " + " a.startplace,a.endplace,a.planedate,a.starttime,a.endtime " + ",a.id,d.planetype,d.jjcprice"+ " from line a,aircompany b,plane d " + " where a.id=? AND b.id=a.pid AND d.lname=a.linename;"; Query q=gs().createSQLQuery(sql); q.setParameter(0, lid); result=q.list(); } else if(radio1.toString().equals("特惠舱")) { String sql="SELECT b.`name`,a.linename, " + " a.startplace,a.endplace,a.planedate,a.starttime,a.endtime " + ",a.id,d.planetype,d.thcprice"+ " from line a,aircompany b,plane d " + " where a.id=? AND b.id=a.pid AND d.lname=a.linename;"; Query q=gs().createSQLQuery(sql); q.setParameter(0, lid); result=q.list(); } return result; } //查找适合的航线 public List<String[]> searchLine(String sfz,String ddz,String cfrq){ List<String[]> result =new ArrayList(); List list=new ArrayList(); String sql=" SELECT b.`name`,a.linename,a.startplace,a.starttime,a.endplace,a.endtime , " + "d.tdcprice,c.tdcnum,d.swcprice,c.swcnum,d.jjcprice,c.jjcnum,d.thcprice,c.thcnum, " + "d.planetype,a.id,b.logourl,d.tdcnum as tdcnum1,d.swcnum as swcnum1,d.jjcnum as jjcnum1,d.thcnum as thcnum1,"+ "c.id as cid ,c.planedate as cplanedate from line a,aircompany b ,seatnum c,plane d " + " WHERE a.pid=b.id and a.startcity=? " + " AND a.endcity=? AND a.planedate=? AND c.lname=a.linename"+ " AND d.lname=a.linename "; Query q=gs().createSQLQuery(sql); q.setParameter(0, sfz); q.setParameter(1, ddz); q.setParameter(2, cfrq); result=q.list(); return result; }