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






基于javaweb的SpringBootoa人事管理系统(java+springboot+layui+html+thymeleaf+mysql+maven)
项目介绍:
员工管理、部门管理、职位管理、薪资管理、考勤管理、请假管理、奖惩管理、日志管理、文件下载、文件上传、图表展示
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
4.数据库:MySql 5.7版本;
技术栈
JSP +SpringBoot + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等
——————————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 34 35 36 37 38 39 40 41 42 43 44 45 46
|
@Controller @RequestMapping("/log") public class LogController { private static final String LOG_QUERY_SUCCESS = "查询完毕"; private static final String LOG_INSERT_SUCCESS = "插入成功"; private static final String LOG_DELETE_SUCCESS = "删除成功";
@Autowired LogService logService; @RequestMapping("") public String toLogUi(){ return "log/loglist"; }
@RequestMapping("/list") @ResponseBody public Result queryLogList(LogExample logExample) { LogExample.Criteria criteria = logExample.createCriteria(); criteria.andCreatedByIsNotNull(); List<Log> logsList = logService.queryLogList(logExample); return Result.success(LOG_QUERY_SUCCESS, logsList); }
@RequestMapping("/add") @ResponseBody public Result insertLog(Employee employee, String msg) throws UnknownHostException { Log log = new Log(); InetAddress addr = InetAddress.getLocalHost(); log.setLoginIp(addr.getHostAddress()); log.setLoginName(employee.getUsername()); log.setLoginMsg(msg);
|
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
|
@Controller @RequestMapping("/log") public class LogController { private static final String LOG_QUERY_SUCCESS = "查询完毕"; private static final String LOG_INSERT_SUCCESS = "插入成功"; private static final String LOG_DELETE_SUCCESS = "删除成功";
@Autowired LogService logService; @RequestMapping("") public String toLogUi(){ return "log/loglist"; }
@RequestMapping("/list") @ResponseBody public Result queryLogList(LogExample logExample) { LogExample.Criteria criteria = logExample.createCriteria(); criteria.andCreatedByIsNotNull(); List<Log> logsList = logService.queryLogList(logExample); return Result.success(LOG_QUERY_SUCCESS, logsList);
|
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
| out.close(); } catch (IOException e) { return Result.fail("上传失败"); } return Result.success("上传成功"); } else { return null; } } } package com.xlk.controller;
@Controller @RequestMapping("/filedDownload") public class FileDownloadController { @Autowired xlkFileService xlkFileService;
@RequestMapping("") public String toFileDownloadUi() { return "file/fileList"; }
@GetMapping("/list")
|
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 48 49 50 51 52 53 54
| @GetMapping("/{id}") public String queryEmpById(@PathVariable("id") Integer id,Model model){ List<Department> deptList=departmentService.queryAll(); List<Level> levelList=levelService.queryAll(); model.addAttribute("levelList",levelList); model.addAttribute("deptList",deptList); Employee employee = employeeService.queryEmpById(id); model.addAttribute("emp",employee); return "emp/empedit"; }
@RequestMapping("/update") @ResponseBody public Result<Object> updateEmp(Employee employee,@Param("department.id") String dept_id,String level_id) { employee.setDepartment(departmentService.queryById(dept_id)); employee.setLevel(levelService.queryById(level_id)); employeeService.updateEmp(employee); return Result.success("修改成功"); }
@RequestMapping("/queryEmpByDept") @ResponseBody public List<Employee> queryEmpByDept(String dept_id){ List<Employee> employeeList = employeeService.queryEmpByDeptId(Integer.valueOf(dept_id)); System.out.println(employeeList); return employeeList; }
@RequestMapping("/updateEmpPassword") @ResponseBody public Result<Object> updatePassword(HttpSession session, String old_password, String new_password, String again_password){ Employee loginUser = (Employee) session.getAttribute("loginUser"); boolean matches =old_password.equals(loginUser.getPassword()); if(matches) { if(new_password.equals(again_password)) { loginUser.setPassword(new_password); employeeService.updatePassword(loginUser); return Result.success("修改密码成功"); } else { return Result.fail("二次重复密码不一致"); } } return Result.success("老密码错误");
|
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 48 49
| attendance.setStartDate(new java.sql.Date(new java.util.Date().getTime())); attendance.setStarttime(time.parse(time.format(new Date()))); attendanceService.addAttendance(attendance); return Result.success(employee.getName() + "打卡成功"); } }
@GetMapping("/{id}") public String queryAttendanceById(@PathVariable("id") Integer id, Model model) { model.addAttribute("empList", employeeService.queryAll()); model.addAttribute("attendance", attendanceService.queryById(id)); return "attendance/attendanceedit"; }
@RequestMapping("/update") @ResponseBody public Result<Object> updateAttendance(String id, String startDate, String starttime, String endtime, String employee_name, String status) throws ParseException { Attendance attendance = attendanceService.queryById(Integer.valueOf(id)); Date startDate1 = new SimpleDateFormat("yyyy-MM-dd").parse(startDate); Date starttime1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(starttime); Date endtime1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(endtime); Long time = endtime1.getTime() - starttime1.getTime(); Double worktime = time / 1000.0 / 60.0 / 60.0; if (worktime <= 0) { return Result.fail("工作时长不能为0或小于0"); } else { attendance.setStarttime(startDate1); attendance.setEmployee_name(employee_name); attendance.setWorktime(DoubleFX.getDoubleToString(worktime, 2)); attendance.setStarttime(starttime1); attendance.setEndtime(endtime1); attendance.setStatus(Integer.parseInt(status)); attendanceService.updateAttendance(attendance); return Result.success("修改成功"); } }
@RequestMapping("/empupdate") @ResponseBody public Result<Object> EmpupdateAttendance(HttpSession session) throws ParseException { SimpleDateFormat time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Employee employee = (Employee) session.getAttribute("loginUser"); Attendance attendance = attendanceService.queryByEmpAndDate(employee.getName(), new java.sql.Date(new Date().getTime())); Date date = time.parse(time.format(new Date())); if (attendance == null) { return Result.fail("你今日还未打卡"); } 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 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| @GetMapping("/list") @ResponseBody public Result<Object> getLevelList(LevelQuery param){ List<Level> list=levelService.getLevelList(param); Long count=levelService.countLevelList(param); return Result.success("success",list,count); }
@PostMapping("/add") @ResponseBody public Result<Object> addLevel(Level level) { levelService.addLevel(level); return Result.success("添加职位成功"); }
@RequestMapping("/levelAdd") public String toLevelAdd(Model model){ model.addAttribute("deptList",departmentService.queryAll()); return "level/leveladd"; }
@PostMapping("/delete/{ids}") @ResponseBody public Result<Object> deleteLevelById(@PathVariable("ids") String ids) { levelService.deleteLevelById(ids); return Result.success("删除职位成功"); }
@GetMapping("/{id}") public String queryLevelById(@PathVariable("id") String id, Model model){ model.addAttribute("level",levelService.queryById(id)); model.addAttribute("deptList",departmentService.queryAll()); return "level/leveledit"; }
@RequestMapping("/update") @ResponseBody public Result<Object> updateLevel(Level level) { System.out.println(level);
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=192322092805200ly
https://javayms.pages.dev?id=192322092805200ly