DownLoadService.java
资源名称:shihua.rar [点击查看]
上传用户:zghglow
上传日期:2022-08-09
资源大小:27227k
文件大小:3k
源码类别:
WEB源码(ASP,PHP,...)
开发平台:
JavaScript
- package com.chinacannel.xlchemical.service;
- import com.chinacannel.common.TranUtil;
- import com.chinacannel.common.CommonDAO;
- import org.apache.commons.logging.LogFactory;
- import org.apache.commons.logging.Log;
- import com.chinacannel.entity.DownLoad;
- import com.chinacannel.common.DAOException;
- import java.util.List;
- import com.chinacannel.common.PageInfo;
- import com.chinacannel.entity.Category;
- public class DownLoadService extends TranUtil {
- private CommonDAO dao = new CommonDAO();
- private static Log log = LogFactory.getLog(DownLoadService.class);
- public boolean AddDownLoad(DownLoad dl) {
- try {
- return dao.createObject(dl);
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return false;
- }
- }
- public boolean UpdateDownLoad(DownLoad dl) {
- try {
- return dao.updateObject(dl);
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return false;
- }
- }
- public boolean DeleteDownLoad(DownLoad dl) {
- try {
- return dao.removeObject(dl);
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return false;
- }
- }
- public DownLoad GetDownLoadById(Long ID) {
- try {
- return (DownLoad) dao.loadObject(ID, DownLoad.class);
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return null;
- }
- }
- public List getDownLoadList(Long type, String Language, int start,
- int top) {
- try {
- String hql = "from DownLoad as dl where dl.dow_Type=" +
- type + " and dl.dow_Language='" + Language +
- "' order by dl.dow_Order desc";
- return dao.loadObjectListBySQL(hql, start, top);
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return null;
- }
- }
- public int getCount(Long type, String Language) {
- String hql =
- "select count(*) from DownLoad as dl where dl.dow_Type=" +
- type + " and dl.dow_Language='" + Language + "'";
- int count = 0;
- try {
- int o = dao.getCountBySql(hql);
- count = o;
- } catch (DAOException ex) {
- }
- return count;
- }
- public PageInfo getPageInfo(Long type, String Language, int pageno) {
- PageInfo pageInfo = new PageInfo(this.getCount(type, Language), pageno,
- 10);
- pageInfo.setRows(this.getDownLoadList(type, Language,
- pageInfo.getStartRow(),
- pageInfo.getPageSize()));
- return pageInfo;
- }
- }