📄 forumhistoryserviceimp.java
字号:
package com.laoer.bbscs.service.imp;
import java.util.*;
import com.laoer.bbscs.bean.*;
import com.laoer.bbscs.dao.*;
import com.laoer.bbscs.exception.*;
import com.laoer.bbscs.service.*;
import com.laoer.bbscs.service.web.*;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.Log;
import com.laoer.bbscs.comm.Constant;
import com.laoer.bbscs.comm.OrderObj;
/**
* <p>Title: TianyiBBS</p>
*
* <p>Description: BBSCS</p>
*
* <p>Copyright: Copyright (c) 2006</p>
*
* <p>Company: Laoer.com</p>
*
* @author Laoer
* @version 7.0
*/
public class ForumHistoryServiceImp
implements ForumHistoryService {
private static final Log logger = LogFactory.getLog(ForumHistoryServiceImp.class);
private ForumHistoryDAO forumHistoryDAO;
public ForumHistoryServiceImp() {
}
/**
*
* @param fh ForumHistory
* @return ForumHistory
* @throws BbscsException
* @todo Implement this com.laoer.bbscs.service.ForumHistoryService method
*/
public ForumHistory saveForumHistory(ForumHistory fh) throws BbscsException {
try {
return this.getForumHistoryDAO().saveForumHistory(fh);
}
catch (Exception ex) {
logger.error(ex);
throw new BbscsException(ex);
}
}
/**
*
* @param fh ForumHistory
* @return ForumHistory
* @throws BbscsException
* @todo Implement this com.laoer.bbscs.service.ForumHistoryService method
*/
public ForumHistory updateForumHistory(ForumHistory fh) throws BbscsException {
try {
return this.getForumHistoryDAO().updateForumHistory(fh);
}
catch (Exception ex) {
logger.error(ex);
throw new BbscsException(ex);
}
}
/**
*
* @param id String
* @param bid long
* @return ForumHistory
* @todo Implement this com.laoer.bbscs.service.ForumHistoryService method
*/
public ForumHistory findForumHistoryByID(String id, long bid) {
return this.getForumHistoryDAO().findForumHistoryByID(id, bid);
}
/**
*
* @param bid long
* @return int
* @todo Implement this com.laoer.bbscs.service.ForumHistoryService method
*/
public int getForumHistoryMainNum(long bid) {
return this.getForumHistoryDAO().getForumHistoryNum(bid, 1, 0, 0);
}
public int getForumHistoryNum(long bid) {
return this.getForumHistoryDAO().getForumHistoryNum(bid, -1, 0, 0);
}
/**
*
* @param bid long
* @param mainID String
* @return int
* @todo Implement this com.laoer.bbscs.service.ForumHistoryService method
*/
public int getForumHistoryTopicNum(long bid, String mainID) {
return this.getForumHistoryDAO().getForumHistoryTopicNum(bid, mainID, 0, 0);
}
/**
*
* @param bid long
* @param pages Pages
* @return PageList
* @todo Implement this com.laoer.bbscs.service.ForumHistoryService method
*/
public PageList findForumHistorysMainWWW(long bid, Pages pages) {
OrderObj oo0 = new OrderObj("isTop", Constant.ORDER_DESC);
OrderObj oo1 = new OrderObj("postTime", Constant.ORDER_DESC);
OrderObj[] oo = {oo0, oo1};
PageList pl = new PageList();
if (pages.getTotalNum() == -1) {
pages.setTotalNum(this.getForumHistoryDAO().getForumHistoryNum(bid, 1, 0, 0));
}
pages.executeCount();
List l = this.getForumHistoryDAO().findForumHistorys(bid, 1, 0, 0, oo, pages.getSpage(),
pages.getPerPageNum());
pl.setObjectList(l);
pl.setPages(pages);
return pl;
}
/**
*
* @param bid long
* @param pages Pages
* @return PageList
* @todo Implement this com.laoer.bbscs.service.ForumHistoryService method
*/
public PageList findForumHistorysMainLastRe(long bid, Pages pages) {
OrderObj oo0 = new OrderObj("isTop", Constant.ORDER_DESC);
OrderObj oo1 = new OrderObj("lastTime", Constant.ORDER_DESC);
OrderObj[] oo = {oo0, oo1};
PageList pl = new PageList();
if (pages.getTotalNum() == -1) {
pages.setTotalNum(this.getForumHistoryDAO().getForumHistoryNum(bid, 1, 0, 0));
}
pages.executeCount();
List l = this.getForumHistoryDAO().findForumHistorys(bid, 1, 0, 0, oo, pages.getSpage(),
pages.getPerPageNum());
pl.setObjectList(l);
pl.setPages(pages);
return pl;
}
/**
*
* @param bid long
* @param pages Pages
* @return PageList
* @todo Implement this com.laoer.bbscs.service.ForumHistoryService method
*/
public PageList findForumHistorysAll(long bid, Pages pages) {
OrderObj oo0 = new OrderObj("isTop", Constant.ORDER_DESC);
OrderObj oo1 = new OrderObj("lastTime", Constant.ORDER_DESC);
OrderObj[] oo = {oo0, oo1};
PageList pl = new PageList();
if (pages.getTotalNum() == -1) {
pages.setTotalNum(this.getForumHistoryDAO().getForumHistoryNum(bid, -1, 0, 0));
}
pages.executeCount();
List l = this.getForumHistoryDAO().findForumHistorys(bid, -1, 0, 0, oo, pages.getSpage(),
pages.getPerPageNum());
pl.setObjectList(l);
pl.setPages(pages);
return pl;
}
/**
*
* @param bid long
* @param mainID String
* @param pages Pages
* @return PageList
* @todo Implement this com.laoer.bbscs.service.ForumHistoryService method
*/
public PageList findForumsTopic(long bid, String mainID, Pages pages) {
OrderObj oo0 = new OrderObj("postTime", Constant.ORDER_ASC);
OrderObj[] oo = {oo0};
PageList pl = new PageList();
if (pages.getTotalNum() == -1) {
pages.setTotalNum(this.getForumHistoryDAO().getForumHistoryTopicNum(bid, mainID, 0, 0));
}
pages.executeCount();
List l = this.getForumHistoryDAO().findForumHistorysTopic(bid, mainID, 0, 0, oo, pages.getSpage(),
pages.getPerPageNum());
pl.setObjectList(l);
pl.setPages(pages);
return pl;
}
/**
*
* @param bids List
* @return int
* @todo Implement this com.laoer.bbscs.service.ForumHistoryService method
*/
public int getForumHistoryNumInBids(List bids) {
return this.getForumHistoryDAO().getForumHistoryNumInBids(bids, 1, 0, 0);
}
/**
* 取得指定版区下的帖子分页列表,WWW方式
*
* @param bids List
* @param pages Pages
* @return PageList
* @todo Implement this com.laoer.bbscs.service.ForumHistoryService method
*/
public PageList findForumHistorysInBidsWWW(List bids, Pages pages) {
OrderObj oo0 = new OrderObj("postTime", Constant.ORDER_DESC);
OrderObj[] oo = {oo0};
PageList pl = new PageList();
if (pages.getTotalNum() == -1) {
pages.setTotalNum(this.getForumHistoryDAO().getForumHistoryNumInBids(bids, 1, 0, 0));
}
pages.executeCount();
List l = this.getForumHistoryDAO().findForumHistorysInBids(bids, 1, 0, 0, oo, pages.getSpage(),
pages.getPerPageNum());
pl.setObjectList(l);
pl.setPages(pages);
return pl;
}
/**
* 取得指定版区下的帖子分页列表,顶帖方式
*
* @param bids List
* @param pages Pages
* @return PageList
* @todo Implement this com.laoer.bbscs.service.ForumHistoryService method
*/
public PageList findForumHistorysInBidsLastRe(List bids, Pages pages) {
OrderObj oo0 = new OrderObj("lastTime", Constant.ORDER_DESC);
OrderObj[] oo = {oo0};
PageList pl = new PageList();
if (pages.getTotalNum() == -1) {
pages.setTotalNum(this.getForumHistoryDAO().getForumHistoryNumInBids(bids, 1, 0, 0));
}
pages.executeCount();
List l = this.getForumHistoryDAO().findForumHistorysInBids(bids, 1, 0, 0, oo, pages.getSpage(),
pages.getPerPageNum());
pl.setObjectList(l);
pl.setPages(pages);
return pl;
}
/**
* 取得指定版区下的帖子分页列表,不分主次
*
* @param bids List
* @param pages Pages
* @return PageList
* @todo Implement this com.laoer.bbscs.service.ForumHistoryService method
*/
public PageList findForumHistorysInBidsAll(List bids, Pages pages) {
OrderObj oo0 = new OrderObj("postTime", Constant.ORDER_DESC);
OrderObj[] oo = {oo0};
PageList pl = new PageList();
if (pages.getTotalNum() == -1) {
pages.setTotalNum(this.getForumHistoryDAO().getForumHistoryNumInBids(bids, -1, 0, 0));
}
pages.executeCount();
List l = this.getForumHistoryDAO().findForumHistorysInBids(bids, -1, 0, 0, oo, pages.getSpage(),
pages.getPerPageNum());
pl.setObjectList(l);
pl.setPages(pages);
return pl;
}
public boolean isReedUser(long bid, String mainID, String userID) {
int num = this.getForumHistoryDAO().getForumNumInMainIDByUserID(bid, mainID, userID, 0, 0, 0);
if (num > 0) {
return true;
}
else {
return false;
}
}
public ForumHistoryDAO getForumHistoryDAO() {
return forumHistoryDAO;
}
public void setForumHistoryDAO(ForumHistoryDAO forumHistoryDAO) {
this.forumHistoryDAO = forumHistoryDAO;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -