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

📄 bookmessdao.java

📁 网上购物源代码
💻 JAVA
字号:
/**
 * 
 */
package com.chinaaccpDao;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;

import com.chinaaccpbean.BuyMessBean;
import com.chinaaccpbean.Display;

/**
 * @author Administrator
 *
 */
public class BookMessDao {

	public ArrayList GetBuyBookInfo(String orderid)
	{
		ArrayList list = new ArrayList();
		Connection con = null;
		try {
			con = ConnectionLee.GetCon();
			Statement st = con.createStatement();
			String sql = "select p.name,o.quantity,o.price,o.totalfee from orderMess o inner join product p on p.id=o.productid where orderid='"+orderid+"'";
			ResultSet rs = st.executeQuery(sql);
			while(rs.next())
			{
				BuyMessBean buy = new BuyMessBean();
				buy.setBookname(rs.getString(1));
				buy.setQuantity(rs.getInt(2));
				buy.setPrice(rs.getDouble(3));
				buy.setTotal(rs.getDouble(4));
				list.add(buy);
			}
			st.close();
			con.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return list;
	}
	public Display GetBookInfo(String bookid)
	{
		Display dis = new Display();
		Connection con = null;
		try {
			con = ConnectionLee.GetCon();
			Statement st = con.createStatement();
			String sql = "select id,name,price,descinfo,picture,picture_big from product where id='"+bookid+"'";
			ResultSet rs = st.executeQuery(sql);
			if(rs.next())
			{
				dis.setId(rs.getInt(1));
				dis.setName(rs.getString(2));
				dis.setPrice(rs.getDouble(3));
				dis.setDiscinfo(rs.getString(4));
				dis.setImgpath(rs.getString(5));
				dis.setBigimgpath(rs.getString(6));
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return dis;
	}
}

⌨️ 快捷键说明

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