⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shoppingcart.java

📁 电子商务系统: 项目描述:该系统主要完成用户网上购物、订单管理、产品管理、管理员管理等功能。后台管理员对产品类别和产品进行管理后
💻 JAVA
字号:
package com.tarena.shop.biz;import java.sql.*;import java.util.*;import com.tarena.shop.biz.dao.ShoppingCartDao;import com.tarena.shop.entity.Order;import com.tarena.shop.entity.Product;import com.tarena.shop.entity.User;import com.tarena.shop.entity.dao.hbn.UserDaoHbn;import com.tarena.shop.util.ConnectionFactory;public class ShoppingCart implements ShoppingCartDao{	public int generateOrder(Order order) {				return 0;	}	public Collection listProducts() {		Collection coll=new ArrayList(); 		Connection con = ConnectionFactory.getConnection();		String sql=null;		try{			sql="select * from productxp";			Statement st = con.createStatement							(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);			ResultSet rs=st.executeQuery(sql);			while(rs.next()){				Product p = new Product();				p.setId(rs.getInt("productid"));				p.setName(rs.getString("name"));				p.setPrice(rs.getDouble("price"));				p.setDescription(rs.getString("description"));				coll.add(p);			}		}catch(SQLException e){			e.printStackTrace();		}		return coll;	}	public User login(String username, String password) {		User u = new User();		u.setUserName(username);		u.setPassword(password);		UserDaoHbn udh= new UserDaoHbn();		User newuser=udh.selectByUser(u);		System.out.println(newuser+"++");		return newuser;	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -