Springboot與vue實(shí)例講解實(shí)現(xiàn)前后端分離的人事管理系統(tǒng)
一,項(xiàng)目簡(jiǎn)介
系統(tǒng)是前后端分離的項(xiàng)目,直接啟動(dòng)Springboot應(yīng)用程序類后,再啟動(dòng)前端工程訪問即可。主要實(shí)現(xiàn)了企業(yè)的人事管理功能,主要包含員工管理、薪資管理、職位管理、權(quán)限管理、網(wǎng)盤文件分享管理等模塊。
系統(tǒng)亮點(diǎn):使用REDIS進(jìn)行數(shù)據(jù)緩存,優(yōu)化查詢性能;使用分布式文件系統(tǒng)進(jìn)行文件存儲(chǔ)服務(wù);基于Springboot+vue實(shí)現(xiàn)前后端分離開發(fā)
二,環(huán)境介紹
語(yǔ)言環(huán)境:Java: jdk1.8
數(shù)據(jù)庫(kù):Mysql: mysql5.7
應(yīng)用服務(wù)器:Tomcat: tomcat8.5.31
開發(fā)工具:IDEA或eclipse
開發(fā)技術(shù):Element UI 、Vue、Axios、SpringBoot、MyBatis、MySQL、Redis、FastDFS(或OSS)、Tomcat8.5.31
三,系統(tǒng)展示
下面展示一下系統(tǒng)的基本功能:
用戶登陸:
系統(tǒng)主界面:
員工管理:
高級(jí)搜索
員工獎(jiǎng)懲管理
添加獎(jiǎng)懲
工資套賬(工資標(biāo)準(zhǔn))管理
員工工資管理
系統(tǒng)管理—部門管理
系統(tǒng)管理--職位管理
系統(tǒng)管理—職稱管理
文件管理:將文件存儲(chǔ)在分布式文件服務(wù)Fastdfs或阿里云OSS上,可以在系統(tǒng)中自行配置
以上是本系統(tǒng)的基本功能功能展示,本系統(tǒng)所使用技術(shù)比較先進(jìn),功能比較完整,界面美觀大方,適合畢業(yè)設(shè)計(jì)使用。
四,核心代碼展示
package com.me.controller; import com.me.pojo.Department; import com.me.pojo.RespBean; import com.me.service.DepartmentService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController public class DepartmentController { @Autowired DepartmentService departmentService; @GetMapping("/dep/deps") public RespBean getAllDepartments() { List<Department> list = departmentService.getAllDepartments(); // for (Department department : list) { // System.out.println(department); // } return RespBean.ok("AllDepartments", list); } @PostMapping("/dep/add") public RespBean addDep(@RequestBody Department dep) { System.out.println(dep); departmentService.addDep(dep); if (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; @RestController public 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.*; @RestController public 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; @RestController public 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("圖片過大或者格式不對(duì)"); } @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; @RestController public 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("更新成功!請(qǐng)重新登錄!"); } 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("圖片過大或者格式不對(duì)"); } }
五,項(xiàng)目總結(jié)
項(xiàng)目采用springboot+vue實(shí)現(xiàn)前后端分離的項(xiàng)目開發(fā),功能簡(jiǎn)潔大方,另外使用了redis緩存數(shù)據(jù)庫(kù)和oss分布式文件存儲(chǔ)服務(wù),是項(xiàng)目的一大亮點(diǎn)。
到此這篇關(guān)于Springboot與vue實(shí)例講解實(shí)現(xiàn)前后端分離的人事管理系統(tǒng)的文章就介紹到這了,更多相關(guān)Springboot人事管理系統(tǒng)內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
- SpringBoot和Vue.js實(shí)現(xiàn)的前后端分離的用戶權(quán)限管理系統(tǒng)
- SpringBoot+Vue+JWT的前后端分離登錄認(rèn)證詳細(xì)步驟
- springboot+VUE前后端分離實(shí)現(xiàn)疫情防疫平臺(tái)JAVA
- SpringBoot+VUE實(shí)現(xiàn)前后端分離的實(shí)戰(zhàn)記錄
- SpringBoot+Vue前后端分離實(shí)現(xiàn)請(qǐng)求api跨域問題
- 部署vue+Springboot前后端分離項(xiàng)目的步驟實(shí)現(xiàn)
- vue+springboot前后端分離工程跨域問題解決方案解析
- 詳解springboot和vue前后端分離開發(fā)跨域登陸問題
- SpringBoot+Vue前后端分離實(shí)現(xiàn)審核功能的示例
相關(guān)文章
jackson 如何將實(shí)體轉(zhuǎn)json json字符串轉(zhuǎn)實(shí)體
這篇文章主要介紹了jackson 實(shí)現(xiàn)將實(shí)體轉(zhuǎn)json json字符串轉(zhuǎn)實(shí)體,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2021-10-10springboot3生成本地文件url的實(shí)現(xiàn)示例
本文主要介紹了springboot3生成本地文件url的實(shí)現(xiàn)示例,從而提供一種高效的文件管理方式,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2024-01-01Java實(shí)現(xiàn)將數(shù)字日期翻譯成英文單詞的工具類實(shí)例
這篇文章主要介紹了Java實(shí)現(xiàn)將數(shù)字日期翻譯成英文單詞的工具類,結(jié)合完整實(shí)例形式分析了Java日期轉(zhuǎn)換與字符串操作相關(guān)實(shí)現(xiàn)技巧,需要的朋友可以參考下2017-09-09Java注解之Retention、Documented、Inherited介紹
這篇文章主要介紹了Java注解之Retention、Documented、Inherited注解介紹,本文內(nèi)容和相關(guān)文章是系列文章,需要的朋友可以參考下2014-09-09簡(jiǎn)單談?wù)凷pringMVC轉(zhuǎn)發(fā)和重定向的區(qū)別
下面小編就為大家?guī)?lái)一篇簡(jiǎn)單談?wù)凷pringMVC轉(zhuǎn)發(fā)和重定向的區(qū)別。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來(lái)看看吧2017-06-06Java接口的作用_動(dòng)力節(jié)點(diǎn)Java學(xué)院整理
這篇文章主要介紹了Java接口的作用,涉及到接口的規(guī)范相關(guān)知識(shí),需要的的朋友參考下2017-04-04Java Mail郵件發(fā)送如何實(shí)現(xiàn)簡(jiǎn)單封裝
這篇文章主要介紹了Java Mail郵件發(fā)送如何實(shí)現(xiàn)簡(jiǎn)單封裝,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2020-11-11