/**
* @author �����
* @version 1.1
* @date 2008.09.09
* ��˵��������ڲ���ظ���Ϣ�� �� ɾ �� ��
* �������£�1.���ǰ̨�Ŀؼ���Ϣ����Revert������в���
* 2.��ݻظ���Ϣ�Ķ��������
* 3.��ݻظ���Ϣ��ID����ɾ��
* 4.��ѯȫ����Ϣ
* 5.��ݻظ���Ϣ��ID��ѯһ����Ϣ
* 6.���MessageID��ѯһ����Ϣ
* 7.�����ϢID��ѯһ����߸��Ļظ�
*/
package dao;
import entity.*;
import db.ConnectionManager;
import java.util.*;
import java.sql.*;
public class RevertDAO {
//�˷������ڣ� 1.���ǰ̨�Ŀؼ���Ϣ����Revert������в���
public int insertRevert(Revert rvt)
{
int i = 0;
Connection con = null;
PreparedStatement pstmt = null;
String sql = "insert into REVERT values(?,?,?,?)";
con = ConnectionManager.getConnection();
try {
pstmt = con.prepareStatement(sql);
pstmt.setInt(1, rvt.getMessageID());
pstmt.setString(2, rvt.getContent());
pstmt.setString(3, rvt.getWriter());
pstmt.setString(4, rvt.getWriteDate());
i = pstmt.executeUpdate();
return i;
} catch (SQLException e) {
e.printStackTrace();
}finally{
ConnectionManager.closeAll(null, pstmt, con);
}
return i;
}
//�˷������ڣ� 2.��ݻظ���Ϣ�Ķ��������
public void updateRevertById(Revert rvt)
{
Connection con = null;
PreparedStatement pstmt = null;
String sql = "update REVERT set content=?,writer=?,writeDate=? where revertID =?";
con = ConnectionManager.getConnection();
try {
pstmt = con.prepareStatement(sql);
pstmt.setString(1,rvt.getContent());
pstmt.setString(2,rvt.getWriter());
pstmt.setString(3,rvt.getWriteDate());
pstmt.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}finally{
ConnectionManager.closeAll(null, pstmt, con);
}
}
//�˷������ڣ� 3.��ݻظ���Ϣ��ID����ɾ��
public int deleteRevertById(int id)
{
int i = 0;
Connection con = null;
PreparedStatement pstmt = null;
String sql = "delete from REVERT where revertID =?";
con = ConnectionManager.getConnection();
try {
pstmt = con.prepareStatement(sql);
pstmt.setInt(1,id);
i = pstmt.executeUpdate();
return i;
} catch (SQLException e) {
e.printStackTrace();
}finally{
ConnectionManager.closeAll(null, pstmt, con);
}
return i;
}
//�˷������ڣ� 4.��ѯȫ����Ϣ
public ArrayList<Revert> selectAllRevert()
{
ArrayList<Revert> arr = new ArrayList<Revert>();
Connection con = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "select * from REVERT";
con = ConnectionManager.getConnection();
try {
pstmt = con.prepareStatement(sql);
rs = pstmt.executeQuery();
while(rs.next())
{
Revert rvt = new Revert();
rvt.setRevertID(rs.getInt("revertID"));
rvt.setMessageID(rs.getInt("messageID"));
rvt.setContent(rs.getString("content"));
rvt.setWriter(rs.getString("writer"));
rvt.setWriteDate(rs.getString("writeDate"));
arr.add(rvt);
}
return arr;
} catch (SQLException e) {
e.printStackTrace();
return arr;
}finally{
ConnectionManager.closeAll(rs, pstmt, con);
}
}
//�˷������ڣ� 5.��ݻظ���Ϣ��ID��ѯһ����Ϣ
public Revert selectRevertById(int id)
{
Revert rvt = null;
Connection con = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "select * from REVERT where revertID =?";
con = ConnectionManager.getConnection();
try {
pstmt = con.prepareStatement(sql);
pstmt.setInt(1,id);
rs = pstmt.executeQuery();
if(rs.next())
{
rvt = new Revert();
rvt.setRevertID(rs.getInt("revertID"));
rvt.setMessageID(rs.getInt("messageID"));
rvt.setContent(rs.getString("content"));
rvt.setWriter(rs.getString("writer"));
rvt.setWriteDate(rs.getString("writeDate"));
}
} catch (SQLException e) {
e.printStackTrace();
}finally{
ConnectionManager.closeAll(rs, pstmt, con);
}
return rvt;
}
//�˷������ڣ� 6.���MessageID��ѯһ����Ϣ
public Revert selectRevertByMessageID(int id)
{
Revert rvt = null;
Connection con = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "select * from REVERT where messageID =?";
con = ConnectionManager.getConnection();
try {
pstmt = con.prepareStatement(sql);
pstmt.setInt(1,id);
rs = pstmt.executeQuery();
if(rs.next())
{
rvt = new Revert();
rvt.setRevertID(rs.getInt("revertID"));
rvt.setMessageID(rs.getInt("messageID"));
rvt.setContent(rs.getString("content"));
rvt.setWriter(rs.getString("writer"));
rvt.setWriteDate(rs.getString("writeDate"));
}
} catch (SQLException e) {
e.printStackTrace();
}finally{
ConnectionManager.closeAll(rs, pstmt, con);
}
return rvt;
}
//�˷������ڣ� 7.�����ϢID��ѯһ����߸��Ļظ�
public ArrayList<Revert> selectAllRevertByMessageID(int id)
{
ArrayList<Revert> arr = new ArrayList<Revert>();
Revert rvt = null;
Connection con = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "select * from REVERT where messageID =?";
con = ConnectionManager.getConnection();
try {
pstmt = con.prepareStatement(sql);
pstmt.setInt(1,id);
rs = pstmt.executeQuery();
while(rs.next())
{
rvt = new Revert();
rvt.setMessageID(rs.getInt("messageID"));
rvt.setContent(rs.getString("content"));
rvt.setWriter(rs.getString("writer"));
rvt.setWriteDate(rs.getString("writeDate"));
arr.add(rvt);
}
} catch (SQLException e) {
e.printStackTrace();
}finally{
ConnectionManager.closeAll(rs, pstmt, con);
}
return arr;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
产品展示公司网站项目,新闻发布,在线留言 (232个子文件)
MessageDAO.class 5KB
RevertDAO.class 5KB
ProductDAO.class 4KB
ProductDAO.class 4KB
UsersDAO.class 4KB
MessageDAO.class 4KB
RevertDAO.class 4KB
UsersDAO.class 4KB
NewsDAO.class 4KB
NewsDAO.class 4KB
Product.class 2KB
Product.class 2KB
Message.class 2KB
Message.class 2KB
ConnectionManager.class 2KB
ConnectionManager.class 2KB
ProductTest.class 2KB
Revert.class 2KB
Revert.class 2KB
MessageBIZ.class 1KB
RevertBIZ.class 1KB
News.class 1KB
News.class 1KB
Users.class 1KB
Users.class 1KB
UsersBIZ.class 1KB
MessageBIZ.class 1KB
ProductBIZ.class 1KB
ProductBIZ.class 1KB
RevertBIZ.class 1KB
UsersBIZ.class 1KB
NewsBIZ.class 1014B
NewsBIZ.class 1014B
NewsBIZTest.class 820B
NewsBIZTest.class 798B
MessageBIZTest.class 467B
MessageBIZTest.class 467B
.classpath 410B
css.css 4KB
css.css 4KB
Thumbs.db 213KB
no_photo.gif 3KB
tg-8.gif 2KB
tg-6.gif 2KB
tg-9.gif 2KB
tg-3.gif 2KB
bookbg.gif 2KB
an5.gif 2KB
tg-5.gif 1KB
tg-4.gif 1KB
tg-7.gif 1KB
T_bottomright.gif 1KB
qq.gif 1KB
f1.gif 1KB
QQonline.gif 1KB
f3.gif 1KB
post.gif 1001B
back.gif 996B
titlemu_2.gif 888B
复件 titlemu_2.gif 888B
T_bottomleft.gif 886B
kefu_down.gif 759B
f2.gif 740B
title.gif 718B
T_right.gif 672B
T_left.gif 575B
sigline.gif 572B
kefu_middle.gif 484B
复件 titlemu_1.gif 412B
复件 titlemu_3.gif 410B
titlemu_1.gif 410B
titlemu_3.gif 408B
iboy.gif 125B
igirl.gif 124B
icon_arrow_r.gif 85B
T_bottombg.gif 84B
sqljdbc.jar 227KB
sqljdbc.jar 227KB
RevertDAO.java 6KB
MessageDAO.java 6KB
ProductDAO.java 4KB
UsersDAO.java 4KB
NewsDAO.java 4KB
MessageBIZTest.java 3KB
MessageBIZ.java 2KB
Product.java 2KB
RevertBIZ.java 1KB
Message.java 1KB
Revert.java 1KB
UsersBIZ.java 1KB
ConnectionManager.java 1KB
ProductBIZ.java 1KB
News.java 1KB
Users.java 1KB
NewsBIZ.java 1011B
ProductTest.java 721B
NewsBIZTest.java 385B
d_r1_c1_z.jpg 40KB
welcome.jpg 34KB
d_r1_c1.jpg 21KB
共 232 条
- 1
- 2
- 3
资源评论
- huoshandong2014-07-16有一定的参考价值
- 刹那2015-09-21发觉是java的……我想要的是C#,java看不懂……
机场信息系统研究员
- 粉丝: 718
- 资源: 31
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 论文(最终)_20240430235101.pdf
- 基于python编写的Keras深度学习框架开发,利用卷积神经网络CNN,快速识别图片并进行分类
- 最全空间计量实证方法(空间杜宾模型和检验以及结果解释文档).txt
- 5uonly.apk
- 蓝桥杯Python组的历年真题
- 2023-04-06-项目笔记 - 第一百十九阶段 - 4.4.2.117全局变量的作用域-117 -2024.04.30
- 2023-04-06-项目笔记 - 第一百十九阶段 - 4.4.2.117全局变量的作用域-117 -2024.04.30
- 前端开发技术实验报告:内含4四实验&实验报告
- Highlight Plus v20.0.1
- 林周瑜-论文.docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功