首页>代码>java交易撮合系统>/jych20080919/webpk/src/dao/IndexDao.java
package dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import conn.DBConnection;
import domain.*;

public class IndexDao {
	public List<Index> getCredit() {
		Connection conn = DBConnection.getConn();
		PreparedStatement pstat = null;
		ResultSet rs = null;

		String sql1 = "SELECT products.title, products.productsid FROM webpk.products,webpk.offers WHERE products.productsid=offers.productsid GROUP BY products.productsid";
		String sql2 = "SELECT sum(o.amount) inamount FROM webpk.offers o,webpk.products p WHERE o.trade=0 AND o.productsid=? AND o.productsid = p.productsid ORDER BY p.productsid";
		String sql3 = "SELECT sum(o.amount) outamount FROM webpk.offers o,webpk.products p WHERE o.trade=1 AND o.productsid=? AND o.productsid = p.productsid ORDER BY p.productsid";
		String sql4 = "SELECT offers.post_time,offers.email,TO_DAYS(offers.end_time)-TO_DAYS(NOW()) time FROM webpk.offers WHERE trade=0 AND offers.productsid=?";
		String sql5 = "SELECT users.credit FROM webpk.users,webpk.offers WHERE users.email=?";

		List<Index> plist = new ArrayList<Index>();
		List<Index> olist = new ArrayList<Index>();
		List<Index> oflist = new ArrayList<Index>();
		List<Index> offlist = new ArrayList<Index>();
		List<Index> ulist = new ArrayList<Index>();

		try {
			Statement stmt = conn.createStatement();
			rs = stmt.executeQuery(sql1);
			Index ine = null;
			while (rs.next()) {
				ine = new Index();
				ine.setTitle(rs.getString("title"));
				ine.setProductsid(rs.getInt("productsid"));
				plist.add(ine);
			}

			Iterator<Index> it = plist.iterator();
			while (it.hasNext()) {
				Index ins = it.next();
				pstat = conn.prepareStatement(sql2);
				pstat.setInt(1, ins.getProductsid());
				rs = pstat.executeQuery();
				if (rs.next()) {
					Index oin = new Index();
					oin.setTitle(ins.getTitle());
					oin.setProductsid(ins.getProductsid());
					oin.setInamount(rs.getInt("inamount"));
					olist.add(oin);
				}
			}

			Iterator<Index> its = olist.iterator();
			while (its.hasNext()) {
				Index ins = its.next();
				pstat = conn.prepareStatement(sql3);
				pstat.setInt(1, ins.getProductsid());
				rs = pstat.executeQuery();
				if (rs.next()) {
					Index oin = new Index();
					oin.setTitle(ins.getTitle());
					oin.setProductsid(ins.getProductsid());
					oin.setInamount(ins.getInamount());
					oin.setOutamount(rs.getInt("outamount"));
					oflist.add(oin);
				}
			}

			Iterator<Index> ist = oflist.iterator();
			while (ist.hasNext()) {
				Index ins = ist.next();
				pstat = conn.prepareStatement(sql4);
				pstat.setInt(1, ins.getProductsid());
				rs = pstat.executeQuery();
				if (rs.next()) {
					Index oin = new Index();
					oin.setTitle(ins.getTitle());
					oin.setProductsid(ins.getProductsid());
					oin.setInamount(ins.getInamount());
					oin.setOutamount(ins.getOutamount());
					oin.setTime(rs.getInt("time"));
					oin.setPost_time(rs.getDate("post_time"));
					oin.setEmail(rs.getString("email"));
					offlist.add(oin);
				}
			}
			System.out.println(offlist.size());
			Iterator<Index> ito = offlist.iterator();
			while (ito.hasNext()) {
				Index ins = ito.next();
				pstat = conn.prepareStatement(sql5);
				pstat.setString(1, ins.getEmail());
				rs = pstat.executeQuery();
				if (rs.next()) {
					Index oin = new Index();
					oin.setTitle(ins.getTitle());
					oin.setProductsid(ins.getProductsid());
					oin.setInamount(ins.getInamount());
					oin.setOutamount(ins.getOutamount());
					oin.setTime(ins.getTime());
					oin.setPost_time(ins.getPost_time());
					oin.setEmail(ins.getEmail());
					oin.setCredit(rs.getInt("credit"));
					ulist.add(oin);

				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}

		finally {
			DBConnection.closeConn();
		}
		return ulist;
	}

	public List<Index> getAllSeller() {

		Connection conn = DBConnection.getConn();
		Statement stmt = null;
		ResultSet rs = null;

		List<Index> ilist = new ArrayList<Index>();
		String sql1 = "select  p.title,o.amount outamount,o.post_time,TO_DAYS(o.end_time)-TO_DAYS(NOW()) time,u.credit  from webpk.offers o,webpk.products p,webpk.users u  where o.trade=1 and p.productsid=o.productsid and o.email=u.email";

		try {
			stmt = conn.createStatement();
			rs = stmt.executeQuery(sql1);
			Index oin = null;
			while (rs.next()) {
				oin = new Index();
				oin.setTitle(rs.getString("title"));
				oin.setOutamount(rs.getInt("outamount"));				
				oin.setTime(rs.getInt("time"));
				oin.setPost_time(rs.getDate("post_time"));				
				oin.setCredit(rs.getInt("credit"));
				ilist.add(oin);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			DBConnection.closeConn();
		}
		return ilist;
	}
	
	public List<Index> getSinceritySeller() {

		Connection conn = DBConnection.getConn();
		Statement stmt = null;
		ResultSet rs = null;

		List<Index> ilist = new ArrayList<Index>();
		String sql1 = "select  p.title,o.amount outamount,o.post_time,TO_DAYS(o.end_time)-TO_DAYS(NOW()) time,u.credit  from webpk.offers o,webpk.products p,webpk.users u  where o.trade=1 and u.credit>=2000 and p.productsid=o.productsid and o.email=u.email";

		try {
			stmt = conn.createStatement();
			rs = stmt.executeQuery(sql1);
			Index oin = null;
			while (rs.next()) {
				oin = new Index();
				oin.setTitle(rs.getString("title"));
				oin.setOutamount(rs.getInt("outamount"));				
				oin.setTime(rs.getInt("time"));
				oin.setPost_time(rs.getDate("post_time"));				
				oin.setCredit(rs.getInt("credit"));
				ilist.add(oin);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			DBConnection.closeConn();
		}
		return ilist;
	}
	
	public List<Index> getFinishTrade() {

		Connection conn = DBConnection.getConn();
		Statement stmt = null;
		ResultSet rs = null;

		List<Index> ilist = new ArrayList<Index>();
		String sql1 = "SELECT p.title,o.amount outamount,o.post_time,TO_DAYS(o.end_time)-TO_DAYS(NOW()) time,u.credit FROM webpk.offers o,webpk.products p,webpk.users u  WHERE o.trade=1 and o.state='交易成功' and p.productsid=o.productsid and o.email=u.email";

		try {
			stmt = conn.createStatement();
			rs = stmt.executeQuery(sql1);
			Index oin = null;
			while (rs.next()) {
				oin = new Index();
				oin.setTitle(rs.getString("title"));
				oin.setOutamount(rs.getInt("outamount"));				
				oin.setTime(rs.getInt("time"));
				oin.setPost_time(rs.getDate("post_time"));				
				oin.setCredit(rs.getInt("credit"));
				ilist.add(oin);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			DBConnection.closeConn();
		}
		return ilist;
	}
	
	public List<Index> getQiChe() {

		Connection conn = DBConnection.getConn();
		Statement stmt = null;
		ResultSet rs = null;

		List<Index> ilist = new ArrayList<Index>();
		String sql1 = "SELECT p.title,o.amount inamount,o.post_time,TO_DAYS(o.end_time)-TO_DAYS(NOW()) time,u.credit FROM webpk.offers o,webpk.products p,webpk.users u  WHERE o.trade=0 and p.title like '%轿车%' and p.productsid=o.productsid and o.email=u.email";

		try {
			stmt = conn.createStatement();
			rs = stmt.executeQuery(sql1);
			Index oin = null;
			while (rs.next()) {
				oin = new Index();
				oin.setTitle(rs.getString("title"));
				oin.setInamount(rs.getInt("Inamount"));				
				oin.setTime(rs.getInt("time"));
				oin.setPost_time(rs.getDate("post_time"));				
				oin.setCredit(rs.getInt("credit"));
				ilist.add(oin);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			DBConnection.closeConn();
		}
		return ilist;
	}
	
	public List<Index> getBick() {

		Connection conn = DBConnection.getConn();
		Statement stmt = null;
		ResultSet rs = null;

		List<Index> ilist = new ArrayList<Index>();
		String sql1 = "SELECT p.title,o.amount inamount,o.post_time,TO_DAYS(o.end_time)-TO_DAYS(NOW()) time,u.credit FROM webpk.offers o,webpk.products p,webpk.users u  WHERE o.trade=0 and p.title like '%自行车%' and p.productsid=o.productsid and o.email=u.email";

		try {
			stmt = conn.createStatement();
			rs = stmt.executeQuery(sql1);
			Index oin = null;
			while (rs.next()) {
				oin = new Index();
				oin.setTitle(rs.getString("title"));
				oin.setInamount(rs.getInt("Inamount"));				
				oin.setTime(rs.getInt("time"));
				oin.setPost_time(rs.getDate("post_time"));				
				oin.setCredit(rs.getInt("credit"));
				ilist.add(oin);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			DBConnection.closeConn();
		}
		return ilist;
	}
	
	public List<Index> getBiJiBen() {

		Connection conn = DBConnection.getConn();
		Statement stmt = null;
		ResultSet rs = null;

		List<Index> ilist = new ArrayList<Index>();
		String sql1 = "SELECT p.title,o.amount inamount,o.post_time,TO_DAYS(o.end_time)-TO_DAYS(NOW()) time,u.credit FROM webpk.offers o,webpk.products p,webpk.users u  WHERE o.trade=0 and p.title like '%笔记本电脑%' and p.productsid=o.productsid and o.email=u.email";

		try {
			stmt = conn.createStatement();
			rs = stmt.executeQuery(sql1);
			Index oin = null;
			while (rs.next()) {
				oin = new Index();
				oin.setTitle(rs.getString("title"));
				oin.setInamount(rs.getInt("Inamount"));				
				oin.setTime(rs.getInt("time"));
				oin.setPost_time(rs.getDate("post_time"));				
				oin.setCredit(rs.getInt("credit"));
				ilist.add(oin);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			DBConnection.closeConn();
		}
		return ilist;
	}
	
	public List<Index> getTaiShi() {

		Connection conn = DBConnection.getConn();
		Statement stmt = null;
		ResultSet rs = null;

		List<Index> ilist = new ArrayList<Index>();
		String sql1 = "SELECT p.title,o.amount inamount,o.post_time,TO_DAYS(o.end_time)-TO_DAYS(NOW()) time,u.credit FROM webpk.offers o,webpk.products p,webpk.users u  WHERE o.trade=0 and p.title like '%台式电脑%' and p.productsid=o.productsid and o.email=u.email";

		try {
			stmt = conn.createStatement();
			rs = stmt.executeQuery(sql1);
			Index oin = null;
			while (rs.next()) {
				oin = new Index();
				oin.setTitle(rs.getString("title"));
				oin.setInamount(rs.getInt("Inamount"));				
				oin.setTime(rs.getInt("time"));
				oin.setPost_time(rs.getDate("post_time"));				
				oin.setCredit(rs.getInt("credit"));
				ilist.add(oin);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			DBConnection.closeConn();
		}
		return ilist;
	}
	
	public List<Index> getShouJi() {

		Connection conn = DBConnection.getConn();
		Statement stmt = null;
		ResultSet rs = null;

		List<Index> ilist = new ArrayList<Index>();
		String sql1 = "SELECT p.title,o.amount inamount,o.post_time,TO_DAYS(o.end_time)-TO_DAYS(NOW()) time,u.credit FROM webpk.offers o,webpk.products p,webpk.users u  WHERE o.trade=0 and p.title like '%手机%' and p.productsid=o.productsid and o.email=u.email";

		try {
			stmt = conn.createStatement();
			rs = stmt.executeQuery(sql1);
			Index oin = null;
			while (rs.next()) {
				oin = new Index();
				oin.setTitle(rs.getString("title"));
				oin.setInamount(rs.getInt("Inamount"));				
				oin.setTime(rs.getInt("time"));
				oin.setPost_time(rs.getDate("post_time"));				
				oin.setCredit(rs.getInt("credit"));
				ilist.add(oin);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			DBConnection.closeConn();
		}
		return ilist;
	}
	
	public List<Index> getMP() {

		Connection conn = DBConnection.getConn();
		Statement stmt = null;
		ResultSet rs = null;

		List<Index> ilist = new ArrayList<Index>();
		String sql1 = "SELECT p.title,o.amount inamount,o.post_time,TO_DAYS(o.end_time)-TO_DAYS(NOW()) time,u.credit FROM webpk.offers o,webpk.products p,webpk.users u  WHERE o.trade=0 and p.title like '%MP%' and p.productsid=o.productsid and o.email=u.email";

		try {
			stmt = conn.createStatement();
			rs = stmt.executeQuery(sql1);
			Index oin = null;
			while (rs.next()) {
				oin = new Index();
				oin.setTitle(rs.getString("title"));
				oin.setInamount(rs.getInt("Inamount"));				
				oin.setTime(rs.getInt("time"));
				oin.setPost_time(rs.getDate("post_time"));				
				oin.setCredit(rs.getInt("credit"));
				ilist.add(oin);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			DBConnection.closeConn();
		}
		return ilist;
	}
	
	public List<Index> getPSP() {

		Connection conn = DBConnection.getConn();
		Statement stmt = null;
		ResultSet rs = null;

		List<Index> ilist = new ArrayList<Index>();
		String sql1 = "SELECT p.title,o.amount inamount,o.post_time,TO_DAYS(o.end_time)-TO_DAYS(NOW()) time,u.credit FROM webpk.offers o,webpk.products p,webpk.users u  WHERE o.trade=0 and p.title like '%PSP%'||'%PS2%'||'%iPOD%' and p.productsid=o.productsid and o.email=u.email";
		
		

		try {
			stmt = conn.createStatement();
			rs = stmt.executeQuery(sql1);
			Index oin = null;
			while (rs.next()) {
				oin = new Index();
				oin.setTitle(rs.getString("title"));
				oin.setInamount(rs.getInt("Inamount"));				
				oin.setTime(rs.getInt("time"));
				oin.setPost_time(rs.getDate("post_time"));				
				oin.setCredit(rs.getInt("credit"));
				ilist.add(oin);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			DBConnection.closeConn();
		}
		return ilist;
	}
	
	public List<Index> getPBTV() {

		Connection conn = DBConnection.getConn();
		Statement stmt = null;
		ResultSet rs = null;

		List<Index> ilist = new ArrayList<Index>();
		String sql1 = "SELECT p.title,o.amount inamount,o.post_time,TO_DAYS(o.end_time)-TO_DAYS(NOW()) time,u.credit FROM webpk.offers o,webpk.products p,webpk.users u  WHERE o.trade=0 and p.title like '%平板电视%' and p.productsid=o.productsid and o.email=u.email";
		
		

		try {
			stmt = conn.createStatement();
			rs = stmt.executeQuery(sql1);
			Index oin = null;
			while (rs.next()) {
				oin = new Index();
				oin.setTitle(rs.getString("title"));
				oin.setInamount(rs.getInt("Inamount"));				
				oin.setTime(rs.getInt("time"));
				oin.setPost_time(rs.getDate("post_time"));				
				oin.setCredit(rs.getInt("credit"));
				ilist.add(oin);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			DBConnection.closeConn();
		}
		return ilist;
	}
	
	public List<Index> getPrint() {

		Connection conn = DBConnection.getConn();
		Statement stmt = null;
		ResultSet rs = null;

		List<Index> ilist = new ArrayList<Index>();
		String sql1 = "SELECT p.title,o.amount inamount,o.post_time,TO_DAYS(o.end_time)-TO_DAYS(NOW()) time,u.credit FROM webpk.offers o,webpk.products p,webpk.users u  WHERE o.trade=0 and p.title like '%打印机%' and p.productsid=o.productsid and o.email=u.email";
		
		

		try {
			stmt = conn.createStatement();
			rs = stmt.executeQuery(sql1);
			Index oin = null;
			while (rs.next()) {
				oin = new Index();
				oin.setTitle(rs.getString("title"));
				oin.setInamount(rs.getInt("Inamount"));				
				oin.setTime(rs.getInt("time"));
				oin.setPost_time(rs.getDate("post_time"));				
				oin.setCredit(rs.getInt("credit"));
				ilist.add(oin);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			DBConnection.closeConn();
		}
		return ilist;
	}
	
	public List<Index> getDC() {

		Connection conn = DBConnection.getConn();
		Statement stmt = null;
		ResultSet rs = null;

		List<Index> ilist = new ArrayList<Index>();
		String sql1 = "SELECT p.title,o.amount inamount,o.post_time,TO_DAYS(o.end_time)-TO_DAYS(NOW()) time,u.credit FROM webpk.offers o,webpk.products p,webpk.users u  WHERE o.trade=0 and p.title like '%相机%' and p.productsid=o.productsid and o.email=u.email";
		
		

		try {
			stmt = conn.createStatement();
			rs = stmt.executeQuery(sql1);
			Index oin = null;
			while (rs.next()) {
				oin = new Index();
				oin.setTitle(rs.getString("title"));
				oin.setInamount(rs.getInt("Inamount"));				
				oin.setTime(rs.getInt("time"));
				oin.setPost_time(rs.getDate("post_time"));				
				oin.setCredit(rs.getInt("credit"));
				ilist.add(oin);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			DBConnection.closeConn();
		}
		return ilist;
	}
	public List<Index> getDV() {

		Connection conn = DBConnection.getConn();
		Statement stmt = null;
		ResultSet rs = null;

		List<Index> ilist = new ArrayList<Index>();
		String sql1 = "SELECT p.title,o.amount inamount,o.post_time,TO_DAYS(o.end_time)-TO_DAYS(NOW()) time,u.credit FROM webpk.offers o,webpk.products p,webpk.users u  WHERE o.trade=0 and p.title like '%摄象机%' and p.productsid=o.productsid and o.email=u.email";
		
		

		try {
			stmt = conn.createStatement();
			rs = stmt.executeQuery(sql1);
			Index oin = null;
			while (rs.next()) {
				oin = new Index();
				oin.setTitle(rs.getString("title"));
				oin.setInamount(rs.getInt("Inamount"));				
				oin.setTime(rs.getInt("time"));
				oin.setPost_time(rs.getDate("post_time"));				
				oin.setCredit(rs.getInt("credit"));
				ilist.add(oin);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			DBConnection.closeConn();
		}
		return ilist;
	}
	
	public List<Index> getErJi() {

		Connection conn = DBConnection.getConn();
		Statement stmt = null;
		ResultSet rs = null;

		List<Index> ilist = new ArrayList<Index>();
		String sql1 = "SELECT p.title,o.amount inamount,o.post_time,TO_DAYS(o.end_time)-TO_DAYS(NOW()) time,u.credit FROM webpk.offers o,webpk.products p,webpk.users u  WHERE o.trade=0 and p.title like '%耳机%' and p.productsid=o.productsid and o.email=u.email";
		
		

		try {
			stmt = conn.createStatement();
			rs = stmt.executeQuery(sql1);
			Index oin = null;
			while (rs.next()) {
				oin = new Index();
				oin.setTitle(rs.getString("title"));
				oin.setInamount(rs.getInt("Inamount"));				
				oin.setTime(rs.getInt("time"));
				oin.setPost_time(rs.getDate("post_time"));				
				oin.setCredit(rs.getInt("credit"));
				ilist.add(oin);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			DBConnection.closeConn();
		}
		return ilist;
	}
	
	public List<Index> getYiDong() {

		Connection conn = DBConnection.getConn();
		Statement stmt = null;
		ResultSet rs = null;

		List<Index> ilist = new ArrayList<Index>();
		String sql1 = "SELECT p.title,o.amount inamount,o.post_time,TO_DAYS(o.end_time)-TO_DAYS(NOW()) time,u.credit FROM webpk.offers o,webpk.products p,webpk.users u  WHERE o.trade=0 and p.title like '%移动盘%' and p.productsid=o.productsid and o.email=u.email";
		
		

		try {
			stmt = conn.createStatement();
			rs = stmt.executeQuery(sql1);
			Index oin = null;
			while (rs.next()) {
				oin = new Index();
				oin.setTitle(rs.getString("title"));
				oin.setInamount(rs.getInt("Inamount"));				
				oin.setTime(rs.getInt("time"));
				oin.setPost_time(rs.getDate("post_time"));				
				oin.setCredit(rs.getInt("credit"));
				ilist.add(oin);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			DBConnection.closeConn();
		}
		return ilist;
	}
	
	public List<Index> getTouYing() {

		Connection conn = DBConnection.getConn();
		Statement stmt = null;
		ResultSet rs = null;

		List<Index> ilist = new ArrayList<Index>();
		String sql1 = "SELECT p.title,o.amount inamount,o.post_time,TO_DAYS(o.end_time)-TO_DAYS(NOW()) time,u.credit FROM webpk.offers o,webpk.products p,webpk.users u  WHERE o.trade=0 and p.title like '%投影机%' and p.productsid=o.productsid and o.email=u.email";
		
		

		try {
			stmt = conn.createStatement();
			rs = stmt.executeQuery(sql1);
			Index oin = null;
			while (rs.next()) {
				oin = new Index();
				oin.setTitle(rs.getString("title"));
				oin.setInamount(rs.getInt("Inamount"));				
				oin.setTime(rs.getInt("time"));
				oin.setPost_time(rs.getDate("post_time"));				
				oin.setCredit(rs.getInt("credit"));
				ilist.add(oin);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			DBConnection.closeConn();
		}
		return ilist;
	}
	
	public List<Index> getFuWu() {

		Connection conn = DBConnection.getConn();
		Statement stmt = null;
		ResultSet rs = null;

		List<Index> ilist = new ArrayList<Index>();
		String sql1 = "SELECT p.title,o.amount inamount,o.post_time,TO_DAYS(o.end_time)-TO_DAYS(NOW()) time,u.credit FROM webpk.offers o,webpk.products p,webpk.users u  WHERE o.trade=0 and p.title like '%服务器%' and p.productsid=o.productsid and o.email=u.email";
		
		

		try {
			stmt = conn.createStatement();
			rs = stmt.executeQuery(sql1);
			Index oin = null;
			while (rs.next()) {
				oin = new Index();
				oin.setTitle(rs.getString("title"));
				oin.setInamount(rs.getInt("Inamount"));				
				oin.setTime(rs.getInt("time"));
				oin.setPost_time(rs.getDate("post_time"));				
				oin.setCredit(rs.getInt("credit"));
				ilist.add(oin);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			DBConnection.closeConn();
		}
		return ilist;
	}
	
	public List<Index> getFuYin() {

		Connection conn = DBConnection.getConn();
		Statement stmt = null;
		ResultSet rs = null;

		List<Index> ilist = new ArrayList<Index>();
		String sql1 = "SELECT p.title,o.amount inamount,o.post_time,TO_DAYS(o.end_time)-TO_DAYS(NOW()) time,u.credit FROM webpk.offers o,webpk.products p,webpk.users u  WHERE o.trade=0 and p.title like '%复印机%' and p.productsid=o.productsid and o.email=u.email";
		
		

		try {
			stmt = conn.createStatement();
			rs = stmt.executeQuery(sql1);
			Index oin = null;
			while (rs.next()) {
				oin = new Index();
				oin.setTitle(rs.getString("title"));
				oin.setInamount(rs.getInt("Inamount"));				
				oin.setTime(rs.getInt("time"));
				oin.setPost_time(rs.getDate("post_time"));				
				oin.setCredit(rs.getInt("credit"));
				ilist.add(oin);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			DBConnection.closeConn();
		}
		return ilist;
	}
	
	public List<Index> getLuYou() {

		Connection conn = DBConnection.getConn();
		Statement stmt = null;
		ResultSet rs = null;

		List<Index> ilist = new ArrayList<Index>();
		String sql1 = "SELECT p.title,o.amount inamount,o.post_time,TO_DAYS(o.end_time)-TO_DAYS(NOW()) time,u.credit FROM webpk.offers o,webpk.products p,webpk.users u  WHERE o.trade=0 and p.title like '%路由器%' and p.productsid=o.productsid and o.email=u.email";
		
		

		try {
			stmt = conn.createStatement();
			rs = stmt.executeQuery(sql1);
			Index oin = null;
			while (rs.next()) {
				oin = new Index();
				oin.setTitle(rs.getString("title"));
				oin.setInamount(rs.getInt("Inamount"));				
				oin.setTime(rs.getInt("time"));
				oin.setPost_time(rs.getDate("post_time"));				
				oin.setCredit(rs.getInt("credit"));
				ilist.add(oin);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			DBConnection.closeConn();
		}
		return ilist;
	}
	
	public List<Index> getJiaoHuan() {

		Connection conn = DBConnection.getConn();
		Statement stmt = null;
		ResultSet rs = null;

		List<Index> ilist = new ArrayList<Index>();
		String sql1 = "SELECT p.title,o.amount inamount,o.post_time,TO_DAYS(o.end_time)-TO_DAYS(NOW()) time,u.credit FROM webpk.offers o,webpk.products p,webpk.users u  WHERE o.trade=0 and p.title like '%交换机%' and p.productsid=o.productsid and o.email=u.email";
		
		

		try {
			stmt = conn.createStatement();
			rs = stmt.executeQuery(sql1);
			Index oin = null;
			while (rs.next()) {
				oin = new Index();
				oin.setTitle(rs.getString("title"));
				oin.setInamount(rs.getInt("Inamount"));				
				oin.setTime(rs.getInt("time"));
				oin.setPost_time(rs.getDate("post_time"));				
				oin.setCredit(rs.getInt("credit"));
				ilist.add(oin);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			DBConnection.closeConn();
		}
		return ilist;
	}
	
	public List<Index> getXiangShui() {

		Connection conn = DBConnection.getConn();
		Statement stmt = null;
		ResultSet rs = null;

		List<Index> ilist = new ArrayList<Index>();
		String sql1 = "SELECT p.title,o.amount inamount,o.post_time,TO_DAYS(o.end_time)-TO_DAYS(NOW()) time,u.credit FROM webpk.offers o,webpk.products p,webpk.users u  WHERE o.trade=0 and p.title like '%香水%' and p.productsid=o.productsid and o.email=u.email";
		
		

		try {
			stmt = conn.createStatement();
			rs = stmt.executeQuery(sql1);
			Index oin = null;
			while (rs.next()) {
				oin = new Index();
				oin.setTitle(rs.getString("title"));
				oin.setInamount(rs.getInt("Inamount"));				
				oin.setTime(rs.getInt("time"));
				oin.setPost_time(rs.getDate("post_time"));				
				oin.setCredit(rs.getInt("credit"));
				ilist.add(oin);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			DBConnection.closeConn();
		}
		return ilist;
	}
	
	public List<Index> getHuaZhuang() {

		Connection conn = DBConnection.getConn();
		Statement stmt = null;
		ResultSet rs = null;

		List<Index> ilist = new ArrayList<Index>();
		String sql1 = "SELECT p.title,o.amount inamount,o.post_time,TO_DAYS(o.end_time)-TO_DAYS(NOW()) time,u.credit FROM webpk.offers o,webpk.products p,webpk.users u  WHERE o.trade=0 and p.title like '%化妆品%' and p.productsid=o.productsid and o.email=u.email";
		
		

		try {
			stmt = conn.createStatement();
			rs = stmt.executeQuery(sql1);
			Index oin = null;
			while (rs.next()) {
				oin = new Index();
				oin.setTitle(rs.getString("title"));
				oin.setInamount(rs.getInt("Inamount"));				
				oin.setTime(rs.getInt("time"));
				oin.setPost_time(rs.getDate("post_time"));				
				oin.setCredit(rs.getInt("credit"));
				ilist.add(oin);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			DBConnection.closeConn();
		}
		return ilist;
	}
	public List<Index> getBaoJian() {

		Connection conn = DBConnection.getConn();
		Statement stmt = null;
		ResultSet rs = null;

		List<Index> ilist = new ArrayList<Index>();
		String sql1 = "SELECT p.title,o.amount inamount,o.post_time,TO_DAYS(o.end_time)-TO_DAYS(NOW()) time,u.credit FROM webpk.offers o,webpk.products p,webpk.users u  WHERE o.trade=0 and p.title like '%保健%' and p.productsid=o.productsid and o.email=u.email";
		
		

		try {
			stmt = conn.createStatement();
			rs = stmt.executeQuery(sql1);
			Index oin = null;
			while (rs.next()) {
				oin = new Index();
				oin.setTitle(rs.getString("title"));
				oin.setInamount(rs.getInt("Inamount"));				
				oin.setTime(rs.getInt("time"));
				oin.setPost_time(rs.getDate("post_time"));				
				oin.setCredit(rs.getInt("credit"));
				ilist.add(oin);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			DBConnection.closeConn();
		}
		return ilist;
	}
} 
最近下载更多
li739784276  LV6 2022年8月16日
男波one  LV1 2022年5月10日
skook7  LV2 2022年4月29日
微信网友_5847813140320256  LV1 2022年2月25日
李拾壹  LV5 2022年1月2日
explorerwx  LV2 2021年10月2日
刘晴天  LV1 2021年5月6日
xxpphh  LV1 2021年3月17日
王伟杰  LV2 2021年1月6日
乔鹿野  LV6 2020年12月23日
最近浏览更多
lllajen 6月9日
暂无贡献等级
g11865095  LV1 5月14日
做自己的太阳  LV11 4月23日
2206371875  LV7 3月14日
try8023  LV19 1月16日
微信网友_6641066057273344  LV1 2023年10月27日
520131  LV5 2023年7月1日
1613619109  LV6 2023年3月25日
我是超爱学习 2023年2月28日
暂无贡献等级
fantesy  LV17 2023年1月16日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友