📄 linkbiz.java
字号:
package com.yhbbs.bbs.biz;
import java.sql.SQLException;
import java.util.List;
import org.apache.log4j.Logger;
import com.yhbbs.bbs.dao.LinkDaoIm;
import com.yhbbs.bbs.itface.Link;
import com.yhbbs.bbs.itface.dao.LinkDao;
/**
* <p>Title:系统友情链接相关操作Bean</p>
* <li> 系统友情链接相关操作<br>
* <br><b>WebSite: www.yyhweb.com</b>
* <br><b>CopyRight: yyhweb[由由华网]</b>
* @author stephen
* @version YHBBS-2.0
*/
public class LinkBiz{
private static Logger bbslog = Logger.getLogger(LinkBiz.class);
private static LinkDao linkdao = LinkDaoIm.getInstance();
/** 获取一个友情链接
* @param id 友情链接ID
* @return link 友情链接
* @throws SQLException
*/
public static Link getLinkById(int id){
try {
return linkdao.getLinkById(id);
}
catch(SQLException e) {
bbslog.error("Throws a SqlException when invoke getLinkById(int id):\n" + e.toString());
}
return null;
}
/** 取得所有友情链接
* @param start 查询开始位置
* @param pageSize 查询长度
* @param type 2:所有友情链接 1:图片链接 0:文字链接
* @return list 所有友情链接
* @throws SQLException
*/
public static List getLinks(int start,int pageSize,String type) {
try {
return linkdao.getLinks(start,pageSize,type);
}
catch(SQLException e) {
bbslog.error("Throws a SqlException when invoke getLinks(int i):\n" + e.toString());
}
return null;
}
// 后台管理是用
/** 获取友情链接数
* @param type 2:所有友情链接 1:图片链接 0:文字链接
* @return int 友情链接数
* @throws SQLException
*/
public static int getLinkCount(String type) {
try {
return linkdao.getLinkCount(type);
}
catch(SQLException e) {
bbslog.error("Throws a SqlException when invoke getLinkCount(String i):\n" + e.toString());
}
return 0;
}
/** 增加友情链接
* @param link 友情链接
* @return true:成功 false:失败
* @throws SQLException
*/
public static boolean addLink(Link link) {
boolean flag = true;
try {
linkdao.addLink(link);
}
catch(SQLException e) {
bbslog.error("Throws a SqlException when invoke addLink(Link link):\n" + e.toString());
flag = false;
}
return flag;
}
/** 更新友情链接
* @param link 友情链接
* @return true:成功 false:失败
* @throws SQLException
*/
public static boolean updateLink(Link link) {
boolean flag = true;
try {
flag = linkdao.updateLink(link);
}
catch(SQLException e) {
bbslog.error("Throws a SqlException when invoke updateLink(Link link):\n" + e.toString());
flag = false;
}
return flag;
}
/** 删除友情链接
* @param id 友情链接ID
* @return true:成功 false:失败
* @throws SQLException
*/
public static boolean deleteLink(int id){
boolean flag = true;
try {
flag = linkdao.deleteLink(id);
}
catch(SQLException e) {
bbslog.error("Throws a SqlException when invoke deleteLink(int id):\n" + e.toString());
flag = false;
}
return flag;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -