基于javaweb的SSM企业人事管理系统(java+ssm+jsp+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

320023262402

330023262402

350023262402

360023262402

370023262402

基于javaweb的SSM企业人事管理系统(java+ssm+jsp+mysql)

1
2
3
4
5
6
7
管理员:
admin 123456


普通员工:
小张 123456
小王 123456

一、项目简述

功能介绍:员工管理,用户管理,部门管理,文档管理, 职位管理等等。

二、项目运行

环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)

项目技术: JSP +Spring + SpringMVC + html+ css + JavaScript + JQuery + Ajax等等。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33


@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="/employee/{formName}")
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);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

/**
* 判断用户权限的Spring MVC的拦截器
*/
public class AuthorizedInterceptor implements HandlerInterceptor {

/** 定义不需要拦截的请求 */
private static final String[] IGNORE_URI = {"/loginForm", "/login","/404.html"};

/**
* 该方法需要preHandle方法的返回值为true时才会执行。
* 该方法将在整个请求完成之后执行,主要作用是用于清理资源。
*/
@Override
public void afterCompletion(HttpServletRequest request,
HttpServletResponse response, Object handler, Exception exception)
throws Exception {

}

/**
* 这个方法在preHandle方法返回值为true的时候才会执行。
* 执行时间是在处理器进行处理之 后,也就是在Controller的方法调用之后执行。
*/
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response,
Object handler, ModelAndView mv) throws Exception {

}

/**
* preHandle方法是进行处理器拦截用的,该方法将在Controller处理之前进行调用,
* 当preHandle的返回值为false的时候整个请求就结束了。
* 如果preHandle的返回值为true,则会继续执行postHandle和afterCompletion。
*/
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
Object handler) throws Exception {
/** 默认用户没有登录 */
boolean flag = false;
/** 获得请求的ServletPath */
String servletPath = request.getServletPath();
System.out.println(servletPath);
/** 判断请求是否需要拦截 */
for (String s : IGNORE_URI) {
if (servletPath.contains(s)) {
flag = true;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
				model.addAttribute("job",job);
}
return "/user/add";
}
@RequestMapping(value="/user/add",method=RequestMethod.POST)
public ModelAndView add(ModelAndView mv,@ModelAttribute User notice ,Integer id){
System.out.println(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);
}
}
// 管理员自己修改密码时跳转的页面
@RequestMapping(value="/user/myupdate",method=RequestMethod.GET)
public String update(Model model,HttpSession session){
User user = (User) session.getAttribute(Constants.USER_SESSION);
model.addAttribute("job",user);
return "/user/myupdate";
}
@RequestMapping(value="/user/myupdate",method=RequestMethod.POST)
public ModelAndView update(ModelAndView mv,Model model,HttpSession session,User notice){
User user = (User) session.getAttribute(Constants.USER_SESSION);
// 如果是自己修改自己的密码,则更新session
user.setLoginname(notice.getLoginname());
user.setPassword(notice.getPassword());
user.setUsername(notice.getUsername());
rainservice.update_UserInfo(user);
session.setAttribute(Constants.USER_SESSION, user);
mv.setViewName("redirect:/user/myupdate");
return mv;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44

@Controller
public class DocumentController {
@Autowired
@Qualifier("RainService")
private RainService rainservice;
// 如果在目录下输入为空,则跳转到指定链接
@RequestMapping(value="/document/")
public ModelAndView index2(ModelAndView mv){
mv.setViewName("document/list");
return mv;
}
// 如果在目录下输入任何不存在的参数,则跳转到list
@RequestMapping(value="/document/{formName}")
public String index2(@PathVariable String formName){
String blank = "/document/list";
return blank;
}
@RequestMapping(value="/document/list",method=RequestMethod.GET)
public String index(Model model,String content){
List<Document> job_list = rainservice.get_DocumentList();
if (content!=null){
job_list = rainservice.get_DocumentLikeList(content);
}
model.addAttribute("list",job_list);
return "document/list";
}
@RequestMapping(value="/document/add",method=RequestMethod.GET)
public String add(Model model,Integer id){
if(id!=null){
Document job = rainservice.get_DocumentInfo(id);
model.addAttribute("job",job);
}
return "/document/add";
}
@RequestMapping(value="/document/add",method=RequestMethod.POST)
public ModelAndView add(ModelAndView mv,@ModelAttribute Document document ,Integer id,HttpSession session
)
throws Exception{
System.out.println(id);
if(id!=null){
rainservice.update_DocumentInfo(document);
}else{
/**
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
			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){
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){
// System.out.println(id);
if(id!=null){
rainservice.delete_EmployeeInfo(id);
}
}
}
package com.rain.controller;




@Controller
public class DeptController {
@Autowired
@Qualifier("RainService")
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
				model.addAttribute("job",job);
}
return "/document/add";
}
@RequestMapping(value="/document/add",method=RequestMethod.POST)
public ModelAndView add(ModelAndView mv,@ModelAttribute Document document ,Integer id,HttpSession session
)
throws Exception{
System.out.println(id);
if(id!=null){
rainservice.update_DocumentInfo(document);
}else{
/**
* 上传文件
*/
String path = session.getServletContext().getRealPath("/upload/");
String filename = document.getFile().getOriginalFilename();
path = "D://upload//";
File tempFile = new File(path+File.separator+filename);
tempFile.createNewFile();
document.getFile().transferTo(tempFile);
document.setFilename(filename);
rainservice.insert_DocumentInfo(document);
}
mv.setViewName("redirect:/document/list");
return mv;
}
@RequestMapping(value="/document/delete",method=RequestMethod.GET)
public void delete(Integer id){
System.out.println(id);
if(id!=null){
rainservice.delete_DocumentInfo(id);
}
}
}
package com.rain.interceptor;



项目链接:
https://javayms.github.io?id=411422302105200gs
https://javayms.pages.dev?id=411422302105200gs