• 后台代码之买票和查找核实航班的代码


      

    //后台买票
        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;    
        }
        
    ---- 动动手指关注我!或许下次你又能在我这里找到你需要的答案!ZZZZW与你一起学习,一起进步!
  • 相关阅读:
    AcWing 102. 最佳牛围栏
    AcWing 105 七夕祭
    AcWing 122 糖果传递
    AcWing 113. 特殊排序
    AcWing 107. 超快速排序
    AcWing 106. 动态中位数
    【oracle/sqlplus】修改glogin.sql以在sqlplus提示符中显示用户和服务名
    【Java/jdbc/oracle】将两Timestamp字段的差值变成时分秒毫秒的形式
    【java/math】位运算判断奇数和取余运算判断奇数的差别
    【JDBC/Metadata】如何在Java程序中获取表的主键们(包括单主键、联合主键和无主键)
  • 原文地址:https://www.cnblogs.com/zzzzw/p/4818929.html
Copyright © 2020-2023  润新知