快捷索引

IPB Image

IPB Image

IPB Image

课程中代码齐全,是一个完整的项目
private RightDAO(){

}
private static RightDAO rightDAO;
public static RightDAO getInstance(){
if(rightDAO == null)
rightDAO = new RightDAO();
return rightDAO;
}

public void insertRight(Rights right) throws SQLException{
Connection conn = this.getConnection();
String sql = "insert into rights values(0,?)";
PreparedStatement ps = conn.prepareStatement(sql);
ps.setString(1, right.getRightName());
int i = ps.executeUpdate();
if(i<=0)
throw new SQLException("插入数据出现了错误");
}
public Rights getRightsById(final int id) throws SQLException{

return getRights(new RightGetter(){

public String addCondition() {
return "rightId = ?";
}

public void setValue(PreparedStatement ps) throws SQLException {
ps.setInt(1, id);
}

});
}



会员福利

资源无源时,可利用百度网盘 & 迅雷云盘取回

此内容仅供注册用户。请 %登录%.

神秘内容,请 登录 / 注册 后查看

会员可见全站福利 !




文章类别:

本文链接: http://www.books51.com/8839.html

【点击下方链接,复制 & 分享文章网址】

北风网上海讲师–权限模块上 avi → http://www.books51.com/8839.html

上一篇:

下一篇:

0 ratings, 0 votes0 ratings, 0 votes (0 次顶, 0已投票)
你必须注册后才能投票!
Loading...

添加新评论