current position:Home>Implementation of enterprise personnel management system by separating the front and back ends of springboot + Vue
Implementation of enterprise personnel management system by separating the front and back ends of springboot + Vue
2022-04-29 05:20:41【qq_ four hundred and sixty-nine million six hundred and three t】
Author URI : Programming compass
Author's brief introduction :Java Quality creators in the field 、CSDN Blogger 、 Nuggets guest author 、 Years of architect design experience 、 Tencent classroom resident lecturer
primary coverage :Java project 、 Graduation project 、 The resume template 、 Learning materials 、 Interview question bank 、 Technical assistance
Get the source code at the end of the article
One , Project brief introduction
The system is a front and rear end separated project , Direct start Springboot After application class , Start the front-end engineering access again . The main implementation The personnel management function of the enterprise , It mainly includes employee management 、 Salary management 、 Position management 、 Rights management 、 Network disk file sharing management and other modules .
System highlights : Use REDIS Data caching , Optimize query performance ; Use distributed file system for file storage service ; be based on Springboot+vue Realize the separation of front and back end development
Two , Introduction to the environment
Language environment :Java: jdk1.8
database :Mysql: mysql5.7
application server :Tomcat: tomcat8.5.31
development tool :IDEA or eclipse
Development technology :Element UI 、Vue、Axios、SpringBoot、MyBatis、MySQL、Redis、FastDFS( or OSS)、Tomcat8.5.31
3、 ... and , System display
The following shows the basic functions of the system :
The user login :
System main interface :
Employee management :
Advanced search
Employee reward and punishment management
Add rewards and punishments
Payroll ledger ( Salary standard ) management
Employee salary management
System management — Department of management
System management -- Position management
System management — Title Management
file management : Store files in a distributed file service Fastdfs Or alicloud OSS On , It can be configured in the system
The above is the basic function of the system , The technology used in this system is relatively advanced , The function is relatively complete , Beautiful interface , Suitable for graduation project .
Four , Core code display
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(" Add success ", dep);
}
return RespBean.error(" Add failure ");
}
@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(" There are sub departments under this department , Delete failed ");
} else if (dep.getResult() == -1) {
return RespBean.error(" There are employees in this department , Delete failed ");
} else if (dep.getResult() == 1) {
return RespBean.ok(" Delete successful ");
}
return RespBean.error(" Delete failed ");
}
}
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(" Add success !");
}
return RespBean.error(" Add failure !");
}
@PutMapping("/emp/update")
public RespBean updateEmp(@RequestBody Employee employee) {
// System.out.println(employee);
if (employeeService.updateEmp(employee) == 1) {
return RespBean.ok(" The update is successful !");
}
return RespBean.error(" Update failed !");
}
@DeleteMapping("/emp/delete/{id}")
public RespBean deleteEmpByEid(@PathVariable Integer id) {
if (employeeService.deleteEmpByEid(id) == 1) {
return RespBean.ok(" Delete successful !");
}
return RespBean.error(" Delete failed !");
}
@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(" Get -",employeeecService.selectByNameOrWorkId(keyword));
}
@DeleteMapping("/ec/{id}")
public RespBean deleteById(@PathVariable int id){
System.out.println(id);
if(employeeecService.deleteById(id)==1){
return RespBean.ok(" Delete successful ");
}
return RespBean.error(" Failure ");
}
@PostMapping("/ec/add")
public RespBean add(@RequestBody Employeeec employeeec){
System.out.println(employeeec);
if(employeeecService.insertEc(employeeec)==1){
return RespBean.ok(" Add success ");
}
return RespBean.error(" Failure ");
}
@PutMapping("/ec/update")
public RespBean put(@RequestBody Employeeec employeeec){
System.out.println(employeeec);
if(employeeecService.updateEc(employeeec)==1){
return RespBean.ok(" Add success ");
}
return RespBean.error(" Failure ");
}
}
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(" Upload successful "); } return RespBean.error(" The picture is too large or the format is wrong "); } @DeleteMapping("/file/{id}") public RespBean deleteById(@PathVariable int id){ // System.out.println(id); if(fileService.deleteById(id)){ return RespBean.ok(" Delete successful "); } return RespBean.error(" Delete failed "); } @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(" Get users 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(" Get users ",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)) {
// After changing the password, you need to log in again
String token = request.getHeader("token");
Boolean b = stringRedisTemplate.delete(token);
return RespBean.ok(" The update is successful ! Please login again !");
}
return RespBean.error(" Update failed !");
}
@PutMapping("/hr/info")
public RespBean updateHr(@RequestBody Hr hr) {
if (hrService.updateHr(hr) == 1) {
return RespBean.ok(" The update is successful !");
}
return RespBean.error(" Update failed !");
}
@PostMapping("/hr/userface")
public RespBean updateHrUserface(MultipartFile file, Integer id) {
System.out.println("face "+id);
if(hrService.updateHrUserface(file,id)){
return RespBean.ok(" The update is successful !");
}
return RespBean.error(" The picture is too large or the format is wrong ");
}
}
5、 ... and , Project summary
Project adoption springboot+vue Realize the project development of front and rear end separation , The function is simple and generous , In addition, I used redis Cache database and oss Distributed file storage services , It is a highlight of the project .
copyright notice
author[qq_ four hundred and sixty-nine million six hundred and three t],Please bring the original link to reprint, thank you.
https://en.qdmana.com/2022/116/202204261120091781.html
The sidebar is recommended
- Rich text editor: ckeditor (using ckeditor4 Vue)
- The get request of nginx agent only returns part of the data. The problem is solved
- JavaScript traverses the irregularly nested multi-layer objects, returns the map with "index", and realizes the rapid positioning of sub attributes
- HTTP keep alive details
- [technical update] http / 3 quic Foundation
- Vue to react ----- can the constructor be omitted when using ES6?
- Use of nested HTML
- Vue to react to realize slot function
- When to use react PureComponent
- React 16.6 memo()
guess what you like
Deep understanding of children https://segmentfault.com/a/1190000011527160
This paper solves the cross domain problem Vue + springboot caused by the separation of front and back ends
The difference between shallow copy and deep copy is to use native JavaScript to realize deep copy
Definition of Vue slot
Sorting algorithm in JavaScript
JavaScript implements search algorithm, sequential search and binary search
leetcode20. Valid parentheses, implemented using JavaScript
'interface' declarations can only be used in typescript files in Vue 3.0 + ts resolvent
496 next element larger JavaScript implementation leetcode
leetcode 682. Implementation of JavaScript in baseball game
Random recommended
- Source code analysis, Vue What happens when using (), take initializing vuex as an example
- JavaScript optional chain
- Source code analysis, Vue global API set, del, nexttick, use, mixin, etc
- Brief introduction of Vue source code directory design
- Docxtemplator + Vue + docxtemplator image module free realize the front-end Word Download Text and free image download
- vue 2. What happens when x source code analyzes new vue()
- Vue bidirectional binding principle
- Use and principle of Vue keepalive
- Properties and usage of vuex
- Communication mode between Vue components
- Front end interview Foundation
- Usage scenario and principle of Vue nexttick
- Configuration and use of rich text editor ckeditor4 in Vue
- How does Java randomly get elements from a list
- Study summary of pytext: a search path from NLP research to production
- html+css+JavaScript
- Tunnel http://bt3xna.natappfree.cc Invalid cannot connect to 172.0.0.1:8080 The web service powered by natapp. Is not available on this port cn
- Next JS using react quill
- Vue Gaode map can only have one start point and end point. How to realize it
- Divide and conquer strategy -- find the k-th smallest element in the array
- Singleton mode - front end design mode
- QT sets that child elements do not inherit the parent style
- Using react to realize comment function
- Front end Vue template
- Front end vuejs set sail
- Front end Vue data binding and MVVM
- Vue data proxy and hijacking in front end
- Vue style of front end
- Front end Vue event handling
- Principle of Vue monitoring data change in front end
- Vue calculation attribute and monitoring attribute of the front end
- Front end Vue conditional rendering and list rendering
- The front-end Vue collects form data
- Vue built-in instruction of front end
- Unknown HttpClient factory netty at org. openqa. selenium. remote...
- What is the gutter principle of Ant Design Vue a-row
- Element form account password
- CSS to add horizontal lines around the text
- Solution to vscode Vue project always reporting space or semicolon warning
- Calling setcookie in Ajax fails without any error in the IDE