⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 u06tservicebo.java

📁 持久层hibernate技术使用的一个例子
💻 JAVA
字号:
package cn.hope.front.bo;


import java.util.List;

import org.apache.log4j.Logger;
import cn.hope.front.pojo.TService;
import cn.hope.front.pojo.U07CommonListVO;
import cn.hope.front.pojo.dao.TServiceDAO;
import cn.hope.front.util.U07Page;

public class U06TServiceBO {
	Logger log = Logger.getLogger(U06TServiceBO.class.getName());
	private TServiceDAO tServiceDAO = new TServiceDAO();
	public List serachAll() throws Exception {
		List list = null;
		try {
			list = tServiceDAO.searchAll();
		} catch (Exception e) {
			log.error(e);
			e.printStackTrace();
			throw new Exception(e);
		}
		return list;
	}
	public TService searchByKey(Integer id) throws Exception {
		TService sc = null;
		try {
			sc = tServiceDAO.searchByKey(id);
		} catch (Exception e) {
			log.error(e);
			e.printStackTrace();
			throw new Exception(e);
		}
		return sc;
	}
	public int insert(TService tService) throws Exception {
		int flag = 0;
		try {
			flag = tServiceDAO.insert(tService).intValue();
		} catch (Exception e) {
			log.error(e);
			e.printStackTrace();
			throw new Exception(e);
		}
		return flag;
	}
	public U07CommonListVO serach(TService tService, int start, boolean isEq)
	throws Exception {
	U07CommonListVO cl_vo = new U07CommonListVO();
	int range = 6;// 每页显示记录数
	int count = 0;// 总记录数
	List list = null;// 查询得到的结果集
	U07Page page = new U07Page();// 分页
	String fenyeStr = "";
	try {
		list = tServiceDAO.search(tService, start, range, isEq);
		count = tServiceDAO.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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -