北风网上海讲师–权限模块上 avi
文章类别:
快捷索引
课程中代码齐全,是一个完整的项目
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);
}
});
}
北风网上海讲师–权限模块上 avi → https://www.books51.com/8839.html |
下一篇: 从管理和运营的角度看IT系列 iso
最新评论