Java项目:简单Hr管理系统(java+Servlet+Jsp+mysql)
2022/1/17 19:09:22
本文主要是介绍Java项目:简单Hr管理系统(java+Servlet+Jsp+mysql),对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
基于Java+Servlet+Mysql+Jsp实现的hr系统,功能很简单就一个角色,功能有:部门管理、职位管理、培训管理、薪资管理、员工管理、招聘管理、公告管理、文件管理等。
运行环境:jdk1.8、tomcat7.0/8.5、mysql5.x、eclipse、navicat。
部门管理控制层:
@RequestMapping("/Department") @RestController public class DepartmentController { @Autowired IDepartmentService departmentService; @Autowired private HttpServletRequest request; @PostMapping("/addDepartment") public Result addDepartment(@RequestParam("departmentNumber") String departmentNumber, @RequestParam("departmentName") String departmentName, @RequestParam("departmentHead") String departmentHead, @RequestParam("departmentAddress") String departmentAddress, @RequestParam("departmentTel") String departmentTel, @RequestParam("departmentFax") String departmentFax)throws ParseException { SimpleDateFormat formatter=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Department department = new Department(); department.setDepartmentName(departmentName); department.setDepartmentNumber(departmentNumber); department.setDepartmentAddress(departmentAddress); department.setDepartmentHead(departmentHead); department.setDepartmentTel(departmentTel); department.setDepartmentFax(departmentFax); return departmentService.addDepartment(department); } @GetMapping("/getAllDepartments") public ModelAndView getAllDepartments(){ departmentService.getAllDepartments(); // System.out.println("就是"+request.getSession().getAttribute("departmentPage")); return new ModelAndView("department"); } @PostMapping("/deleteDepartment") public Result deleteDepartment(@RequestParam("ids") String ids){ return departmentService.deleteDepartment(ids); } @PostMapping("/modifyDepartment") public Result modifyDepartment(@RequestParam("departmentNumber") String departmentNumber, @RequestParam("departmentName") String departmentName, @RequestParam("departmentHead") String departmentHead, @RequestParam("departmentAddress") String departmentAddress, @RequestParam("departmentTel") String departmentTel, @RequestParam("departmentFax") String departmentFax, @RequestParam("id") long id)throws ParseException{ Department department = new Department(); department.setDepartmentName(departmentName); department.setDepartmentNumber(departmentNumber); department.setDepartmentAddress(departmentAddress); department.setDepartmentHead(departmentHead); department.setDepartmentTel(departmentTel); department.setDepartmentFax(departmentFax); department.setId(id); // System.out.println("department修改: "+ department); return departmentService.modifyDepartment(department); } @GetMapping("/getPage") public ModelAndView getPage(@RequestParam("currentPage") Integer currentPage){ departmentService.getPageDatas(currentPage); // System.out.println("currentPage: "+currentPage); return new ModelAndView("department"); } @GetMapping("/getDepartmentById") public Result getDepartmentById(@RequestParam("id") long id){ return departmentService.getDepartmentById(id); } @GetMapping("/getDepartmentByDepartmentNumber") public ModelAndView getDepartmentByDepartmentNumber(@RequestParam("departmentNumber") String departmentNumber)throws ParseException{ departmentService.getDepartmentByDepartmentNumber(departmentNumber); return new ModelAndView("department"); } @PostMapping("/getDepartmentNumberByDepartmentName") public Result getDepartmentNumberByDepartmentName(@RequestParam("departmentName") String departmentName)throws ParseException{ return departmentService.getDepartmentNumberByDepartmentName(departmentName); } }
员工管理控制层:
@Controller @RequestMapping("/employee") public class EmployeeController { @Autowired private IEmployeeService employeeService; @Autowired private EmployeeServiceImpl employeeServiceImpl; @PostMapping("/login") public ModelAndView login(Employee employee, HttpServletRequest request){ Result result = employeeService.login(employee); if (result.getCode()==0){ return new ModelAndView("redirect:/page/index"); } request.setAttribute("pageMsg",result.getMsg()); return new ModelAndView("forward:/page/login"); } @PostMapping("/del_employees") @ResponseBody public ModelAndView deleteEmployees(@RequestParam("ids") String ids){ employeeService.deleteEmployees(ids); return new ModelAndView("employeeInfo"); } @GetMapping("/getPage") public ModelAndView getPage(@RequestParam("currentPage") Integer currentPage){ employeeService.getPageDatas(currentPage); return new ModelAndView("employeeInfo"); } @PostMapping("/addEmployee") @ResponseBody public Result addEmployee(Employee employee){ return employeeService.addEmployee(employee); } @GetMapping("/getUpdateEmployeeInfo") public ModelAndView getUpdateEmployeeInfo(){ employeeServiceImpl.updateAllEmployeeToSession(); return new ModelAndView("employeeInfo"); } @GetMapping("/getMyAccount") public ModelAndView getMyAccount(){ return new ModelAndView("myAccount"); } @GetMapping("/getEmployee") @ResponseBody public Result getEmployee(@RequestParam("id") long id){ Employee employee = new Employee(); employee.setId(id); return employeeService.getEmployee(employee); } @PostMapping("/updateEmployeeById") @ResponseBody public Result updateEmployeeById(Employee employee){ return employeeService.updateEmployeeById(employee); } @PostMapping("/getEmployeeByNumber") @ResponseBody public Result getEmployeeByNumber(Employee employee){ return employeeService.getEmployeeByNumber(employee.getEmployeeNumber()); } @PostMapping("/updateEmployeeByNumber") @ResponseBody public Result updateEmployeeByNumber(Employee employee){ return employeeService.updateEmployeeByNumber(employee); } @PostMapping("/uploadMyImage") @ResponseBody public Result upLoadMyImage(){ return employeeService.upLoadMyImage(); } @GetMapping("/clearLogin") @ResponseBody public Result clearLogin(){ return employeeServiceImpl.clearLogin(); } @PostMapping("/modifyPwd") @ResponseBody public Result modifyPwd(@RequestParam("oldPwd") String oldPwd,@RequestParam("newPwd") String newPwd){ return employeeService.modifyPwd(oldPwd,newPwd); } @GetMapping("/loginYesOrNo") @ResponseBody public Result loginYesOrNo(){ employeeServiceImpl.getEmployeeLoginInfo(); return new Result(0,"已登录",null); } @GetMapping("/getEmployeeByEmployeeNumber") @ResponseBody public Result getEmployeeByEmployeeNumber(@RequestParam("employeeNumber") String employeeNumber)throws ParseException { Employee employee = new Employee(); employee.setEmployeeNumber(employeeNumber); return employeeService.getEmployeeByEmployeeNumber(employee); } @PostMapping("/getEmployeeByName") @ResponseBody public Result getEmployeeByName(Employee employee)throws ParseException{ return employeeService.getEmployeeByName(employee.getEmployeeName()); } @GetMapping("/getPersonByEmployeeNumber") @ResponseBody public ModelAndView getPersonByEmployeeNumber(@RequestParam("employeeNumber") String employeeNumber){ Employee employee = new Employee(); employee.setEmployeeNumber(employeeNumber); employeeServiceImpl.getPersonByEmployeeNumber(employee); return new ModelAndView("employeeInfo"); } }
公告管理控制层:
@RequestMapping("/BulletinResource") @RestController public class BulletinResourceController { @Autowired IBulletinResourceService bulletinResourceService; @PostMapping("/addBulletinResource") public Result addBulletinResource(@RequestParam("title") String title, @RequestParam("startDate") String startDate, @RequestParam("endDate") String endDate, @RequestParam("content") String content)throws ParseException{ SimpleDateFormat formatter=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); startDate = startDate.replace("T"," ")+":00"; Date startDate1=formatter.parse(startDate); endDate = endDate.replace("T"," ")+":00"; Date endDate1=formatter.parse(endDate); BulletinResource bulletinResource = new BulletinResource(); bulletinResource.setStartDate(startDate1); bulletinResource.setEndDate(endDate1); bulletinResource.setTitle(title); bulletinResource.setContent(content); return bulletinResourceService.addBulletinResource(bulletinResource); } @GetMapping("/getAllBulletinResources") public ModelAndView getAllBulletinResources(){ bulletinResourceService.getAllBulletinResources(); return new ModelAndView("bulletin"); } @PostMapping("/deleteBulletinResource") public Result deleteBulletinResource(@RequestParam("ids") String ids){ return bulletinResourceService.deleteBulletinResource(ids); } @PostMapping("/modifyBulletinResource") public Result modifyBulletinResource(@RequestParam("title") String title,@RequestParam("startDate") String startDate, @RequestParam("endDate") String endDate,@RequestParam("content") String content,@RequestParam("id") long id)throws ParseException{ SimpleDateFormat formatter=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); startDate = startDate.replace("T"," ")+":00"; Date startDate1=formatter.parse(startDate); endDate = endDate.replace("T"," ")+":00"; Date endDate1=formatter.parse(endDate); BulletinResource bulletinResource = new BulletinResource(); bulletinResource.setStartDate(startDate1); bulletinResource.setEndDate(endDate1); bulletinResource.setTitle(title); bulletinResource.setContent(content); bulletinResource.setId(id); return bulletinResourceService.modifyBulletinResource(bulletinResource); } @GetMapping("/getPage") public ModelAndView getPage(@RequestParam("currentPage") Integer currentPage){ bulletinResourceService.getPageDatas(currentPage); // System.out.println("bulletin currentPage : "+currentPage); return new ModelAndView("bulletin"); } @GetMapping("/getBulletinById") public Result getBulletinById(@RequestParam("id") long id){ return bulletinResourceService.getBulletinById(id); } @GetMapping("/getBulletinResourceById") public ModelAndView getBulletinResourceById(@RequestParam("id") long id)throws ParseException{ bulletinResourceService.getBulletinResourceById(id); return new ModelAndView("bulletin"); } @PostMapping("/getIdByTitle") public Result getIdByTitle(@RequestParam("bulletintitle") String bulletintitle)throws ParseException{ return bulletinResourceService.getIdByTitle(bulletintitle); } }
这篇关于Java项目:简单Hr管理系统(java+Servlet+Jsp+mysql)的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-06-26结对编程到底难不难?答案在这里
- 2024-06-19《2023版Java工程师》课程升级公告
- 2024-06-15matplotlib作图不显示3D图,怎么办?
- 2024-06-1503-Loki 日志监控
- 2024-06-1504-让LLM理解知识 -Prompt
- 2024-06-05做软件测试需要懂代码吗?
- 2024-06-0514-ShardingSphere的分布式主键实现
- 2024-06-03为什么以及如何要进行架构设计权衡?
- 2024-05-31全网首发第二弹!软考2024年5月《软件设计师》真题+解析+答案!(11-20题)
- 2024-05-31全网首发!软考2024年5月《软件设计师》真题+解析+答案!(21-30题)