LinkService.java~18~
资源名称: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.DAOException;
- import com.chinacannel.common.CommonDAO;
- import org.apache.commons.logging.LogFactory;
- import org.apache.commons.logging.Log;
- import com.chinacannel.entity.Link;
- import java.util.List;
- import com.chinacannel.common.PageInfo;
- public class LinkService extends TranUtil {
- private CommonDAO dao = new CommonDAO();
- private static Log log = LogFactory.getLog(LinkService.class);
- public boolean AddLink(Link link) {
- try {
- return dao.createObject(link);
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return false;
- }
- }
- public boolean UpdateLink(Link link) {
- try {
- return dao.updateObject(link);
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return false;
- }
- }
- public boolean DeleteLink(Link link) {
- try {
- return dao.removeObject(link);
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return false;
- }
- }
- public Link GetLinkById(Long id) {
- try {
- return (Link) dao.loadObject(id, Link.class);
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return null;
- }
- }
- public List GetAllLink() {
- try {
- return dao.loadAllObjects(Link.class);
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return null;
- }
- }
- public List getLinkList(Long type, int start, int top) {
- List list = null;
- try {
- String hql = "from Link as link where link.lin_Type=" + type;
- list = dao.loadObjectListBySQL(hql, start, top);
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return null;
- }
- return list;
- }
- public int getCount(Long type) {
- String hql = "select count(*) from Link as link where link.lin_Type=" +
- type;
- try {
- return dao.getCountBySql(hql);
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return 0;
- }
- }
- public PageInfo getPageInfo(Long type, int pageno) {
- PageInfo pageInfo = new PageInfo(this.getCount(type), pageno, 10);
- pageInfo.setRows(this.getLinkList(type, pageInfo.getStartRow(),
- pageInfo.getPageSize()));
- return pageInfo;
- }
- public List GetLinkByType() {
- try {
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return null;
- }
- }
- }