📄 u07tfilebo.java
字号:
package cn.hope.front.bo;
import java.util.List;
import org.apache.log4j.Logger;
import cn.hope.front.pojo.TFile;
import cn.hope.front.pojo.U07CommonListVO;
import cn.hope.front.pojo.dao.TFileDAO;
import cn.hope.front.util.U07Page;
public class U07TFileBO {
Logger log = Logger.getLogger(U07TFileBO.class.getName());
private TFileDAO tFileDAO = new TFileDAO();
public int insert(TFile tFile) throws Exception {
int flag = 0;
try {
flag = tFileDAO.insert(tFile).intValue();
} catch (Exception e) {
log.error(e);
e.printStackTrace();
throw new Exception(e);
}
return flag;
}
public TFile searchByKey(Integer id) throws Exception {
TFile tf = null;
try {
tf = tFileDAO.searchByKey(id);
} catch (Exception e) {
log.error(e);
e.printStackTrace();
throw new Exception(e);
}
return tf;
}
public TFile download(Integer id)throws Exception
{
TFile tf=null;
try
{
tf=this.searchByKey(id);
int i=tf.getTfDtimes().intValue()+1;
tf.setTfDtimes(new Integer(i));
tFileDAO.update(tf);
}
catch(Exception e)
{
log.error(e);
e.printStackTrace();
throw new Exception(e);
}
return tf;
}
public U07CommonListVO serach(TFile tFile, int start, boolean isEq)
throws Exception {
U07CommonListVO cl_vo = new U07CommonListVO();
int range = 10;// 每页显示记录数
int count = 0;// 总记录数
List list = null;// 查询得到的结果集
U07Page page = new U07Page();// 分页
String fenyeStr = "";
try {
list = tFileDAO.search(tFile, start, range, isEq);
count = tFileDAO.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 + -