📄 rightdao.java
字号:
package com.oa.struts.systemManager.actorDAO;
import java.sql.*;
import com.oa.struts.vo.ActorInfo;
import com.oa.struts.vo.RightInfo;
import com.oa.util.DBConn;
public class RightDAO
{
private Connection con;
private PreparedStatement pstmt;
private Statement stmt;
private ResultSet rs;
private DBConn db;
public RightDAO()
{
}
public boolean insertRight(RightInfo rightInfo)
{
System.out.println("**************************************************");
boolean flag=false;
String sql="insert into tb_rights values(rights_seq.nextval,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
db=new DBConn();
try{
con=db.getConnection();
con.setAutoCommit(false);
pstmt=con.prepareStatement(sql);
pstmt.setInt(1, rightInfo.getAddUser());
pstmt.setInt(2, rightInfo.getDeleteUser());
pstmt.setInt(3, rightInfo.getUpdateUser());
pstmt.setInt(4, rightInfo.getUpload());
pstmt.setInt(5, rightInfo.getDownload());
pstmt.setInt(6, rightInfo.getDeleteFile());
pstmt.setInt(7, rightInfo.getUpdateFile());
pstmt.setInt(8, rightInfo.getRegisterRoom());
pstmt.setInt(9, rightInfo.getUpdateMeet());
pstmt.setInt(10, rightInfo.getCancelRoom());
pstmt.setInt(11, rightInfo.getAddEqu());
pstmt.setInt(12, rightInfo.getLaunchMeet());
pstmt.setInt(13, rightInfo.getReviewMeet());
pstmt.setInt(14, rightInfo.getUploadMeetNote());
pstmt.setInt(15,rightInfo.getUpdateRoom());
pstmt.setInt(16, rightInfo.getSetUserDaily());
int i=pstmt.executeUpdate();
if(i>0)
{
flag=true;
}
con.commit();
}
catch(SQLException e)
{
try{
if(con!=null)
{
con.rollback();
}
}
catch(SQLException e1)
{
e1.printStackTrace();
}
e.printStackTrace();
}
finally
{
try{
if(con!=null)
{con.close();}
if(pstmt!=null)
{
pstmt.close();
}
if(rs!=null)
{rs.close();}
}
catch(SQLException e2)
{e2.printStackTrace();}
}
return flag;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -