u02sreblogbo.java

来自「持久层hibernate技术使用的一个例子」· Java 代码 · 共 84 行

JAVA
84
字号
package cn.hope.front.bo;

import java.util.List;
import org.apache.log4j.Logger;


import cn.hope.front.pojo.SReblog;
import cn.hope.front.pojo.U02CommonListVO;
import cn.hope.front.pojo.dao.SReblogDAO;
import cn.hope.front.util.U02Page;

public class U02SReblogBO {
	Logger log = Logger.getLogger(U02SReblogBO .class.getName());
	SReblogDAO sreblogDAO = new SReblogDAO();
	public List searchReblog(int sbId,int start, int range) throws Exception {
		List list = null;
		try {
			list = sreblogDAO.searchReblog(sbId,start,range);
		} catch (Exception e) {
			log.error(e);
			e.printStackTrace();
			throw new Exception(e);
		}
		return list;
	}
	public  int insert(SReblog sreblog) throws Exception {
		int flag = 0;
		try {
			flag = sreblogDAO.insert(sreblog).intValue();
		} catch (Exception e) {
			log.error(e);
			e.printStackTrace();
			throw new Exception(e);
		}
		return flag;
	}
	public SReblog update(SReblog sreblog)throws Exception
	{
		
		try{	
		
			sreblogDAO.update(sreblog);
		}
		catch(Exception e)
		{
			log.error(e);
			e.printStackTrace();
			throw new Exception(e);
		}
		return sreblog;
	}

	public U02CommonListVO serach(SReblog sreblog, int start, boolean isEq)
	throws Exception {
		U02CommonListVO cl_vo = new U02CommonListVO();
		int range = 5;// 每页显示记录数
		int count = 0;// 总记录数
		List list = null;// 查询得到的结果集
		U02Page page = new U02Page();// 分页
		String fenyeStr = "";
		try {
			list = sreblogDAO.search(sreblog, start, range, isEq);
			count = sreblogDAO.getCount();
			cl_vo.setRs(list);
			cl_vo.setCount(count);
			cl_vo.setStart(start);
			cl_vo.setRange(range);
		
			fenyeStr = page.fenye(cl_vo);
			cl_vo.setFenye(fenyeStr);
			cl_vo.setCurrentPage(page.getCurrentPage());
			cl_vo.setTotalPage(page.getTotalPage());
			cl_vo.setStartSub(page.getStartSub());
			cl_vo.setOverSub(page.getOverSub());
		} catch (Exception e) {
			log.error(e);
			e.printStackTrace();
			throw new Exception(e);
		}
		return cl_vo;
}
	
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?