vue spring boot前后端分离开发实战PDF,springboot+vue前后端分离项目
00-1010一、项目介绍二、环境介绍三、系统展示四、核心代码展示五、项目总结
00-1010系统是一个前端和后端分离的项目。直接启动Springboot应用类就行了,然后启动前端项目access。主要实现企业的人事管理功能,包括员工管理、工资管理、职位管理、权限管理、网盘文件共享管理等模块。
系统亮点:使用REDIS进行数据缓存,优化查询性能;使用分布式文件系统进行文件存储服务;基于Springboot vue的前后端分离开发
00-1010区域设置:Java: jdk1.8
数据库:Mysql:
服务器:Tomcat: tomcat8.5.31
开发工具:IDEA还是eclipse
技术:Element UI、Vue、Axios、SpringBoot、MyBatis、MySQL、Redis、FastDFS(或OSS)、Tomcat8.5.31
00-1010系统的基本功能如下:
用户登录:
主系统界面:
员工管理:
高级搜索
员工奖惩管理
添加奖惩
工资设置账户(工资标准)管理
员工薪酬管理
系统管理-部门管理
系统管理-职位管理
系统管理-标题管理
文件管理:文件存储在分布式文件服务Fastdfs或阿里云OSS上,可在系统中自行配置。
以上是本系统的基本功能展示。本系统采用的技术先进,功能齐全,界面美观大方,适合毕业设计。
目录
包com . me . controller;导入com . me . POJO . department;导入com . me . POJO . resp bean;导入com . me . service . department service;导入org . spring framework . beans . factory . annotation . auto wired;导入org . spring framework . web . bind . annotation . *;导入Java . util . list;@ RestControllerpublic class department controller { @ auto wired department service department service;@ get mapping(/dep/deps )public resp bean getall departments(){ list department list=department service . getall departments();//for(Department Department : list){//system . out . println(Department);//} return resp bean . ok( all departments ,list);} @ post mapping(/dep/add )public resp bean add dep(@ request body dep){ system . out . println(dep);department service . add dep(dep);我
f (dep.getResult() == 1) { return RespBean.ok("添加成功", dep); } return RespBean.error("添加失败"); } @DeleteMapping("/dep/{id}") public RespBean deleteDepById(@PathVariable Integer id) { Department dep = new Department(); dep.setId(id); departmentService.deleteDepById(dep); if (dep.getResult() == -2) { return RespBean.error("该部门下有子部门,删除失败"); } else if (dep.getResult() == -1) { return RespBean.error("该部门下有员工,删除失败"); } else if (dep.getResult() == 1) { return RespBean.ok("删除成功"); } return RespBean.error("删除失败"); }}
package com.me.controller;import com.fasterxml.jackson.annotation.JsonFormat;import com.me.pojo.*;import com.me.service.DepartmentService;import com.me.service.EmployeeService;import com.me.service.JobLevelService;import com.me.service.PositionService;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.web.bind.annotation.*;import java.util.Date;import java.util.List;@RestControllerpublic class EmpController { @Autowired EmployeeService employeeService; @Autowired PositionService positionService; @GetMapping("/emp/query") public RespPageBean getEmployeeByPage(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size, Employee employee, Date[] beginDateScope) {// System.out.println(employee); return employeeService.getEmployeeByPage(page, size, employee, beginDateScope); } @PostMapping("/emp/add") public RespBean addEmp(@RequestBody Employee employee) {// System.out.println(employee); if (employeeService.addEmp(employee) == 1) { return RespBean.ok("添加成功!"); } return RespBean.error("添加失败!"); } @PutMapping("/emp/update") public RespBean updateEmp(@RequestBody Employee employee) {// System.out.println(employee); if (employeeService.updateEmp(employee) == 1) { return RespBean.ok("更新成功!"); } return RespBean.error("更新失败!"); } @DeleteMapping("/emp/delete/{id}") public RespBean deleteEmpByEid(@PathVariable Integer id) { if (employeeService.deleteEmpByEid(id) == 1) { return RespBean.ok("删除成功!"); } return RespBean.error("删除失败!"); } @GetMapping("/emp/getAllPositions") public RespBean getAllPositions() { return RespBean.ok("positions-",positionService.getAllPositions()) ; } @GetMapping("/emp/nations") public RespBean getAllNations() { return RespBean.ok("nations-",employeeService.getAllNations()); } @GetMapping("/emp/politicsstatus") public RespBean getAllPoliticsstatus() { return RespBean.ok("politicsss-",employeeService.getAllPoliticsstatus()) ; } @Autowired private JobLevelService jobLevelService; @GetMapping("/emp/joblevels") public RespBean getAllJobLevels() { return RespBean.ok("joblevels-",jobLevelService.getAllJobLevels()); } @Autowired private DepartmentService departmentService; @GetMapping("/emp/deps") public RespBean getAllDepartments() { List<Department> list = departmentService.getAllDepartments();// for (Department department : list) {// System.out.println(department);// } return RespBean.ok("AllDepartments", list); }}
package com.me.controller;import com.me.pojo.Employee;import com.me.pojo.Employeeec;import com.me.pojo.RespBean;import com.me.pojo.RespPageBean;import com.me.service.EmployeeecService;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.web.bind.annotation.*;@RestControllerpublic class EmployeeecController { @Autowired EmployeeecService employeeecService; @GetMapping("/ec/{keyword}") public RespBean selectByNameOrWorkId(@PathVariable String keyword){ System.out.println(keyword); return RespBean.ok("获取到-",employeeecService.selectByNameOrWorkId(keyword)); } @DeleteMapping("/ec/{id}") public RespBean deleteById(@PathVariable int id){ System.out.println(id); if(employeeecService.deleteById(id)==1){ return RespBean.ok("删除成功"); } return RespBean.error("失败"); } @PostMapping("/ec/add") public RespBean add(@RequestBody Employeeec employeeec){ System.out.println(employeeec); if(employeeecService.insertEc(employeeec)==1){ return RespBean.ok("添加成功"); } return RespBean.error("失败"); } @PutMapping("/ec/update") public RespBean put(@RequestBody Employeeec employeeec){ System.out.println(employeeec); if(employeeecService.updateEc(employeeec)==1){ return RespBean.ok("添加成功"); } return RespBean.error("失败"); }}
package com.me.controller;import com.me.pojo.RespBean;import com.me.service.FileService;import com.me.util.MD5Util;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.data.redis.core.StringRedisTemplate;import org.springframework.web.bind.annotation.*;import org.springframework.web.multipart.MultipartFile;import javax.servlet.http.HttpServletRequest;@RestControllerpublic class FileController { @Autowired FileService fileService; @Autowired private StringRedisTemplate stringRedisTemplate; @PostMapping("/file/upload") public RespBean updateFile(MultipartFile file,int id) { System.out.println(id); System.out.println(MD5Util.getMultiFileMd5(file)); if(fileService.uploadFile(file,id)){ return RespBean.ok("上传成功"); } return RespBean.error("图片过大或者格式不对"); } @DeleteMapping("/file/{id}") public RespBean deleteById(@PathVariable int id){// System.out.println(id); if(fileService.deleteById(id)){ return RespBean.ok("删除成功"); } return RespBean.error("删除失败"); } @GetMapping("/file/getAll/{id}") public RespBean getAll(@PathVariable String id){ return RespBean.ok("files-",fileService.getAllHrFiles(id)); } @GetMapping("/file/getLoginHrId") public RespBean getHrId(HttpServletRequest request){ String token = request.getHeader("token"); String s = stringRedisTemplate.opsForValue().get("id"+token); return RespBean.ok("获取到用户id",s); }}
package com.me.controller;import com.me.pojo.Hr;import com.me.pojo.RespBean;import com.me.service.HrService;import org.csource.fastdfs.StorageClient1;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.data.redis.core.StringRedisTemplate;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.*;import org.springframework.web.multipart.MultipartFile;import javax.servlet.http.HttpServletRequest;import java.util.Map;@RestControllerpublic class HrController { @Autowired private StringRedisTemplate stringRedisTemplate; @Autowired private HrService hrService; @GetMapping("/hr/getLoginUser") public RespBean getLoginUser(HttpServletRequest request){ String token = request.getHeader("token"); String s = stringRedisTemplate.opsForValue().get(token);// System.out.println("getLoginUser"+s); Hr hr = hrService.loadUserByUsername(s); return RespBean.ok("获取到用户",hr); } @PutMapping("/hr/pass") public RespBean updateHrPasswd(@RequestBody Map<String, Object> info,HttpServletRequest request) { String oldpass = (String) info.get("oldpass"); String pass = (String) info.get("pass"); Integer hrid = (Integer) info.get("hrid"); System.out.println(hrid+pass); if (hrService.updateHrPasswd(oldpass, pass, hrid)) { //修改密码后需要重新登录 String token = request.getHeader("token"); Boolean b = stringRedisTemplate.delete(token); return RespBean.ok("更新成功!请重新登录!"); } return RespBean.error("更新失败!"); } @PutMapping("/hr/info") public RespBean updateHr(@RequestBody Hr hr) { if (hrService.updateHr(hr) == 1) { return RespBean.ok("更新成功!"); } return RespBean.error("更新失败!"); } @PostMapping("/hr/userface") public RespBean updateHrUserface(MultipartFile file, Integer id) { System.out.println("face "+id); if(hrService.updateHrUserface(file,id)){ return RespBean.ok("更新成功!"); } return RespBean.error("图片过大或者格式不对"); }}
五,项目总结
项目采用springboot+vue实现前后端分离的项目开发,功能简洁大方,另外使用了redis缓存数据库和oss分布式文件存储服务,是项目的一大亮点。
到此这篇关于Springboot与vue实例讲解实现前后端分离的人事管理系统的文章就介绍到这了,更多相关Springboot人事管理系统内容请搜索盛行IT以前的文章或继续浏览下面的相关文章希望大家以后多多支持盛行IT!
郑重声明:本文由网友发布,不代表盛行IT的观点,版权归原作者所有,仅为传播更多信息之目的,如有侵权请联系,我们将第一时间修改或删除,多谢。