📄 forumlinkadmin.java
字号:
package com.bcxy.bbs.forum.admin;
/**
* Title:
* Description:
* Copyright:
* Company: www.liyunet.com
*
* @author lishujiang
* @version 1.0
*/
import javax.servlet.http.HttpServletRequest;
import com.bcxy.bbs.database.DBConnect;
import com.bcxy.bbs.util.ParamUtil;
public class ForumLinkAdmin {
public ForumLinkAdmin() {
}
public static void saveNew(HttpServletRequest request) throws Exception {
ForumAdmin.checkAdmin(request);
String url = ParamUtil.getString(request, "url");
String readme = ParamUtil.getString(request, "readme");
String name = ParamUtil.getString(request, "name");
if (url == null || readme == null || name == null)
throw new Exception("请输入完整联盟论坛信息。");
DBConnect dbc = null;
try {
dbc = new DBConnect(
"insert into bbslink(boardname,readme,url) values(?,?,?)");
dbc.setString(1, name);
dbc.setString(2, readme);
dbc.setString(3, url);
dbc.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
throw e;
} finally {
dbc.close();
}
}
public static void saveEdit(HttpServletRequest request) throws Exception {
ForumAdmin.checkAdmin(request);
int forumLinkID;
try {
forumLinkID = ParamUtil.getInt(request, "id");
} catch (Exception e) {
throw new Exception("请您选择论坛的ID.");
}
DBConnect dbc = null;
try {
dbc = new DBConnect(
"update bbslink set boardname=?,readme=?,url=? where id="
+ forumLinkID);
dbc.setString(1, ParamUtil.getString(request, "name", ""));
dbc.setString(2, ParamUtil.getString(request, "readme", ""));
dbc.setString(3, ParamUtil.getString(request, "url", ""));
dbc.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
throw e;
} finally {
dbc.close();
}
}
public static void del(HttpServletRequest request) throws Exception {
ForumAdmin.checkAdmin(request);
int forumLinkID;
try {
forumLinkID = ParamUtil.getInt(request, "id");
} catch (Exception e) {
throw new Exception("请您选择论坛的ID.");
}
DBConnect dbc = null;
try {
dbc = new DBConnect("delete from bbslink where id=" + forumLinkID);
dbc.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
throw e;
}
dbc.close();
}
public static void updateOrders(HttpServletRequest request)
throws Exception {
ForumAdmin.checkAdmin(request);
int newforumLinkID;
int forumLinkID;
try {
newforumLinkID = ParamUtil.getInt(request, "newid");
forumLinkID = ParamUtil.getInt(request, "id");
} catch (Exception e) {
throw new Exception("请您选择论坛的ID.");
}
DBConnect dbc = null;
try {
dbc = new DBConnect("update bbslink set id=" + newforumLinkID
+ " where id=" + forumLinkID);
dbc.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
throw e;
} finally {
dbc.close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -