u04ttestinfobo.java

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

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


import java.util.List;


 

import org.apache.log4j.Logger;



import cn.hope.front.pojo.TTestInfo;
import cn.hope.front.pojo.U07CommonListVO;

import cn.hope.front.pojo.dao.TTestInfoDAO;
import cn.hope.front.util.U07Page;


public class U04TTestInfoBO {
	Logger log = Logger.getLogger(U04TTestInfoBO.class.getName());
	
	
	
	
	public U07CommonListVO aroundValue(int start, boolean isEq) throws Exception{
		TTestInfoDAO tTestInfoDAO = new TTestInfoDAO();
		U07CommonListVO cl_vo = new U07CommonListVO();
		int range = 10;// 每页显示记录数
		int count = 0;// 总记录数
		U07Page page = new U07Page();// 分页
		String fenyeStr = "";
		List list = null;
		try{
			list = tTestInfoDAO.searchAround(start,range,isEq);
			count = tTestInfoDAO.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;
	}
	public Integer saves(TTestInfo tTestInfo)  throws Exception{
		Integer id = null;
		try{
			TTestInfoDAO tTestInfoDAO = new TTestInfoDAO();
			id = tTestInfoDAO.insert(tTestInfo);
		}
		catch(Exception e){
			log.error(e);
			e.printStackTrace();
			throw new Exception(e);
		}
		return id;
	}
	
	public TTestInfo info(String id)  throws Exception{
		TTestInfoDAO tTestInfoDAO = new TTestInfoDAO();
		TTestInfo tTestInfo = new TTestInfo();
		try{
			tTestInfo = tTestInfoDAO.testInfo(id);
		}
		catch(Exception e){
			log.error(e);
			e.printStackTrace();
			throw new Exception(e);
		}
		return tTestInfo;
	}
	
	
	public void updates(TTestInfo tTestInfo)  throws Exception{
		TTestInfoDAO tTestInfoDAO = new TTestInfoDAO();
		try{
			tTestInfoDAO.modify(tTestInfo);
		}
		catch(Exception e){
			log.error(e);
			e.printStackTrace();
			throw new Exception(e);
		}
	}
}

⌨️ 快捷键说明

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