cpubookinfo.java

来自「网上购物源代码」· Java 代码 · 共 155 行

JAVA
155
字号
/**
 * 
 */
package com.chinaaccpDao;

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

import com.chinaaccpbean.Display;

/**
 * @author liu
 *
 */
public class CpuBookInfo {

	public ArrayList GetCpuBook()
	{
		ArrayList list = new ArrayList();
		Connection con = null;
		try {
			con = ConnectionLee.GetCon();
			Statement st = con.createStatement();
			String sql = "select id,name,descinfo,price,picture,picture_big from product where pronum like 'CPU_%'";
			ResultSet rs = st.executeQuery(sql);
			while(rs.next())
			{
				Display cpubook = new Display();
				cpubook.setId(rs.getInt(1));
				cpubook.setName(rs.getString(2));
				cpubook.setDiscinfo(rs.getString(3));
				cpubook.setPrice(rs.getDouble(4));
				cpubook.setImgpath(rs.getString(5));
				cpubook.setBigimgpath(rs.getString(6));
				list.add(cpubook);
			}
			st.close();
			con.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return list;
	}
	public ArrayList GetChineseBook()
	{
		ArrayList list = new ArrayList();
		Connection con = null;
		try {
			con = ConnectionLee.GetCon();
			Statement st = con.createStatement();
			String sql = "select id,name,descinfo,price,picture,picture_big from product where pronum like 'LIT_%'";
			ResultSet rs = st.executeQuery(sql);
			while(rs.next())
			{
				Display chinabook = new Display();
				chinabook.setId(rs.getInt(1));
				chinabook.setName(rs.getString(2));
				chinabook.setDiscinfo(rs.getString(3));
				chinabook.setPrice(rs.getDouble(4));
				chinabook.setImgpath(rs.getString(5));
				chinabook.setBigimgpath(rs.getString(6));
				list.add(chinabook);
			}
			st.close();
			con.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return list;
	}
	public ArrayList GetFashion()
	{
		ArrayList list = new ArrayList();
		Connection con = null;
		try {
			con = ConnectionLee.GetCon();
			Statement st = con.createStatement();
			String sql = "select id,name,descinfo,price,picture,picture_big from product where pronum like 'FAD_%'";
			ResultSet rs = st.executeQuery(sql);
			while(rs.next())
			{
				Display fabook = new Display();
				fabook.setId(rs.getInt(1));
				fabook.setName(rs.getString(2));
				fabook.setDiscinfo(rs.getString(3));
				fabook.setPrice(rs.getDouble(4));
				fabook.setImgpath(rs.getString(5));
				fabook.setBigimgpath(rs.getString(6));
				list.add(fabook);
			}
			st.close();
			con.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return list;
	}
	public ArrayList GetChildren()
	{
		ArrayList list = new ArrayList();
		Connection con = null;
		try {
			con = ConnectionLee.GetCon();
			Statement st = con.createStatement();
			String sql = "select id,name,descinfo,price,picture,picture_big from product where pronum like 'STU_%'";
			ResultSet rs = st.executeQuery(sql);
			while(rs.next())
			{
				Display fabook = new Display();
				fabook.setId(rs.getInt(1));
				fabook.setName(rs.getString(2));
				fabook.setDiscinfo(rs.getString(3));
				fabook.setPrice(rs.getDouble(4));
				fabook.setImgpath(rs.getString(5));
				fabook.setBigimgpath(rs.getString(6));
				list.add(fabook);
			}
			st.close();
			con.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return list;
	}
	public ArrayList GetMedicineInfo()
	{
		ArrayList list = new ArrayList();
		Connection con = null;
		try {
			con = ConnectionLee.GetCon();
			Statement st = con.createStatement();
			String sql = "select id,name,descinfo,price,picture,picture_big from product where pronum like 'MED_%'";
			ResultSet rs = st.executeQuery(sql);
			while(rs.next())
			{
				Display medbook = new Display();
				medbook.setId(rs.getInt(1));
				medbook.setName(rs.getString(2));
				medbook.setDiscinfo(rs.getString(3));
				medbook.setPrice(rs.getDouble(4));
				medbook.setImgpath(rs.getString(5));
				medbook.setBigimgpath(rs.getString(6));
				list.add(medbook);
			}
			st.close();
			con.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return list;
	}
}

⌨️ 快捷键说明

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