IndexService.java~65~
资源名称: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 java.util.List;
- import com.chinacannel.common.DAOException;
- import com.chinacannel.common.PageInfo;
- import com.chinacannel.entity.Menu;
- public class IndexService extends TranUtil {
- private CommonDAO dao = new CommonDAO();
- private static Log log = LogFactory.getLog(AdminService.class);
- public List GetIndexMenu(String Language) {
- try {
- return dao.loadObjectListBySQL(
- "from Menu as menu where menu.men_Index=1 and menu.men_Language='" +
- Language + "' order by Men_Time desc", 0, 4);
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return null;
- }
- }
- public List getInformationList(String condition, Menu menu, String Language,
- int start, int top) {
- List list = null;
- String hql = "from Information as inf where inf.inf_Language='" +
- Language +
- "' and inf.menu.men_Type!=0 and inf.menu.men_Type!=1";
- try {
- if (!condition.equals("")) {
- hql += " and inf.inf_Title like '%" + condition + "%'";
- }
- if (menu != null) {
- hql += " and inf.menu.men_ID=" + menu.getMen_ID();
- }
- hql += " order by inf.inf_Time desc";
- list = dao.loadObjectListBySQL(hql, start, top);
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return null;
- }
- return list;
- }
- public int getCount(String condition, Menu menu, String Language) {
- String hql =
- "select count(*) from Information as inf where inf.inf_Language='" +
- Language + "' and inf.menu.men_Type!=0 and inf.menu.men_Type!=1";
- if (!condition.equals("")) {
- hql += " and inf.inf_Title like '%" + condition + "%'";
- }
- if (menu != null) {
- hql += " and inf.menu.men_ID=" + menu.getMen_ID();
- }
- try {
- return dao.getCountBySql(hql);
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return 0;
- }
- }
- public PageInfo getPageInfo(String condition, Menu menu, String Language,
- int pageno) {
- PageInfo pageInfo = new PageInfo(this.getCount(condition, menu,
- Language), pageno, 10);
- pageInfo.setRows(this.getInformationList(condition, menu, Language,
- pageInfo.getStartRow(),
- pageInfo.getPageSize()));
- return pageInfo;
- }
- }