项目介绍
企业人事管理系统,可以实现简单的企业内部的管理.
主要有管理员、人事专员、员工三种角色。
管理员功能:登录、分发工资、管理其他角色账号
员工功能:注册、登录、打卡、查看工资、请假
人事专员:登录、查看员工信息列表、查看(编辑)考勤情况、请假审批
环境要求
1.运行环境:最好是javajdk1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat7.x,8.x,9.x版本均可
4.硬件环境:windows7/8/101G内存以上;或者MacOS;
5.数据库:MySql5.7版本;
6.是否Maven项目:是;
技术栈
1.后端:Spring+SpringMVC+Mybatis
2.前端:JSP+CSS+JavaScript
使用说明
1.使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2.使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行mavenclean;maveninstall命令,然后运行;
3.将项目中resources/applicationContext.xml配置文件中的数据库配置改为自己的配置;
4.运行成功后,在浏览器中输入地址:http://localhost:8080/userLogin/login
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
}else{
// 设置登录失败提示信息
System.out.println("设置登录失败提示信息");
mv.addObject("message", "登录名或密码错误!请重新输入");
// 服务器内部跳转到登录页面
mv.setViewName("forward:/loginForm");
}
}
return mv;
}
// 如果在目录下输入任何不存在的参数,则跳转到list
@RequestMapping(value="/user/{formName}")
}else{
rainservice.insert_JobInfo(job);
}
mv.setViewName("redirect:/job/list");
return mv;
}
@RequestMapping(value="/job/delete",method=RequestMethod.GET)
public void delete(Integer id){
System.out.println(id);
if(id!=null){
rainservice.delete_JobInfo(id);
}
}
}
}
@RequestMapping(value="/employee/list",method=RequestMethod.GET)
public String index(Model model,String content){
List<Employee> job_list = rainservice.get_EmployeeList();
if (content!=null){
job_list = rainservice.get_EmployeeLikeList(content);
}
model.addAttribute("list",job_list);
return "employee/list";
}
@RequestMapping(value="/employee/add",method=RequestMethod.GET)
public String add(Model model,Integer id){
if(id!=null){
Employee employee = rainservice.get_EmployeeInfo(id);
model.addAttribute("job",employee);
}
List<Dept> dept_list = rainservice.findAllDept();
List<Job> job_list = rainservice.findAllJob();
model.addAttribute("job_list", job_list);
model.addAttribute("dept_list",dept_list);
return "/employee/add";
}
@RequestMapping(value="/employee/add",method=RequestMethod.POST)
public ModelAndView add(ModelAndView mv,@ModelAttribute Employee job ,Integer id){
// System.out.println(id);
if(id!=null){
}else{
rainservice.insert_JobInfo(job);
}
mv.setViewName("redirect:/job/list");
return mv;
}
@RequestMapping(value="/job/delete",method=RequestMethod.GET)
public void delete(Integer id){
System.out.println(id);
if(id!=null){
rainservice.delete_JobInfo(id);
}
}
}
员工管理控制层:
@Controller
public class EmployeeController {
@Autowired
@Qualifier("RainService")
private RainService rainservice;
// 如果在目录下输入为空,则跳转到指定链接
@RequestMapping(value="/employee/")
public ModelAndView index2(ModelAndView mv){
mv.setViewName("employee/list");
return mv;
}
// 如果在目录下输入任何不存在的参数,则跳转到list
@RequestMapping(value="/job/{formName}")
public String index2(@PathVariable String formName){
String blank = "/job/list";
return blank;
}
@RequestMapping(value="/job/list",method=RequestMethod.GET)
public String index(Model model,String content){
List<Job> job_list = rainservice.findAllJob();
if (content!=null){
job_list = rainservice.findAllJob(content);
}
model.addAttribute("list",job_list);
return "job/list";
}
@RequestMapping(value="/job/add",method=RequestMethod.GET)
public String add(Model model,Integer id){
if(id!=null){
Job job = rainservice.get_JobInfo(id);
model.addAttribute("job",job);
model.addAttribute("dept_list",dept_list);
return "/employee/add";
}
@RequestMapping(value="/employee/add",method=RequestMethod.POST)
public ModelAndView add(ModelAndView mv,@ModelAttribute Employee job ,Integer id){
// System.out.println(id);
if(id!=null){
rainservice.update_EmployeeInfo(job);
}else{
rainservice.insert_EmployeeInfo(job);
}
mv.setViewName("redirect:/employee/list");
return mv;
}
@RequestMapping(value="/employee/delete",method=RequestMethod.GET)
public void delete(Integer id){
boolean flag = false;
if("1".equals(tip)) {
User user = rainservice.login(loginname, password);
if(user!=null){
// 将用户保存到HttpSession当中
System.out.println("HttpSession");
session.setAttribute(Constants.USER_SESSION, user);
session.setAttribute("tip", "1");
// 客户端跳转到main页面
mv.setViewName("redirect:/index");
}else{
// 设置登录失败提示信息
System.out.println("设置登录失败提示信息");
mv.addObject("message", "登录名或密码错误!请重新输入");
// 服务器内部跳转到登录页面
mv.setViewName("forward:/loginForm");
}
}else {
Employee user = rainservice.login2(loginname, password);
if(user!=null){
// 将用户保存到HttpSession当中
System.out.println("HttpSession");
session.setAttribute(Constants.USER_SESSION, user);
session.setAttribute("tip", "2");
// 客户端跳转到main页面
// 如果在目录下输入任何不存在的参数,则跳转到list
@RequestMapping(value="/user/{formName}")
public String index2(@PathVariable String formName){
String blank = "/user/list";
return blank;
}
@RequestMapping(value="/user/list",method=RequestMethod.GET)
public String index(Model model,String content){
List<User> job_list = rainservice.get_UserList();
if (content!=null){
job_list = rainservice.get_UserLikeList(content);
}
model.addAttribute("list",job_list);
public String index2(@PathVariable String formName){
String blank = "/employee/list";
return blank;
}
@RequestMapping(value="/employee/list",method=RequestMethod.GET)
public String index(Model model,String content){
List<Employee> job_list = rainservice.get_EmployeeList();
if (content!=null){
job_list = rainservice.get_EmployeeLikeList(content);
}
model.addAttribute("list",job_list);
return "employee/list";
}
@RequestMapping(value="/employee/add",method=RequestMethod.GET)
public String add(Model model,Integer id){
if(id!=null){
Employee employee = rainservice.get_EmployeeInfo(id);
model.addAttribute("job",employee);
}
List<Dept> dept_list = rainservice.findAllDept();
List<Job> job_list = rainservice.findAllJob();
model.addAttribute("job_list", job_list);
model.addAttribute("dept_list",dept_list);
}
// 如果在目录下输入任何不存在的参数,则跳转到list
@RequestMapping(value="/user/{formName}")
public String index2(@PathVariable String formName){
String blank = "/user/list";
return blank;
}
@RequestMapping(value="/user/list",method=RequestMethod.GET)
public String index(Model model,String content){
List<User> job_list = rainservice.get_UserList();
if (content!=null){
job_list = rainservice.get_UserLikeList(content);
}
model.addAttribute("list",job_list);
return "user/list";
}
@RequestMapping(value="/user/add",method=RequestMethod.GET)
public String add(Model model,Integer id){
if(id!=null){
User job = rainservice.get_UserInfo(id);
if(id!=null){
rainservice.update_UserInfo(notice);
}else{
rainservice.insert_UserInfo(notice);
}
mv.setViewName("redirect:/user/list");
return mv;
}
@RequestMapping(value="/user/delete",method=RequestMethod.GET)
public void delete(Integer id){
System.out.println(id);
if(id!=null){
rainservice.delete_UserInfo(id);
}
}