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

📄 .#messinfodao.java.1.1

📁 实现办公自动化系统
💻 1
字号:
package com.oa.struts.perOffice.modle;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import com.oa.util.DBConn;

public class MessInfoDAO {
	
	Connection con=null;
	PreparedStatement pstmt=null;
	ResultSet rs=null;
	DBConn db=null;
	public MessInfoDAO() {
		super();
		// TODO Auto-generated constructor stub
	}
//插入新消息	
	public boolean insertItem(MessInfo info)
	{
		boolean result=false;
		try
		{
			String sql="insert into tb_mesInfo values(?,?,?,?)";
			db=new DBConn();
			con=db.getConnection();
			pstmt=con.prepareStatement(sql);
			pstmt.setString(1,info.getTitle());
			pstmt.setString(2,info.getContent());
			pstmt.setInt(3,info.getSenderID());
			pstmt.setInt(4,info.getAccepterID());
			pstmt.setInt(2,info.getIsRead());
			
			
		
			int i=pstmt.executeUpdate();
			System.out.println("i="+i);
			if(i>0)
			{
				result=true;
			}
				
			if(pstmt!=null) pstmt.close();
			if(con!=null) con.close();		
			
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
		
		return result;
   }
	
	
//查询已发送消息
	
	public List searchSended(MessInfo info)
	{
		
		List lt=new ArrayList();
		try
		{
			String sql="select * from tb_addressBook where userID=?,userName=?";
			db=new DBConn();
			con=db.getConnection();
			pstmt=con.prepareStatement(sql);
			pstmt.setInt(1,book.getUserID());
			pstmt.setString(2,book.getUserName());
			rs=pstmt.executeQuery();
			
			while(rs.next())
			{
				int userID=rs.getInt(2);
				String userName=rs.getString(3);
				int phone=rs.getInt(4);
				int officeTel=rs.getInt(5);
				String QQ=rs.getString(6);
				String email=rs.getString(7);
				String address=rs.getString(8);
				lt.add(info);
			}
			
			if(rs!=null) rs.close();
			if(pstmt!=null) pstmt.close();
			if(con!=null) con.close();		
			
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}	
		return lt;
	}
	
	
	
	
	
	

}

⌨️ 快捷键说明

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