SelectMail.java
上传用户:liangcc
上传日期:2019-05-24
资源大小:4412k
文件大小:1k
- package com.softeem.webmail.sendbox;
- import java.sql.Connection;
- import java.sql.PreparedStatement;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import java.util.ArrayList;
- import java.util.List;
- import com.softeem.webmail.dao.DBManager;
- public class SelectMail {
- public List select(String name) {
- Connection con = DBManager.getConnection();
- String sql = "select *from mail where mail_from = ? and box_name = ?";
- ResultSet rs = null;
- List list = new ArrayList();
- PreparedStatement ps;
- try {
- ps = con.prepareStatement(sql);
- ps.setString(1, name);
- ps.setString(2, "sendbox");
- rs = ps.executeQuery();
- while (rs.next()) {
- SendboxBean pf = new SendboxBean();
- pf.setId(rs.getInt("id"));
- pf.setMail_from(rs.getString("mail_from"));
- pf.setMail_to(rs.getString("mail_to"));
- pf.setSubject(rs.getString("subject"));
- pf.setContent(rs.getString("content"));
- pf.setDate(rs.getString("date"));
- pf.setSize(rs.getFloat("size"));
- pf.setStat(rs.getString("stat"));
- pf.setAdds(rs.getString("adds"));
- list.add(pf);
- }
- } catch (SQLException e) {
- e.printStackTrace();
- }
- return list;
- }
- }