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

📄 humanfilebiz.java

📁 hr伯乐管理系统!非常适合java学员做学习参考用!是用集成框架开发的Struts+hrbernet+Spring 开发的
💻 JAVA
字号:
package org.better.hr.biz;

import java.util.List;
import org.better.hr.comm.Util;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.better.hr.dao.HumanFileDao;
import org.better.hr.entity.HumanFile;
import org.better.hr.exception.HrException;

public class HumanFileBiz {
	
	private static final Log logger = LogFactory.getLog(HumanFileBiz.class);
	
	private HumanFileDao humanfileDao;

	public HumanFileDao getHumanfileDao() {
		return humanfileDao;
	}

	public void setHumanfileDao(HumanFileDao humanfileDao) {
		this.humanfileDao = humanfileDao;
	}

	/**
	 * 根据ID号返回对象
	 * @param id 主键id
	 * @return 对象
	 * @throws HrException
	 */
	public HumanFile getbyID(java.io.Serializable id) throws HrException
	{
		try
		{
			return (HumanFile)this.getHumanfileDao().load(HumanFile.class,id);
		}
		catch (Exception ex) {
			logger.error(ex);
			throw new HrException(ex);
		}
	}
	
	/**
	 * 新增
	 * @param cfsk 新增的对象
	 * @return 新产生的职位分类编号
	 * @throws HrException
	 */
	public void add(HumanFile condition) throws HrException {
		String args[];
		
		condition.setRegistTime(Util.parseDate(condition.getStr_registTime())); //进行时间设置
		condition.setHumanBirthday(Util.parseDate(condition.getStr_humanBirthday()));
		
		//设置一级机构编号和名称
		args = Util.splitIdAndName(condition.getFirstKindName());
		condition.setFirstKindId(args[0]);
		condition.setFirstKindName(args[1]);
		
		//设置二级机构编号和名称
		args = Util.splitIdAndName(condition.getSecondKindName());
		condition.setSecondKindId(args[2]);
		condition.setSecondKindName(args[3]);
		
		//设置三级机构编号和名称
		args = Util.splitIdAndName(condition.getThirdKindName());
		condition.setThirdKindId(args[0]);
		condition.setThirdKindName(args[1]);
		
		//设置职位分类编号和名称
		args = Util.splitIdAndName(condition.getHumanMajorKindName());
		condition.setHumanMajorKindId(args[0]);
		condition.setHumanMajorKindName(args[1]);
		
		//设置职位编号名称
		args = Util.splitIdAndName(condition.getHunmaMajorName());
		condition.setHumanMajorId(args[0]);
		condition.setHunmaMajorName(args[1]);
		
		//设置薪酬
		args = Util.splitIdAndName(condition.getSalaryStandardName());
		condition.setSalaryStandardId(args[0]);
		condition.setSalaryStandardName(args[1]);
		
		condition.setCheckStatus((short)0);  //设置复核状态为0
		condition.setHumanFileStatus((byte)1);  //设置删除状态为未删除
		
		String hufileid = condition.getFirstKindId() + condition.getSecondKindId()   //产生档案编号
							+ condition.getThirdKindId() + this.genId();
		
		condition.setBonusAmount((short)0);   //设置激励次数为0
		condition.setTrainingAmount((short)0); //设置培训次数为0
		condition.setFileChangAmount((short)0);  //设置档案变更次数为0
		condition.setMajorChangeAmount((short)0); //设置调动次数为0
		
		condition.setHumanId(hufileid);
		try {
			// 保存到数据库
			this.getHumanfileDao().add(condition);
		} catch (Exception ex) {
			logger.error(ex);
			throw new HrException(ex);
		}
	}
	
	/**
	 * 更新
	 * @param condition
	 * @throws HrException
	 */
	public void update(HumanFile condition) throws HrException {
		try {
			// 保存到数据库			
			this.getHumanfileDao().update(condition);
		} catch (Exception ex) {
			logger.error(ex);
			throw new HrException(ex);
		}
	}
	
	
	/**
	 * 查询
	 * @param condition
	 * @return
	 * @throws HrException
	 */
	public List list(HumanFile condition) throws HrException {
		
		try {
			List list = this.getHumanfileDao().find(condition);
			return list;
		} catch (Exception ex) {
			logger.error(ex);
			throw new HrException(ex);
		}	
	}
	
	
	/**
	 * 删除数据库对象
	 * @param id 对象的主键编号
	 * @throws HrException
	 */
	public void delete(java.io.Serializable id) throws HrException
	{
		try {
			this.getHumanfileDao().delete(HumanFile.class,id);
		} catch (Exception ex) {
			logger.error(ex);
			throw new HrException(ex);
		}
	}
	
	/**
	 * 产生编号
	 * @return
	 */
	public String genId()
	{
		int num = 1;
		List list = this.getHumanfileDao().find();
		if(list != null)
			num = (Short)list.get(0) + 1;
		String id;
		if(num < 10)
			id = "000" + num;
		else if(num < 100)
			id = "00" + num;
		else if(num < 1000)
			id = "0" + num;
		else
			id = "" + num;
		return id;
	}
	
	/**
	 * 根据关键字进行查询
	 * @param key
	 * @param del_status
	 * @return
	 */
	public List listByKey(String key,byte del_status,byte chk_status) throws HrException
	{
		try {
			return this.getHumanfileDao().listByKey(key, del_status,chk_status);
		} catch (Exception ex) {
			logger.error(ex);
			throw new HrException(ex);
		}
	}
}

⌨️ 快捷键说明

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