📄 supersettingdb.java
字号:
/**
* 数据库类:负责高级设置的增、删、改、查
*/
package bbs.db;
import bbs.bean.SuperSetting;
import com.db.Databasec;
import java.util.*;
import java.sql.*;
public class SuperSettingDB extends Databasec {
String sql = null;
private ResultSet res;
public ArrayList select(String tabName) throws Exception {
return null;
}
/**
* 查询所有高级设置
* @return SuperSetting
* @throws Exception
*/
public SuperSetting select() throws Exception
{
SuperSetting obj = new SuperSetting();
try{
this.open();
sql = "select * from bbsDetails";
pst = con.prepareStatement(sql);
res = pst.executeQuery();
if(res.next())
{
obj.setIssend(res.getInt(1));
obj.setIsreply(res.getInt(2));
obj.setIsauditing(res.getInt(3));
obj.setIsdegrade(res.getInt(4));
}
}
finally{
this.close();
}
return obj;
}
/**
* 更新所有设置
* @param obj SuperSetting
* @return int
* @throws Exception
*/
public int update(SuperSetting obj) throws Exception
{
try {
this.open();
sql = "update bbsDetails set ISsend=?,ISReply=?,ISAuditing=?,ISdegrade=?";
pst = con.prepareStatement(sql);
pst.setInt(1,obj.getIssend());
pst.setInt(2,obj.getIsreply());
pst.setInt(3,obj.getIsauditing());
pst.setInt(4,obj.getIsdegrade());
return pst.executeUpdate();
}
finally {
this.close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -