⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 docstaffdao.java

📁 一个oa系统
💻 JAVA
字号:
package com.oa.document.db;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

public class DocstaffDAO  extends HibernateDaoSupport {
	private static final Log log = LogFactory.getLog(DocstaffDAO.class);
	
	public boolean updateDoc(Integer id, Docstaff instance) {
        log.debug("updateing Docstaff instance");
        try {
        	Docstaff vo = (Docstaff)getHibernateTemplate().get(Docstaff.class, id);
        	vo.setDepartment(instance.getDepartment());
        	vo.setPost(instance.getPost());
        	vo.setTotalpeople(instance.getTotalpeople());
        	vo.setReason(instance.getReason());
        	vo.setDutydate(instance.getDutydate());
        	vo.setSex(instance.getSex());
        	vo.setWeblock(instance.getWeblock());
        	vo.setAge(instance.getAge());
        	vo.setDegree(instance.getDegree());
        	vo.setForelanguage(instance.getForelanguage());
        	vo.setPersonality(instance.getPersonality());
        	vo.setExperience(instance.getExperience());
        	vo.setSkill(instance.getSkill());
        	vo.setJobcontent(instance.getJobcontent());
        	vo.setProposer(instance.getProposer());
        	vo.setDeptdirector(instance.getDeptdirector());
        	vo.setSuggest(instance.getSuggest());
        	vo.setLeadercheck(instance.getLeadercheck());
        	vo.setState(instance.getState());
        	vo.setSavedate(instance.getSavedate());
        	vo.setTitle(instance.getTitle());
        	getHibernateTemplate().saveOrUpdate(vo);
            log.debug("update successful");
            return true;
        } catch (RuntimeException re) {
            log.error("update failed", re);
            re.printStackTrace();
            return false;
        }
    }
	
	public boolean save(Docstaff transientInstance) {
        log.debug("saving Docstaff instance");
        try {
            getHibernateTemplate().save(transientInstance);
            log.debug("save successful");
            return true;
        } catch (RuntimeException re) {
            log.error("save failed", re);
            re.printStackTrace();
            return false;
        }
    }
	
	public Docstaff findById( java.lang.Integer id) {
        log.debug("getting Docstaff instance with id: " + id);
        try {
        	Docstaff instance = (Docstaff) getHibernateTemplate()
                    .get("com.oa.document.db.Docstaff", id);
            return instance;
        } catch (RuntimeException re) {
            log.error("get failed", re);
            throw re;
        }
    }
	
	public void updateDocstate(Integer id, String state) {
        log.debug("updateing Docstaff instance");
        try {
        	Docstaff vo = (Docstaff)getHibernateTemplate().get(Docstaff.class, id);
        	vo.setState(state);
        	getHibernateTemplate().saveOrUpdate(vo);
            log.debug("update successful");
        } catch (RuntimeException re) {
            log.error("update failed", re);
            throw re;
        }
    }
	
	 public List findByProperty(String propertyName, Object value) {
	      log.debug("finding Docstaff instance with property: " + propertyName
	            + ", value: " + value);
	      try {
	         String queryString = "from Docstaff as model where model." 
	         						+ propertyName + "= ?";
			 return getHibernateTemplate().find(queryString, value);
	      } catch (RuntimeException re) {
	         log.error("find by property name failed", re);
	         throw re;
	      }
		}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -