• 大小: 2.82MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-10-27
  • 语言: 数据库
  • 标签:

资源简介

一套很完整的在线购物系统和需求分析。在线购物系统包括前台和后台等功能。使用户用着更方便、简洁、

资源截图

代码片段和文件信息

package 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 entity.*;

import util.DBUtil;

public class GoodsDao {

private static GoodsDao goodsDao= new GoodsDao();

private GoodsDao(){}
    
public static GoodsDao getInstance(){
return goodsDao;
}

public void add(GoodsDetails goods) {
String sql = “insert into goods values(??????)“;
Connection conn = DBUtil.getConnection();
PreparedStatement pstmt = null;
try {
pstmt = conn.prepareStatement(sql);
int index = 1;
pstmt.setString(index++ goods.getGoods_id());
pstmt.setString(index++ goods.getCategory());
pstmt.setString(index++ goods.getName());
pstmt.setFloat(index++ goods.getPrice());
pstmt.setInt(index++ goods.getYr());
pstmt.setString(index++ goods.getDescription());
pstmt.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
throw new RuntimeException();
}finally{
DBUtil.close(pstmtconn);
}

}

public void delete(String id) {
String sql = “delete from goods where goods_id = ?“;
Connection conn = DBUtil.getConnection();
PreparedStatement pstmt = null;
try {
pstmt = conn.prepareStatement(sql);
System.out.println(sql);
int index = 1;
pstmt.setString(index++ id);
pstmt.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
throw new RuntimeException();
}finally{
DBUtil.close(pstmtconn);
}

}

public void update(GoodsDetails goods) {
String sql = “update goods set category=?name=?price=?yr=?description=?where goods_id = ?“;
Connection conn = DBUtil.getConnection();
PreparedStatement pstmt = null;
try {
pstmt = conn.prepareStatement(sql);
int index = 1;
pstmt.setString(index++ goods.getCategory());
pstmt.setString(index++ goods.getName());
pstmt.setFloat(index++ goods.getPrice());
pstmt.setInt(index++ goods.getYr());
pstmt.setString(index++ goods.getDescription());
pstmt.setString(index++ goods.getGoods_id());
pstmt.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
throw new RuntimeException();
}finally{
DBUtil.close(pstmtconn);
}

}

public GoodsDetails findById(String id) {
String sql = “select * from goods where goods_id= ?“;
Connection conn = DBUtil.getConnection();
PreparedStatement pstmt = null;
ResultSet rs = null;
GoodsDetails goods = new GoodsDetails();
try {
pstmt = conn.prepareStatement(sql);
pstmt.setString(1 id);
rs = pstmt.executeQuery();
if(rs.next()){
int index = 1;
goods.setGoods_id(rs.getString(index++));
goods.setCategory(rs.getString(index++));
goods.setName(rs.getString(index++));
goods.setPrice(rs.

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1055  2010-07-09 09:04  在线购物系统\Shopping\.classpath

     文件        297  2010-07-09 09:04  在线购物系统\Shopping\.mymetadata

     文件        296  2010-07-08 22:29  在线购物系统\Shopping\.mymetadata.bak

     文件       1414  2010-07-08 22:29  在线购物系统\Shopping\.project

     文件        500  2010-07-08 22:29  在线购物系统\Shopping\.settings\.jsdtscope

     文件         86  2010-07-08 22:29  在线购物系统\Shopping\.settings\org.eclipse.core.resources.prefs

     文件        629  2010-07-08 22:29  在线购物系统\Shopping\.settings\org.eclipse.jdt.core.prefs

     文件         99  2010-07-08 22:29  在线购物系统\Shopping\.settings\org.eclipse.jdt.ui.prefs

     文件         49  2010-07-08 22:29  在线购物系统\Shopping\.settings\org.eclipse.wst.jsdt.ui.superType.container

     文件          6  2010-07-08 22:29  在线购物系统\Shopping\.settings\org.eclipse.wst.jsdt.ui.superType.name

     文件       1796  2010-07-09 09:30  在线购物系统\Shopping\sql\shop.sql

     文件       1771  2010-07-08 22:29  在线购物系统\Shopping\sql\shop1.sql

     文件       1768  2010-07-08 22:29  在线购物系统\Shopping\sql\shop1.sql.bak

     文件       5192  2010-07-08 23:53  在线购物系统\Shopping\src\dao\GoodsDao.java

     文件       2185  2010-07-09 02:52  在线购物系统\Shopping\src\dao\linkDao.java

     文件       4586  2010-07-09 02:33  在线购物系统\Shopping\src\dao\OrderDao.java

     文件       2480  2010-07-08 22:29  在线购物系统\Shopping\src\dao\ProDao.java

     文件       6358  2010-07-08 23:34  在线购物系统\Shopping\src\dao\UserDao.java

     文件        458  2010-07-08 22:29  在线购物系统\Shopping\src\entity\GoodsCartItem.java

     文件       1595  2010-07-08 22:29  在线购物系统\Shopping\src\entity\GoodsDetails.java

     文件        492  2010-07-08 22:29  在线购物系统\Shopping\src\entity\link.java

     文件        895  2010-07-08 22:29  在线购物系统\Shopping\src\entity\Order.java

     文件       1601  2010-07-08 22:29  在线购物系统\Shopping\src\entity\User.java

     文件       1570  2010-07-08 22:29  在线购物系统\Shopping\src\filter\AuthFilter.java

     文件        851  2010-07-08 22:29  在线购物系统\Shopping\src\filter\CharsetEncodingFilter.java

     文件       1690  2010-07-08 22:29  在线购物系统\Shopping\src\servlet\GoodsCart.java

     文件       3195  2010-07-09 00:02  在线购物系统\Shopping\src\servlet\GoodsServlet.java

     文件       2721  2010-07-08 22:29  在线购物系统\Shopping\src\servlet\ImageServlet.java

     文件       1100  2010-07-09 01:32  在线购物系统\Shopping\src\servlet\linkServlet.java

     文件       3062  2010-07-09 09:57  在线购物系统\Shopping\src\servlet\OrderServlet.java

............此处省略164个文件信息

评论

共有 条评论

相关资源