基于jsp的航空票务系统论文(7)

2019-03-28 18:49

合肥师范学院2015届本科生毕业论文(设计)

}

} /**

* 执行sql

* return:影响行数

* @throws SQLException */

public int doSql(String sql,Object parames[]) throws SQLException{ getConnect(); ps = con.prepareStatement(sql); for(int i=0;i

* 获得结果集

* @throws SQLException * return:结果集 */

public ResultSet getRs() throws SQLException{ rs = ps.getResultSet(); return rs; } /**

* 关闭资源

* @throws SQLException */

public void getClose() throws SQLException{ if(rs!=null) rs.close(); if(ps!=null) ps.close(); if(con!=null) con.close(); }

27

合肥师范学院2015届本科生毕业论文(设计)

2、SERVICE(业务逻辑层)层处理业务逻辑: package com.nite.service; import java.sql.ResultSet;

import java.sql.SQLException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map;

import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.nite.dao.Dao;

public class Function {

private Dao dao = new Dao(); /**

* 查询航班 * @param sql

* @param parames * @return

* @throws SQLException */

public List> selectFlight(String sql, Object[] parames) SQLException { List> list = new ArrayList>(); dao.doSql(sql, parames); ResultSet rs = dao.getRs(); rs.last(); int i = rs.getRow(); System.out.println(\结果集中有\条记录\ if(i>0){ rs.beforeFirst(); while(rs.next()){ String id = rs.getString(\ String airfirm = rs.getString(2); String start = rs.getString(3); String end = rs.getString(4); String leaveTime = rs.getString(5); String arriveTime = rs.getString(6); Map map = new HashMap(); map.put(\ map.put(\ map.put(\ map.put(\ map.put(\

28

throws 合肥师范学院2015届本科生毕业论文(设计)

map.put(\ list.add(map); } }else{ list=null; } dao.getClose(); return list; } /**

* 查询机票

* @throws SQLException */

public List> selectTicket(String sql, Object[] parames) throws SQLException { List> list = new ArrayList>(); dao.doSql(sql, parames); ResultSet rs = dao.getRs(); rs.last(); int i = rs.getRow(); System.out.println(\结果集中有\条记录\ if(i>0){ rs.beforeFirst(); while(rs.next()){ String id = rs.getString(\ String start = rs.getString(2); String end = rs.getString(3); String leaveTime = rs.getString(4); String arriveTime = rs.getString(5); String time = rs.getString(6); String seatLevel = rs.getString(7); String fare = rs.getString(8); String discount = rs.getString(9); String flight_id = rs.getString(10); String ticketNum = rs.getString(11); Map map = new HashMap(); map.put(\ map.put(\ map.put(\ map.put(\ map.put(\ map.put(\

29

合肥师范学院2015届本科生毕业论文(设计)

map.put(\ map.put(\ map.put(\ map.put(\ map.put(\ list.add(map); } }else{ list=null; } dao.getClose(); return list; } /**

* 添加

* @param sql

* @param parames * @return

* @throws SQLException */

public int insert(String sql, Object[] parames) throws SQLException { int i = dao.doSql(sql, parames); System.out.println(\影响行数\ dao.getClose(); return i; }

/**

* 删除

* @param sql

* @param parames

* @throws SQLException */

public int delete(String sql, Object[] parames) throws SQLException { int i = dao.doSql(sql, parames); System.out.println(\影响行数:\ dao.getClose(); return i; } /**

* 修改

* @param sql

30

合肥师范学院2015届本科生毕业论文(设计)

* @param parames

* @throws SQLException */

public int update(String sql, Object[] parames) throws SQLException { int i = dao.doSql(sql, parames); System.out.println(\影响行数:\ dao.getClose(); return i; } /**

* 登录

* @throws SQLException */

public List> login(String sql,Object parames[]) throws SQLException{ dao.doSql(sql, parames); ResultSet rs = dao.getRs(); List> list = new ArrayList>(); rs.last(); int i = rs.getRow(); if(i>0){ rs.beforeFirst(); while(rs.next()){ String name = rs.getString(\ String password = rs.getString(\ String level = rs.getString(\ Map map = new HashMap(); map.put(\ map.put(\ map.put(\ list.add(map); } }else{ list=null; } return list; } /**

* 用户查询 * @param sql

* @param parames

* @throws SQLException */

31


基于jsp的航空票务系统论文(7).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:用友T3-总账

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: