📄 forumnewsmanager.java
字号:
package com.bcxy.bbs.forum;
/**
* Title:
* Description:
* Copyright:
* Company: www.liyunet.com
*
* @author lishujiang
* @version 1.0
*/
import java.util.Vector;
import com.bcxy.cache.CacheManager;
import com.bcxy.conf.ENV;
import com.bcxy.db.SqlQuery;
public class ForumNewsManager {
public static ForumNews getForumNews(int forumID)
throws ForumNewsNotFoundException {
ForumNews temp = null;
try {
temp = (ForumNews)CacheManager.getCache(ENV.FORUM_NEWS).get("news"+(forumID));
if(temp==null){
temp = new ForumNews(forumID);
CacheManager.getCache(ENV.FORUM_NEWS).put("news"+(forumID),temp);
}
return temp;
} catch (Exception e) {
throw new ForumNewsNotFoundException();
}
}
/**
*
* @param newsID
* @return
* @throws Exception
*/
public static ForumNews getSignalForumNews(int newsID) throws Exception {
ForumNews forumNews = null;
try {
forumNews = (ForumNews)CacheManager.getCache(ENV.GATEWAY).get("news"+newsID);
if(forumNews==null){
forumNews = new ForumNews(newsID);
CacheManager.getCache(ENV.GATEWAY).put("news"+(newsID),forumNews);
}
} catch (Exception e) {
throw new ForumNewsNotFoundException();
}
return forumNews;
}
/**
*
* @return
* @throws Exception
*/
public static Vector getForumNewsVector() throws Exception {
SqlQuery rs = new SqlQuery("select id from bbsnews order by id desc");
Vector forumNewsVector = new Vector();
while (rs.next()) {
int id = rs.getInt(1);
ForumNews forumNews = getSignalForumNews(id);
forumNewsVector.add(forumNews);
}
rs.close();
return forumNewsVector;
}
/**
*
* @param forumID
* @return
* @throws Exception
*/
public static Vector getForumNewsVector(int forumID) throws Exception {
SqlQuery rs = new SqlQuery("select id from bbsnews where boardID="
+ forumID + " order by id desc");
Vector forumNewsVector = new Vector();
while (rs.next()) {
int id = rs.getInt(1);
ForumNews forumNews = getSignalForumNews(id);
forumNewsVector.add(forumNews);
}
rs.close();
return forumNewsVector;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -