资源简介
北大青鸟 超市账单管理系统 完整代码. 主要基于 JSP+SERVLET 完成的
代码片段和文件信息
package com.pb.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import com.pb.entity.Bill;
import com.pb.util.Conbase;
public class BillDao {
private Connection conn;
private PreparedStatement pstmt;
private ResultSet rs;
/*
* 查询账单
*/
public List getBill(){
String sql=“select * from zhou_bill“;
conn = Conbase.getCon();
List list = new ArrayList();
try {
pstmt=conn.prepareStatement(sql);
rs=pstmt.executeQuery();
while(rs.next()){
Bill bill= new Bill();
bill.setBillId(rs.getInt(“billId“));
bill.setGoodsName(rs.getString(“goodsName“));
bill.setGoodsNum(rs.getInt(“goodsNum“));
bill.setGoodsPrice(rs.getDouble(“goodsPrice“));
bill.setIsPayed(rs.getString(“isPayed“));
bill.setSupplierName(rs.getString(“supplierName“));
bill.setGoodsDescription(rs.getString(“goodsDescription“));
bill.setBillDate(rs.getDate(“billDate“));
bill.setGoodsUnit(rs.getString(“goodsUnit“));
list.add(bill);
}
} catch (SQLException e) {
e.printStackTrace();
}finally{
Conbase.closeAll(rs pstmt conn);
}
return list;
}
/*
* 组合查询
*/
public List findFromBill(String goodsNameString isPayed){
String sql=“select * from zhou_bill where goodsName like ‘%“+goodsName+“%‘ and isPayed like ‘“+isPayed+“‘“ ;
conn=Conbase.getCon();
List list = new ArrayList();
try {
pstmt=conn.prepareStatement(sql);
rs=pstmt.executeQuery();
while(rs.next()){
Bill bill= new Bill();
bill.setBillId(rs.getInt(“billId“));
bill.setGoodsName(rs.getString(“goodsName“));
bill.setGoodsNum(rs.getInt(“goodsNum“));
bill.setGoodsPrice(rs.getDouble(“goodsPrice“));
bill.setIsPayed(rs.getString(“isPayed“));
bill.setSupplierName(rs.getString(“supplierName“));
bill.setGoodsDescription(rs.getString(“goodsDescription“));
bill.setBillDate(rs.getDate(“billDate“));
bill.setGoodsUnit(rs.getString(“goodsUnit“));
list.add(bill);
}
} catch (SQLException e) {
e.printStackTrace();
}finally{
Conbase.closeAll(rs pstmt conn);
}
return list;
}
/*
* 添加账单
*/
public boolean addBill(Bill bill){
int billId = bill.getBillId();
String goodsName = bill.getGoodsName();
int goodsNum = bill.getGoodsNum();
double goodsPrice = bill.getGoodsPrice();
String isPayed = bill.getIsPayed();
String supplierName = bill.getSupplierName();
String goodsDescription = bill.getGoodsDescription();
String goodsUnit = bill.getGoodsUnit();
int bl=0;
String sql=“insert into zhou_bill(billIdgoodsNamegoodsNumgoodsPriceisPayedsupplierName“ +
“goodsDescriptionbillDategoodsUnit) values(“+billId+“‘“+goodsName+“‘“+goodsNum+““
+goodsPrice+“‘“+isPayed+“‘‘“+supplierName+“‘‘“+goodsDescription+“‘sysdate‘“
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2014-08-11 16:46 PB_SuperBillManager\
文件 596 2012-06-16 19:57 PB_SuperBillManager\.classpath
文件 395 2012-06-13 13:14 PB_SuperBillManager\.project
目录 0 2014-08-11 16:46 PB_SuperBillManager\.settings\
文件 134 2012-08-23 17:17 PB_SuperBillManager\.settings\org.eclipse.core.resources.prefs
文件 629 2012-06-05 16:35 PB_SuperBillManager\.settings\org.eclipse.jdt.core.prefs
目录 0 2014-08-11 16:46 PB_SuperBillManager\WebRoot\
目录 0 2014-08-11 16:46 PB_SuperBillManager\WebRoot\WEB-INF\
目录 0 2014-07-01 16:46 PB_SuperBillManager\WebRoot\WEB-INF\classes\
目录 0 2014-07-01 16:46 PB_SuperBillManager\WebRoot\WEB-INF\classes\com\
目录 0 2014-07-01 16:46 PB_SuperBillManager\WebRoot\WEB-INF\classes\com\pb\
目录 0 2014-08-11 16:46 PB_SuperBillManager\WebRoot\WEB-INF\classes\com\pb\dao\
文件 6398 2012-08-27 13:10 PB_SuperBillManager\WebRoot\WEB-INF\classes\com\pb\dao\BillDao.class
文件 6262 2012-08-27 13:10 PB_SuperBillManager\WebRoot\WEB-INF\classes\com\pb\dao\SupplierDao.class
文件 7009 2012-08-27 13:10 PB_SuperBillManager\WebRoot\WEB-INF\classes\com\pb\dao\UserDao.class
目录 0 2014-08-11 16:46 PB_SuperBillManager\WebRoot\WEB-INF\classes\com\pb\entity\
文件 2214 2012-08-27 13:10 PB_SuperBillManager\WebRoot\WEB-INF\classes\com\pb\entity\Bill.class
文件 1849 2012-08-27 13:10 PB_SuperBillManager\WebRoot\WEB-INF\classes\com\pb\entity\Supplier.class
文件 1923 2012-08-27 13:10 PB_SuperBillManager\WebRoot\WEB-INF\classes\com\pb\entity\User.class
目录 0 2014-08-11 16:46 PB_SuperBillManager\WebRoot\WEB-INF\classes\com\pb\servlet\
文件 5613 2012-08-27 13:10 PB_SuperBillManager\WebRoot\WEB-INF\classes\com\pb\servlet\BillServlet.class
文件 1434 2012-08-27 13:10 PB_SuperBillManager\WebRoot\WEB-INF\classes\com\pb\servlet\EncodingFilter.class
文件 2327 2012-08-27 13:10 PB_SuperBillManager\WebRoot\WEB-INF\classes\com\pb\servlet\LoginServlet.class
文件 5397 2012-08-27 13:10 PB_SuperBillManager\WebRoot\WEB-INF\classes\com\pb\servlet\SupplierServlet.class
文件 5817 2012-08-27 13:10 PB_SuperBillManager\WebRoot\WEB-INF\classes\com\pb\servlet\UserServlet.class
目录 0 2014-08-11 16:46 PB_SuperBillManager\WebRoot\WEB-INF\classes\com\pb\util\
文件 1912 2012-08-27 13:10 PB_SuperBillManager\WebRoot\WEB-INF\classes\com\pb\util\Conba
文件 1197 2012-08-27 13:10 PB_SuperBillManager\WebRoot\WEB-INF\classes\com\pb\util\Tools.class
文件 106 2012-06-13 13:13 PB_SuperBillManager\WebRoot\WEB-INF\classes\db.properties
目录 0 2014-08-11 16:46 PB_SuperBillManager\WebRoot\WEB-INF\lib\
文件 1062435 2012-06-05 16:39 PB_SuperBillManager\WebRoot\WEB-INF\lib\javaee.jar
............此处省略53个文件信息
评论
共有 条评论