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

📄 count.java

📁 这个程序是花了好几十万请人开发的
💻 JAVA
字号:
/**
 * @author 郑文金
 *这个类用于在office_index.do页面上显示邮箱的邮件信息和发布供求信息的记录
 * 
 * 
 */
package javabean;
import java.sql.*;
public class Count 
{
	public  Connection con=null;
	public  ResultSet rs;
	private ConnectionPool pool;
	
	public Count() throws SQLException
	{
		pool=ConnectionPool.getInstance();               //初始化连接池						
	}
	
	public ResultSet query(String s) throws SQLException
	{
		try
		{			
			con=pool.getConnection();  //从池中获得一个连接				
			Statement sql = con.createStatement();
			rs=sql.executeQuery(s);	
		}
		catch(SQLException e)
		{
			System.err.println(e.getMessage());
		}
		con.close();	
		return rs;	
	}
	
	public int mail_inboxCount(String uid) throws SQLException//获取收件箱的邮件的封数
	{
		int inboxcount=0;
		
		try
		{
			int sid=0;
			String s="select * from member where uuid= "+"'"+uid+"'";
			ResultSet rs=query(s);
			while(rs.next())
			{
				sid=rs.getInt("id");
			}
			rs.close();
			
			String str="select count(ID) as n from mail_inbox where sid= "+"'"+sid+"'";
			rs=query(str);
			while(rs.next())
			{
				inboxcount=rs.getInt("n");
			}
			con.close();
		}
		catch(SQLException e)
		{
			System.err.print(e.getMessage());
		}
		return inboxcount;
	}
	
	public int newCount(String uid) throws SQLException//获取新的邮件数
	{
		int newcount=0;
		String s="true";
		try
		{
			int sid=0;
			String s1="select * from member where uuid= "+"'"+uid+"'";
			ResultSet rs=query(s1);
			while(rs.next())
			{
				sid=rs.getInt("id");
			}
			rs.close();
			
			String str="select count(ID) as n from mail_inbox where READFLAG= "+"'"+s+"'"+" and sid= "+"'"+sid+"'";
			rs=query(str);
			while(rs.next())
			{
				newcount=rs.getInt("n");
			}	
			con.close();	
		}
		catch(SQLException e)
		{
			System.err.print(e.getMessage());
		}
		return newcount;
	}
	
	public int mail_outboxCount(String uid) throws SQLException//获取发件箱的邮件的数量
	{
		int n=0;
		try
		{
			
			String str="select count(ID) as n from mail_outbox where UUID="+"'"+uid+"'";
			rs=query(str);
			while(rs.next())
			{
				n=rs.getInt("n");
			}
			con.close();
		}
		catch(SQLException e)
		{
			System.err.print(e.getMessage());
		}
		return n;
	}
	
	public int gqxxfb_count(String uid)throws SQLException//获取会员发布供求信息的条数
	{
		int n=0;
		try
		{
			String str="select fabu from member where UUID= "+"'"+uid+"'";
			rs=query(str);
			while(rs.next())
			{
				n=rs.getInt("fabu");
			}
			con.close();
		}
		catch(SQLException e)
		{
			System.err.print(e.getMessage());
		}
		return n;
	}


}

⌨️ 快捷键说明

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