——————————DescriptionStart——————————
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明





基于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等等。
——————————CodeStart——————————
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; } @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
|
public class AuthorizedInterceptor implements HandlerInterceptor {
private static final String[] IGNORE_URI = {"/loginForm", "/login","/404.html"};
@Override public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception exception) throws Exception { }
@Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView mv) throws Exception { }
@Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { boolean flag = false; 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);
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; } @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){
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){
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;
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=411422302105200gs
https://javayms.pages.dev?id=411422302105200gs