mailboxinfor.java

来自「功能是公安和学校的管理系统,用struts+hibernate+spring等匡」· Java 代码 · 共 86 行

JAVA
86
字号
package com.comingnet.bean;
import com.db.*;
import java.sql.*;
public class MailBoxInfor {
	
	private Connection conn=null;
	private PreparedStatement stmt=null;
	ResultSet rs=null;
	private int mailcount=0;
	private int mailnoReadcount=0;
	private int maildx=0;
	
	
	public int getMailcount() {
		return mailcount;
	}
	public void setMailcount(int mailcount) {
		this.mailcount = mailcount;
	}
	public int getMaildx() {
		return maildx;
	}
	public void setMaildx(int maildx) {
		this.maildx = maildx;
	}
	public int getMailnoReadcount() {
		return mailnoReadcount;
	}
	public void setMailnoReadcount(int mailnoReadcount) {
		this.mailnoReadcount = mailnoReadcount;
	}
	
	
	public void getMailInfor(int ryid,String ryclass,int xxbh,int rywjj)
	{
	    try
	    {
	    	conn=DBUtils.getConnection();
	    	stmt=conn.prepareStatement("select count(*) from yjsj where ryid=? and ryclass=? and xxbh=?  and rywjj = ?");
	    	stmt.setInt(1,ryid);
	    	stmt.setString(2,ryclass);
	    	stmt.setInt(3,xxbh);
	    	stmt.setInt(4, rywjj) ;
	    	rs=stmt.executeQuery();
	    	if(rs.next())
	    	{
	    		mailcount=rs.getInt(1);	
	    	}
	    	DBUtils.closeStatement(stmt);
	    	
	    	stmt=conn.prepareStatement("select count(*) from yjsj where ryid=? and ryclass=? and xxbh=?  and ryydbz='0' and rywjj=?");
	    	stmt.setInt(1,ryid);
	    	stmt.setString(2,ryclass);
	    	stmt.setInt(3,xxbh);
	    	stmt.setInt(4, rywjj) ;
	    	rs=stmt.executeQuery();
	    	if(rs.next())
	    	{
	    		mailnoReadcount=rs.getInt(1);	
	    	}
	    	DBUtils.closeStatement(stmt);
	    	
	    	stmt=conn.prepareStatement("select sum(DATALENGTH(yjnr)) as yjdx from yjsj a,yjxx b where  a.yjid=b.yjid  and  a.ryid=? and ryclass=? and xxbh=? and a.rywjj=?");
	    	stmt.setInt(1,ryid);
	    	stmt.setString(2,ryclass);
	    	stmt.setInt(3,xxbh);
	    	stmt.setInt(4, rywjj) ;
	    	rs=stmt.executeQuery();
	    	if(rs.next())
	    	{
	    		maildx=rs.getInt(1);	
	    	}
	    	DBUtils.closeStatement(stmt); 
	    	
	    }catch(Exception e)
	    {
	    	System.out.println(e);
	    }finally
	    {
	    	DBUtils.closeResultSet(rs);
	    	DBUtils.closeStatement(stmt);
	    	DBUtils.closeConnection(conn);
	    }
	}
}

⌨️ 快捷键说明

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