📄 sysconfbean.java
字号:
System.out.println("关闭记录集rs时出错" + e);
}
if (stmt != null)
try {
stmt.close();
} catch (Exception e) {
System.out.println("关闭声明时statement出错" + e);
}
}
sql = "update news.NB_FTPSET set FTPIP = '" + ip + "'";
executeUpdate(sql);
return 0;
}
//删除信息
public int delData() {
String sql = "";
String strSYZT = "1";
switch (type) {
case 14:
sql = "delete from news.NB_ZYSZB where ID = " + id + "";
break;
case 15:
sql = "delete from news.NB_YSB where ID = " + id + "";
break;
case 21:
sql = "delete from news.NB_LINK where LINKID = " + id + "";
break;
default:
break;
}
return deleteRecord(sql);
}
//把模块名称转化为模块编号
public String toId(String name) {
String sql = "";
sql = "select distinct ID1 from news.MENU where MENU1 = '" + name + "'";
ResultSet rs = selectRecord(sql);
Statement stmt = null;
try {
if (rs.next()) {
String strId = ds.toString(rs.getString("ID1"));
return strId;
}
} catch (Exception e) {
System.out.println("运行时出错:" + e);
} finally {
if (rs != null)
try {
stmt = rs.getStatement();
rs.close();
} catch (Exception e) {
System.out.println("关闭记录集rs时出错" + e);
}
if (stmt != null)
try {
stmt.close();
} catch (Exception e) {
System.out.println("关闭声明时statement出错" + e);
}
}
return "0";
}
//把模块编号转化为模块名称
public String toName(String id) {
String sql = "";
sql = "select distinct MENU1 from news.MENU where ID1 = " + id + "";
ResultSet rs = selectRecord(sql);
Statement stmt = null;
try {
if (rs.next()) {
String strMenu = ds.toString(rs.getString("MENU1"));
return strMenu;
}
} catch (Exception e) {
System.out.println("运行时出错:" + e);
} finally {
if (rs != null)
try {
stmt = rs.getStatement();
rs.close();
} catch (Exception e) {
System.out.println("关闭记录集rs时出错" + e);
}
if (stmt != null)
try {
stmt.close();
} catch (Exception e) {
System.out.println("关闭声明时statement出错" + e);
}
}
return "0";
}
//初始化,模块信息
public void initMain() {
String sql = "";
String sql1 = "";
String strId = "";
Hashtable hash = new Hashtable();
String strNum = "12";
String strIsShowtime = "1";
hash.put("NUM", strNum);
hash.put("ISSHOWTIME", strIsShowtime);
//删除菜单中没有的模块
String sql2 = "";
sql2 = "select ID from news.NB_ZYSZB where ID<18";
ResultSet rs2 = selectRecord(sql2);
Statement stmt = null;
try {
while (rs2.next()) {
String strId2 = rs2.getString("ID");
String sql3 = "select * from news.MENU where ID1=" + strId2
+ "";
ResultSet rs3 = selectRecord(sql3);
try {
if (!rs3.next())
deleteRecord("delete from news.NB_ZYSZB where ID = "
+ strId2 + "");
} catch (Exception e) {
System.out.println("运行时出错:" + e);
} finally {
if (rs3 != null)
try {
stmt = rs3.getStatement();
rs3.close();
} catch (Exception e) {
System.out.println("关闭记录集rs时出错" + e);
}
if (stmt != null)
try {
stmt.close();
} catch (Exception e) {
System.out.println("关闭声明时statement出错" + e);
}
}
}
} catch (Exception e) {
System.out.println("运行时出错:" + e);
} finally {
if (rs2 != null)
try {
stmt = rs2.getStatement();
rs2.close();
} catch (Exception e) {
System.out.println("关闭记录集rs时出错" + e);
}
if (stmt != null)
try {
stmt.close();
} catch (Exception e) {
System.out.println("关闭声明时statement出错" + e);
}
}
//初始化没有的模块
sql = "select distinct ID1 from news.MENU";
ResultSet rs = selectRecord(sql);
try {
while (rs.next()) {
strId = rs.getString("ID1");
sql1 = "select * from news.NB_ZYSZB where ID = " + strId + "";
ResultSet rst = selectRecord(sql1);
try {
if (!rst.next()) {
hash.put("ID", strId);
addMain(hash);
}
} catch (Exception e) {
System.out.println("运行时出错:" + e);
} finally {
if (rst != null)
try {
stmt = rst.getStatement();
rst.close();
} catch (Exception e) {
System.out.println("关闭记录集rs时出错" + e);
}
if (stmt != null)
try {
stmt.close();
} catch (Exception e) {
System.out.println("关闭声明时statement出错" + e);
}
}
}
} catch (Exception e) {
System.out.println("运行时出错:" + e);
} finally {
if (rs != null)
try {
stmt = rs.getStatement();
rs.close();
} catch (Exception e) {
System.out.println("关闭记录集rs时出错" + e);
}
if (stmt != null)
try {
stmt.close();
} catch (Exception e) {
System.out.println("关闭声明时statement出错" + e);
}
}
}
//追加一个字符串
public String getBMBH(String strPersonNO)//取得当前人员所在部门的部门编号new
{
String sql = "";
String name = "";
sql = " select BMBH from news.ZZ_ZGB where ZGBH = '" + strPersonNO
+ "'";
ResultSet rs = selectRecord(sql);
Statement stmt = null;
try {
if (rs.next())
name = ds.toString(rs.getString("BMBH"));
} catch (Exception e) {
System.out.println("运行时出错:" + e);
} finally {
if (rs != null)
try {
stmt = rs.getStatement();
rs.close();
} catch (Exception e) {
System.out.println("关闭记录集rs时出错" + e);
}
if (stmt != null)
try {
stmt.close();
} catch (Exception e) {
System.out.println("关闭声明时statement出错" + e);
}
}
return name;
}
public String isWho(String zgbh) {//判断当前人员的身份new
String bmno = getBMBH(zgbh);
String sql = "";
String admin = "", ws = "";
if (bmno != null && !bmno.equals(""))
sql = " select GLYZWBH,WSZWBH from news.ZZ_BMB where BMBH = '"
+ bmno + "'";
ResultSet rs = selectRecord(sql);
Statement stmt = null;
try {
if (rs.next()) {
admin = ds.toString(rs.getString("GLYZWBH"));
ws = ds.toString(rs.getString("WSZWBH"));
if (admin.equals(zgbh)
|| (admin.equals(zgbh) && ws.equals(zgbh)))
return "bmadmin";
else if (ws.equals(zgbh))
return "bmws";
}
} catch (Exception e) {
System.out.println("运行时出错:" + e);
} finally {
if (rs != null)
try {
stmt = rs.getStatement();
rs.close();
} catch (Exception e) {
System.out.println("关闭记录集rs时出错" + e);
}
if (stmt != null)
try {
stmt.close();
} catch (Exception e) {
System.out.println("关闭声明时statement出错" + e);
}
}
return "person";
}
//是否可以给文章发表评论
public int setCom(String id) {
String sql = "";
Vector vect = new Vector();
vect.add("COMCONFB");
vect.add(addVector("ISFREE", id, "CHAR"));
sql = "select * from news.COMCONFB";
ResultSet rs = selectRecord(sql);
Statement stmt = null;
try {
if (!rs.next())
return insertRecord(vect);
} catch (Exception e) {
System.out.println("运行时出错:" + e);
} finally {
if (rs != null)
try {
stmt = rs.getStatement();
rs.close();
} catch (Exception e) {
System.out.println("关闭记录集rs时出错" + e);
}
if (stmt != null)
try {
stmt.close();
} catch (Exception e) {
System.out.println("关闭声明时statement出错" + e);
}
}
sql = "update news.COMCONFB set ISFREE = " + id + "";
executeUpdate(sql);
return 0;
}
public static void main(String args[]) {
SysConfBean mb = new SysConfBean();
//mb.setType(16);
//mb.setID("1");
System.out.println("begin\r\n\r\n");
Hashtable hash = new Hashtable();
//hash.put("Num","3");
//hash.put("Height","120");
//hash.put("Width","120");
//hash.put("Num","20");
//hash.put("IsShowtime","1");
//hash.put("STYLE","蔚蓝");
//hash.put("FILENAME","css1.css");
//hash.put("ISNOW","1");
//mb.setFtp("zouchen:0680@ftp:192.168.0.63");
//mb.addCss(hash);
//mb.setMain(hash);
//mb.setPic(hash);
//String path= "D:";
hash.put("BODY", "BODY {" + "\r" + " FONT-SIZE: 14px" + "\r" + "}");
hash.put("TABLE", "TABLE {FONT-SIZE: 12px}");
//mb.newCssFile(hash,path);
//System.out.println(mb.getData());
//System.out.println(mb.toName("1"));
//System.out.println(mb.getCSSCOLOR("css1.css"));
mb.initMain();
System.out.println("\r\n\r\nend");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -