📄 forumstatbo.java
字号:
package com.lovo.bbs.bo;
import java.sql.SQLException;
import javax.naming.NamingException;
import com.lovo.bbs.vo.ForumStatVo;
import com.lovo.bbs.dao.ForumStatDao;
import com.lovo.bbs.po.ForumStatPo;
/**
* 杂项信息Bo
*
* @author tiancen2001
*
*/
public class ForumStatBo {
/**
* 返回杂项信息Vo
*
* @return
*/
public ForumStatVo getForumInfo() {
ForumStatVo vo = new ForumStatVo();
ForumStatPo po = null;
try {
po = new ForumStatDao().getForumInfo();
} catch (NamingException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
vo.setMemberNum(po.getMemberNum());
vo.setPostNum(po.getPostNum());
vo.setTodayTopicNum(po.getTodayTopicNum());
vo.setTopicNum(po.getTopicNum());
vo.setSiteName(po.getSiteName());
vo.setSiteNotice(po.getSiteNotice());
return vo;
}
/**
* 新增主题
*/
public int addOneTopic() {
int added=0;
try {
added = new ForumStatDao().addOneTopic();
} catch (NamingException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
return added;
}
/**
* 新增会员
*/
public int addMember(){
int added = 0;
try {
added=new ForumStatDao().addMember();
} catch (NamingException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
return added;
}
/**
* 新增回帖
*/
public int addOnePost() {
int added = 0;
try {
added=new ForumStatDao().AddOnePost();
} catch (NamingException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
return added;
}
/**
* 计算今日主题数
*/
public int calcTodayTopicNum(){
int calced = 0;
try {
calced = new ForumStatDao().calcTodayTopicNum();
} catch (NamingException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
return calced;
}
/**
* 计算主题数
*/
public int calcTopicNum(){
int calced = 0;
try {
calced = new ForumStatDao().calcTopicNum();
} catch (NamingException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
return calced;
}
/**
* 计算回帖数
*/
public int calcPostNum(){
int calced = 0;
try {
calced = new ForumStatDao().calcPostNum();
} catch (NamingException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
return calced;
}
/**
* 刷新数据表
*/
public int reset(){
int reseted=0;
int calc1=calcTopicNum();
int calc2=calcPostNum();
int calc3=calcTodayTopicNum();
int calc4 = calcMemberNum();
if(calc1==1&&calc2==1&&calc3==1&&calc4==1){
reseted=1;
}
return reseted;
}
/**
* 计算会员数
* @return
*/
private int calcMemberNum() {
int calced = 0;
try {
calced = new ForumStatDao().calcMemberNum();
} catch (NamingException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
return calced;
}
/**
* 更新公告
*/
public int updateSiteNotice(String notice){
int updated = 0;
try {
updated=new ForumStatDao().updateSiteNotice(notice);
} catch (NamingException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
return updated;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -