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

📄 pagecutbean.java

📁 oa办公管理系统。一些小型的企业办公管理用的系统。一个月废寝忘食的结果。
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
				if(res!=null)
					res.close();
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
		return list;
	}
	
	public List getAllContact(String condition,String employeeName)
	{
		List<ContactInfo> list = new ArrayList<ContactInfo>();
		try {
			conn=tj.getConnection();
			conn.setAutoCommit(false);
			String sql="select cl.*,e.name,d.departmentname,d.departmentid from contactlist cl,employee e,department d where cl.employeeid=e.employeeid and e.departmentid=d.departmentid";
			
			int k=-1;
			try
			{	if(condition!=null&&!condition.equals("所有"))
				{
					k=Integer.parseInt(condition);
				}
			}
			catch(NumberFormatException e)
			{k=-1;}
			catch(Exception e)
			{
				k=-1;
			}
			
			if(k!=-1)
			{
				System.out.println("执行到PagecountBEAN ,部门编号为:"+k);
				sql=" select * from ("+sql+") where departmentid="+k+" ";
			}
			
			if(employeeName!=null&&!employeeName.trim().equals("")&&!employeeName.equals("null"))
			{
				System.out.println("这边是不能执行的、、、、、、、、、");
				sql="select * from ("+sql+") where name like '%"+employeeName+"%'";
			}
			
			st=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
			res=new PageableResultSet(st.executeQuery(sql));//构造一个Pageable
			res.setPageSize(getPageSize());//每页5个记录
            System.out.println("每页显示的个数:"+getPageSize());
			//System.out.println("pagetcount:"+res.getPageCount()+"rowscount:"+res.getRowsCount()+"pagesize:"+res.getPageSize());
			res.gotoPage(getCurPage());
			PageCount=res.getPageCount();
			System.out.println("链接到的页数:"+getCurPage());
			rowsCount=res.getRowsCount();
			PageRowsCount=res.getPageRowsCount();
			
			System.out.println("employeeid的值为:"+res.getInt("employeeid"));
			
			for(int i=0; i<res.getPageRowsCount(); i++)
			{
				System.out.println("111111111111111111111111111111");
				//res.absolute((getCurPage() - 1) * getPageSize() + 1);
				//System.out.println("当前显示的记录数为:"+res.getPageRowsCount());
				//System.out.println("这里的ID为:"+res.getInt("equipmentid"));
				ContactInfo contactInfo=new ContactInfo();
				
				contactInfo.setEmployeeId(res.getInt("employeeid"));
				contactInfo.setMobilePhone(res.getString("mobilephone"));
				contactInfo.setQQ(res.getString("QQ"));
				contactInfo.setMSN(res.getString("msn"));
				contactInfo.setEmail(res.getString("email"));
				contactInfo.setDepartmentName(res.getString("departmentname"));
				contactInfo.setEmployeeName(res.getString("name"));
				//System.out.println("此处也正常");
				list.add(contactInfo);
				res.next();
			}
		    conn.commit();
		} catch (SQLException e) {
			
			try {
				if(conn!=null)
				{
					conn.rollback();//事务回滚
				}
			} catch (SQLException e1) {
				
				e1.printStackTrace();
			}
			e.printStackTrace();
		}
		finally
		{
			try {
				if(conn!=null)
				{
					conn.close();
				}
				if(ps!=null)
				{
					ps.close();
				}
				if(rs!=null)
				{
					rs.close();
				}
				if(res!=null)
					res.close();
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
		return list;
	}
	
	public List getMessage(int employeeid)
	{
		List<MessageInfo> list = new ArrayList<MessageInfo>();
		try {
			conn=tj.getConnection();
			conn.setAutoCommit(false);
			
			st=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
			String sql="select m.sender,to_char(m.sendtime,'yyyy-mm-dd hh24:mi:ss') st,m.receiver,m.content,m.issend,m.isread,m.theme,e.name from message m,employee e where m.sender=e.employeeid and m.receiver="+employeeid+"";
			res=new PageableResultSet(st.executeQuery(sql));//构造一个Pageable
			res.setPageSize(getPageSize());//每页5个记录
            
			//System.out.println("pagetcount:"+res.getPageCount()+"rowscount:"+res.getRowsCount()+"pagesize:"+res.getPageSize());
			res.gotoPage(getCurPage());
			PageCount=res.getPageCount();
			rowsCount=res.getRowsCount();
			PageRowsCount=res.getPageRowsCount();
			
			//System.out.println("current page:"+res.getCurPage());
			
			for(int i=0; i<res.getPageRowsCount(); i++)
			{
				//res.absolute((getCurPage() - 1) * getPageSize() + 1);
				System.out.println("当前显示的记录数为:"+res.getPageRowsCount());
				//System.out.println("这里的ID为:"+res.getInt("equipmentid"));
				MessageInfo messageInfo=new MessageInfo();
				messageInfo.setTheme(res.getString("theme"));
				messageInfo.setContent(res.getString("content"));
				messageInfo.setName(res.getString("name"));
				messageInfo.setIsRead(res.getInt("isread"));
				messageInfo.setIsSend(res.getInt("issend"));
				messageInfo.setEmployeeid(res.getInt("sender"));
				messageInfo.setSendtime(res.getString("st"));
				//System.out.println("执行到这里,无错误");
				list.add(messageInfo);
				res.next();
			}
		    conn.commit();
		} catch (SQLException e) {
			
			try {
				if(conn!=null)
				{
					conn.rollback();//事务回滚
				}
			} catch (SQLException e1) {
				
				e1.printStackTrace();
			}
			e.printStackTrace();
		}
		finally
		{
			try {
				if(conn!=null)
				{
					conn.close();
				}
				if(ps!=null)
				{
					ps.close();
				}
				if(rs!=null)
				{
					rs.close();
				}
				if(res!=null)
					res.close();
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
		return list;
	}
	
	public List getUnreadMessage(int employeeid)
	{
		List<MessageInfo> list = new ArrayList<MessageInfo>();
		try {
			conn=tj.getConnection();
			conn.setAutoCommit(false);
			
			st=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
			String sql="select m.sender,to_char(m.sendtime,'yyyy-mm-dd hh24:mi:ss') st,m.receiver,m.content,m.issend,m.isread,m.theme,e.name from message m,employee e where m.sender=e.employeeid and m.receiver="+employeeid+" and isread=0";
			res=new PageableResultSet(st.executeQuery(sql));//构造一个Pageable
			res.setPageSize(getPageSize());//每页5个记录
            
			//System.out.println("pagetcount:"+res.getPageCount()+"rowscount:"+res.getRowsCount()+"pagesize:"+res.getPageSize());
			res.gotoPage(getCurPage());
			PageCount=res.getPageCount();
			rowsCount=res.getRowsCount();
			PageRowsCount=res.getPageRowsCount();
			
			//System.out.println("current page:"+res.getCurPage());
			for(int i=0; i<res.getPageRowsCount(); i++)
			{
				//res.absolute((getCurPage() - 1) * getPageSize() + 1);
				//System.out.println("当前显示的记录数为:"+res.getPageRowsCount());
				//System.out.println("这里的ID为:"+res.getInt("equipmentid"));
				MessageInfo messageInfo=new MessageInfo();
				messageInfo.setTheme(res.getString("theme"));
				messageInfo.setContent(res.getString("content"));
				messageInfo.setName(res.getString("name"));
				messageInfo.setIsRead(res.getInt("isread"));
				messageInfo.setIsSend(res.getInt("issend"));
				messageInfo.setEmployeeid(res.getInt("sender"));
				messageInfo.setSendtime(res.getString("st"));
				//System.out.println("执行到这里,无错误");
				list.add(messageInfo);
				System.out.println("此处处理正常");
				res.next();
			}
		    conn.commit();
		} catch (SQLException e) {
			
			try {
				if(conn!=null)
				{
					conn.rollback();//事务回滚
				}
			} catch (SQLException e1) {
				
				e1.printStackTrace();
			}
			e.printStackTrace();
		}
		finally
		{
			try {
				if(conn!=null)
				{
					conn.close();
				}
				if(ps!=null)
				{
					ps.close();
				}
				if(rs!=null)
				{
					rs.close();
				}
				if(res!=null)
					res.close();
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
		return list;
	}
	
	public List getSendedMessage(int employeeid)
	{
		List<MessageInfo> list = new ArrayList<MessageInfo>();
		try {
			conn=tj.getConnection();
			conn.setAutoCommit(false);
			
			st=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
			String sql="select m.sender,to_char(m.sendtime,'yyyy-mm-dd hh24:mi:ss') st,m.receiver,m.content,m.issend,m.isread,m.theme,e.name from message m,employee e where m.receiver=e.employeeid and m.sender="+employeeid+" and issend=1";
			res=new PageableResultSet(st.executeQuery(sql));//构造一个Pageable
			res.setPageSize(getPageSize());//每页5个记录
            
			//System.out.println("pagetcount:"+res.getPageCount()+"rowscount:"+res.getRowsCount()+"pagesize:"+res.getPageSize());
			res.gotoPage(getCurPage());
			PageCount=res.getPageCount();
			rowsCount=res.getRowsCount();
			PageRowsCount=res.getPageRowsCount();
			
			//System.out.println("current page:"+res.getCurPage());
			
			for(int i=0; i<res.getPageRowsCount(); i++)
			{
				//res.absolute((getCurPage() - 1) * getPageSize() + 1);
				//System.out.println("当前显示的记录数为:"+res.getPageRowsCount());
				//System.out.println("这里的ID为:"+res.getInt("equipmentid"));
				MessageInfo messageInfo=new MessageInfo();
				messageInfo.setTheme(res.getString("theme"));
				messageInfo.setContent(res.getString("content"));
				messageInfo.setName(res.getString("name"));
				messageInfo.setIsRead(res.getInt("isread"));
				messageInfo.setIsSend(res.getInt("issend"));
				messageInfo.setEmployeeid(res.getInt("sender"));
				messageInfo.setSendtime(res.getString("st"));
				//System.out.println("执行到这里,无错误");
				list.add(messageInfo);
				res.next();
			}
		    conn.commit();
		} catch (SQLException e) {
			
			try {
				if(conn!=null)
				{
					conn.rollback();//事务回滚
				}
			} catch (SQLException e1) {
				
				e1.printStackTrace();
			}
			e.printStackTrace();
		}
		finally
		{
			try {
				if(conn!=null)
				{
					conn.close();
				}
				if(ps!=null)
				{
					ps.close();
				}
				if(rs!=null)
				{
					rs.close();
				}
				if(res!=null)
					res.close();
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
		return list;
	}
	
	public List getDrafMessage(int employeeid)
	{
		List<MessageInfo> list = new ArrayList<MessageInfo>();
		try {
			conn=tj.getConnection();
			conn.setAutoCommit(false);
			
			st=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
			String sql="select m.sender,to_char(m.sendtime,'yyyy-mm-dd hh24:mi:ss') st,m.receiver,m.content,m.issend,m.isread,m.theme,e.name from message m,employee e where m.receiver=e.employeeid and m.issend=0 and sender="+employeeid+"";
			res=new PageableResultSet(st.executeQuery(sql));//构造一个Pageable
			res.setPageSize(getPageSize());//每页5个记录
            
			//System.out.println("pagetcount:"+res.getPageCount()+"rowscount:"+res.getRowsCount()+"pagesize:"+res.getPageSize());
			res.gotoPage(getCurPage());
			PageCount=res.getPageCount();
			rowsCount=res.getRowsCount();
			PageRowsCount=res.getPageRowsCount();
			
			//System.out.println("current page:"+res.getCurPage());
			
			for(int i=0; i<res.getPageRowsCount(); i++)
			{
				//res.absolute((getCurPage() - 1) * getPageSize() + 1);
				//System.out.println("当前显示的记录数为:"+res.getPageRowsCount());
				//System.out.println("这里的ID为:"+res.getInt("equipmentid"));
				MessageInfo messageInfo=new MessageInfo();
				messageInfo.setTheme(res.getString("theme"));
				messageInfo.setContent(res.getString("content"));
				messageInfo.setName(res.getString("name"));
				messageInfo.setIsRead(res.getInt("isread"));
				messageInfo.setIsSend(res.getInt("issend"));
				messageInfo.setEmployeeid(res.getInt("sender"));
				messageInfo.setSendtime(res.getString("st"));
				//System.out.println("执行到这里,无错误");
				list.add(messageInfo);
				res.next();
			}
		    conn.commit();
		} catch (SQLException e) {
			
			try {
				if(conn!=null)
				{
					conn.rollback();//事务回滚
				}
			} catch (SQLException e1) {
				
				e1.printStackTrace();
			}
			e.printStackTrace();
		}
		finally
		{
			try {
				if(conn!=null)
				{
					conn.close();
				}
				if(ps!=null)
				{
					ps.close();
				}
				if(rs!=null)
				{
					rs.close();
				}
				if(res!=null)
					res.close();
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
		return list;
	}
}

⌨️ 快捷键说明

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