LeaveWordService.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.common.DAOException;
- import com.chinacannel.entity.LeaveWord;
- import com.chinacannel.entity.Category;
- import java.util.List;
- import com.chinacannel.common.PageInfo;
- public class LeaveWordService extends TranUtil {
- private CommonDAO dao = new CommonDAO();
- private static Log log = LogFactory.getLog(AdminService.class);
- public boolean AddLeaveWord(LeaveWord lw){
- try{
- return dao.createObject(lw);
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return false;
- }
- }
- public boolean UpdateLeaveWord(LeaveWord lw) {
- try {
- return dao.updateObject(lw);
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return false;
- }
- }
- public boolean DeleteLeaveWord(LeaveWord lw) {
- try {
- return dao.removeObject(lw);
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return false;
- }
- }
- public LeaveWord GetLeaveWordById(Long Id) {
- try {
- return (LeaveWord) dao.loadObject(Id, LeaveWord.class);
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return null;
- }
- }
- public List getLeaveWordList(String Language, String type, int start, int top) {
- List list = null;
- try {
- String hql = "from LeaveWord as lw where lw.lea_Language='" +
- Language + "'";
- if (type.equals("1")) {
- hql += " and lea_Revert!=''";
- }
- hql += " order by lea_Time order by desc";
- list = dao.loadObjectListBySQL(hql, start, top);
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return null;
- }
- return list;
- }
- public int getCount(String Language) {
- String hql =
- "select count(*) from LeaveWord as lw where lw.lea_Language='" +
- Language + "'";
- try {
- return dao.getCountBySql(hql);
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return 0;
- }
- }
- public PageInfo getPageInfo(String Language, String type, int pageno) {
- PageInfo pageInfo = new PageInfo(this.getCount(Language), pageno, 10);
- pageInfo.setRows(this.getLeaveWordList(Language, type,
- pageInfo.getStartRow(),
- pageInfo.getPageSize()));
- return pageInfo;
- }
- }