JobsService.java
资源名称:shihua.rar [点击查看]
上传用户:zghglow
上传日期:2022-08-09
资源大小:27227k
文件大小:3k
源码类别:
WEB源码(ASP,PHP,...)
开发平台:
JavaScript
- package com.chinacannel.xlchemical.service;
- 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.Jobs;
- import java.util.List;
- import com.chinacannel.common.PageInfo;
- import com.chinacannel.common.TranUtil;
- public class JobsService extends TranUtil {
- private CommonDAO dao = new CommonDAO();
- private static Log log = LogFactory.getLog(JobsService.class);
- public boolean AddJobs(Jobs jobs) {
- try {
- return dao.createObject(jobs);
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return false;
- }
- }
- public boolean UpdateJobs(Jobs jobs) {
- try {
- return dao.updateObject(jobs);
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return false;
- }
- }
- public boolean DeleteJobs(Jobs jobs) {
- try {
- return dao.removeObject(jobs);
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return false;
- }
- }
- public Jobs GetJobsById(Long id) {
- try {
- return (Jobs) dao.loadObject(id, Jobs.class);
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return null;
- }
- }
- public List getJobsList(String Language, int start, int top) {
- List list = null;
- String hql = "from Jobs as jobs where jobs.job_Language='" + Language +
- "' order by jobs.job_IssuanceTime desc";
- try {
- 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 Jobs as jobs where jobs.job_Language='" +
- Language + "'";
- try {
- return dao.getCountBySql(hql);
- } catch (DAOException ex) {
- log.error(ex.getMessage(), ex);
- return 0;
- }
- }
- public PageInfo getPageInfo(String Language, int pageno) {
- PageInfo pageInfo = new PageInfo(this.getCount(Language), pageno, 10);
- pageInfo.setRows(this.getJobsList(Language, pageInfo.getStartRow(),
- pageInfo.getPageSize()));
- return pageInfo;
- }
- }