实现业务逻辑接口HrmService
业务逻辑接口HrmService中定义了系统功能实现所需要调用的方法,HrmServiceImpl类实现了该接口,对每个方法的方法体进行了具体实现:
package org.fkit.hrm.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.fkit.hrm.dao.DeptDao;
import org.fkit.hrm.dao.DocumentDao;
import org.fkit.hrm.dao.EmployeeDao;
import org.fkit.hrm.dao.JobDao;
import org.fkit.hrm.dao.NoticeDao;
import org.fkit.hrm.dao.UserDao;
import org.fkit.hrm.domain.Dept;
import org.fkit.hrm.domain.Document;
import org.fkit.hrm.domain.Employee;
import org.fkit.hrm.domain.Job;
import org.fkit.hrm.domain.Notice;
import org.fkit.hrm.domain.User;
import org.fkit.hrm.service.HrmService;
import org.fkit.hrm.util.tag.PageModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
/**
* 人事管理系统服务层接口实现类
* @author luliangchang
*
*/
@Transactional(propagation=Propagation.REQUIRED,isolation=Isolation.DEFAULT)
@Service("hrmService")
public class HrmServiceImpl implements HrmService {
/*
* 自动注入持久层dao对象
*/
@Autowired
private UserDao userDao;
@Autowired
private DeptDao deptDao;
@Autowired
private DocumentDao documentDao;
@Autowired
private EmployeeDao employeeDao;
@Autowired
private JobDao jobDao;
@Autowired
private NoticeDao noticeDao;
/*******************用户服务层接口实现************/
//实现HrmService接口的login方法
@Transactional(readOnly=true)
@Override
public User login(String loginName,String password){
System.out.println("调用HrmServiceImpl类方法login -->");
System.out.println(loginName);
System.out.println(password);
return userDao.selectUserByLoginnameAndPassword(loginName, password);
}
//实现HrmService接口的selectUserById方法
@Transactional(readOnly=true)
@Override
public User selectUserById(Integer id){
return userDao.selectUserById(id);
}
//实现HrmService接口的selectUser方法
@Transactional(readOnly=true)
public List<User> selectUser(User user,PageModel pageModel){
Map<String,Object> params=new H