基于SpringBoot的人事管理系统设计与实现【源码+文档+部署讲解】

发布于:2025-02-11 ⋅ 阅读:(30) ⋅ 点赞:(0)

基于SpringBoot+Vue实现的人事管理系统采用前后端分流的架构方式,设计了管理员、员工两种角色,实现了员工管理、部门管理、员工请假管理、员工加班管理、员工工资管理、员工考勤管理、招聘信息管理、员工培训管理、员工详情管理等功能模块

技术选型

开发工具:idea2020.3+Webstorm2020.3(其他开发工具也可以)

运行环境:jdk1.8+maven3.6.0+MySQL5.7+nodejs14.21.3(此配置为小白调试所用,仅供参考)

服务端技术:Springboot+Mybatis-plus

前端技术:html+css+Layui+jQuery+bootstrap+Vue+axios+Element-UI

成果展示

文档展示

用户登录

image-20241009205453221

员工管理

 

员工详情

发放工资

 

部门管理

员工考勤管理

请假申请管理

加班申请管理

员工工资管理

招聘计划管理

员工培训管理

员工详情管理

部分源码展示

package com.controller;


import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.TokenEntity;
import com.entity.UserEntity;
import com.service.TokenService;
import com.service.UserService;
import com.utils.CommonUtil;
import com.utils.MPUtil;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.ValidatorUtils;

/**
 * 登录相关
 */
@RequestMapping("users")
@RestController
public class UserController{
 
 @Autowired
 private UserService userService;
 
 @Autowired
 private TokenService tokenService;

 /**
  * 登录
  */
 @IgnoreAuth
 @PostMapping(value = "/login")
 public R login(String username, String password, String captcha, HttpServletRequest request) {
  UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
  if(user==null || !user.getPassword().equals(password)) {
   return R.error("账号或密码不正确");
  }
  String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());
  return R.ok().put("token", token);
 }
 
 /**
  * 注册
  */
 @IgnoreAuth
 @PostMapping(value = "/register")
 public R register(@RequestBody UserEntity user){
  // ValidatorUtils.validateEntity(user);
     if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
      return R.error("用户已存在");
     }
        userService.insert(user);
        return R.ok();
    }

 /**
  * 退出
  */
 @GetMapping(value = "logout")
 public R logout(HttpServletRequest request) {
  request.getSession().invalidate();
  return R.ok("退出成功");
 }
 
 /**
     * 密码重置
     */
    @IgnoreAuth
 @RequestMapping(value = "/resetPass")
    public R resetPass(String username, HttpServletRequest request){
     UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
     if(user==null) {
      return R.error("账号不存在");
     }
     user.setPassword("123456");
        userService.update(user,null);
        return R.ok("密码已重置为:123456");
    }
}

账号地址及其他说明

1、地址说明

登录页:http://localhost:8081

2、账号说明

管理员:admin/admin

用户:2024001/123456

3、目录结构展示

4、项目结构展示

5、以上系统源码,经过学长整理与调试,确保能正常运行!

6、制作不易,点赞、在看、分享再走吧,您的支持永远是我最大的动力!

7、如电脑本机环境未配置好,可在后台回复 环境配置 获取教程。

8、运行步骤

1、创建数据库、导入sql脚本
2、修改application.yml中的数据库配置文件,启动服务端
3、在源代码\admin目录下打开cmd,执行npm install或者yarn install下载依赖
4、下载完毕后启动前端npm run serve,访问端口


网站公告

今日签到

点亮在社区的每一天
去签到