Java项目:114SpringBoot Vue的学生考勤管理系统

 作者主页:夜未央5788

 简介:Java领域优质创作者、Java项目、学习资料、技术互助

文末获取源码

项目介绍

基于SpringBoot Vue的学生考勤管理系统

角色:管理员、教师、学生

管理员:管理员登录进入系统可以查看首页,个人中心,学生管理,教师管理,班级信息管理,课程信息管理,签到信息管理,考勤信息管理,请假信息管理,考勤统计管理等功能

教师:教师登录进入系统可以查看首页,个人中心,学生管理,班级信息管理,课程信息管理,签到信息管理,考勤信息管理,请假信息管理,考勤统计管理等功能

学生: 学生登录进入系统可以查看首页,个人中心,班级信息管理,课程信息管理,签到信息管理,考勤信息管理,请假信息管理,考勤统计管理等功能

使用人群:
正在做毕设的学生,或者需要项目实战练习的Java学习者

由于本程序规模不大,可供课程设计,毕业设计学习演示之用

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 
4.数据库:MySql 5.7/8.0版本均可;

5.是否Maven项目:是;

技术栈

后端: SpringBoot+Mybaits
 

前端:Vue +ElementUI

使用说明

项目运行:
1. 使用Navicat或者其它工具,在mysql中创建对应sql文件名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
4. 运行项目,控制台提示运行成功后再去运行前端项目;
5. 管理员用户名密码:admin/admin

普通用户名密码:user/123456

运行截图

论文

功能截图

相关代码

CourseController

package com.neko.train.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.neko.train.entity.Course;
import com.neko.train.enums.CommonResult;
import com.neko.train.service.CourseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Locale;

/**
 * <p>
 * 课程表 前端控制器
 * </p>
 *
 * @author Eikan
 * @since 2021-02-02
 */
@Controller
@RequestMapping("/course")
@Log4j2
@Api(tags = "课程信息相关接口", description = "提供课程操作相关的API")
public class CourseController {
    @Resource
    CourseService courseService;

    // 获取今天星期几
    
    SimpleDateFormat sdf = new SimpleDateFormat("E", Locale.SIMPLIFIED_CHINESE);
    String week = sdf.format(new Date());

    /**
     * 课程信息列表
     * 分页查询
     * @param current 当前页面
     * @param size 每页多少行内容
     * @return
     */
    @ApiOperation("获取全部课程列表")
    @GetMapping("/list")
    @ResponseBody
    public CommonResult<IPage<Course>> getList(@RequestParam(value = "current",defaultValue = "1") Integer current,
                                               @RequestParam(value = "size",defaultValue = "10") Integer size){
        IPage<Course> signInPage= new Page<>(current,size);
        courseService.page(signInPage);
        return CommonResult.success(signInPage);
    }

    /**
     * 创建课程信息
     * @param course
     * @return
     */
    @ApiOperation("创建课程信息")
    @PostMapping("/create")
    @ResponseBody
    public  CommonResult<Course> create(@RequestBody Course course){
        course.setCreateTime(new Timestamp(System.currentTimeMillis()));
        boolean success = courseService.save(course);
        if (success){
            return CommonResult.success(course);
        }else {
            return CommonResult.failed();
        }
    }

    /**
     * 根据id获取课程编辑信息
     * @param id
     * @return
     */
    @ApiOperation("根据id获取课程信息")
    @GetMapping( "/updateInfo/{id}")
    @ResponseBody
    public  CommonResult<Course> getUpdateInfo(@PathVariable Integer id){
        Course course = courseService.getById(id);
        return CommonResult.success(course);
    }


    /**
     * 更新课程信息
     * @param bindingResult
     * @return
     */
    @ApiOperation("根据id更新课程信息")
    @PostMapping( "/update")
    @ResponseBody
    public CommonResult<Course> getUpdate(@RequestBody Course course,
                                           BindingResult bindingResult){
        if(bindingResult.hasErrors()){
            return CommonResult.failed();
        }
        course.setUpdateTime(new Timestamp(System.currentTimeMillis()));
        boolean success =  courseService.saveOrUpdate(course);
        if (success){
            return CommonResult.success(course);
        }else {
            return CommonResult.failed();
        }
    }

    /**
     * 删除课程信息
     * @param id
     * @return
     */
    @ApiOperation("根据id获取删除课程信息")
    @GetMapping("/remove/{id}")
    @ResponseBody
    public CommonResult delete(@PathVariable Integer id){
        boolean success = courseService.removeById(id);
        if(success) {
            return CommonResult.success(id);
        }else {
            return CommonResult.failed();
        }
    }

    // 单个或批量删除课程
    
    @ApiOperation("根据id批量删除课程信息")
    @ResponseBody
    @PostMapping("/update/deleteStatus")
    public  CommonResult updateDeleteStatus(@RequestParam("ids") List<Integer> ids) {

        boolean success = courseService.removeByIds(ids);
        if(success) {
            return CommonResult.success(ids);
        }else {
            return CommonResult.failed();
        }
    }


    /**
     * 获取今天的课程信息
     * @param
     * @return
     */
    @ApiOperation("获取今天的课程信息")
    @PostMapping("/course")
    @ResponseBody
    public  CommonResult course(){
        QueryWrapper<Course> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("on_day",week);
        List<Course> courseList = courseService.list(queryWrapper);
        return CommonResult.success(courseList);

    }

    /**
     * 根据学号获取学生今天的课程信息
     * @param studentNumber
     * @return
     */
    @ApiOperation("根据学号获取学生今天的课程信息")
    @PostMapping("/course/{studentNumber}")
    @ResponseBody
    public  CommonResult courseStudent(@PathVariable Integer studentNumber){
        QueryWrapper<Course> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("on_day",week).eq("student_number",studentNumber);
        List<Course> courseList = courseService.list(queryWrapper);
        return CommonResult.success(courseList);

    }

    /**
     * 根据学号获取学生今天的课程信息
     * @param teacherNumber
     * @return
     */
    @ApiOperation("根据学号获取教师今天的课程信息")
    @PostMapping("/course/{teacherNumber}")
    @ResponseBody
    public  CommonResult courseTeacher(@PathVariable Integer teacherNumber){
        QueryWrapper<Course> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("on_day",week).eq("teacher_number",teacherNumber);
        List<Course> courseList = courseService.list(queryWrapper);
        return CommonResult.success(courseList);

    }
}

StudentController

package com.neko.train.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.neko.train.entity.Course;
import com.neko.train.entity.Student;
import com.neko.train.enums.CommonResult;
import com.neko.train.service.StudentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.sql.Timestamp;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * <p>
 * 学生信息表 前端控制器
 * </p>
 *
 * @author Eikan
 * @since 2021-02-02
 */
@Controller
@RequestMapping("/student")
@Log4j2
@CrossOrigin
@Api(tags = "学生相关接口", description = "提供学生操作相关的API")
public class StudentController {
    @Resource
    StudentService studentService;

    /**
     * 学生信息列表
     * 分页查询
     * @return
     */
    @ApiOperation("获取全部学生列表")
    @GetMapping("/list")
    @ResponseBody
    public CommonResult<List<Student>> getList(){
        List<Student> studentList=studentService.list();
        return CommonResult.success(studentList);
    }

    /**
     * 学生信息列表
     * 分页查询
     * @param current 当前页面
     * @param size 每页多少行内容
     * @return
     */
    @ApiOperation("分页获取全部学生列表")
    @GetMapping("/listPage")
    @ResponseBody
    public CommonResult<IPage<Student>> getListPage(@RequestParam(value = "current",defaultValue = "1") Integer current,
                                                @RequestParam(value = "size",defaultValue = "100") Integer size){
        IPage<Student> studentPage= new Page<>(current,size);
        studentService.page(studentPage);
        return CommonResult.success(studentPage);
    }

    /**
     * 创建课程信息
     * @param student
     * @return
     */
    @ApiOperation("创建学生信息")
    @PostMapping("/create")
    @ResponseBody
    public  CommonResult<Student> create(@RequestBody Student student){
        student.setCreateTime(new Timestamp(System.currentTimeMillis()));
        boolean success = studentService.save(student);
        if (success){
            return CommonResult.success(student);
        }else {
            return CommonResult.failed();
        }
    }

    /**
     * 根据id获取学生信息
     * @param id
     * @return
     */
    @ApiOperation("获取学生个人信息")
    @GetMapping( "/updateInfo/{id}")
    @ResponseBody
    public  CommonResult<Student> getUpdateInfo(@PathVariable Integer id,@RequestHeader(value = "Authorization",defaultValue = "admin") String token){
        log.info(token);
        Student student = studentService.getById(id);
        return CommonResult.success(student);
    }

    /**
     * 根据学生学号获取学生信息
     * @param number
     * @return
     */
    @ApiOperation("根据学生学号获取个人信息")
    @GetMapping( "/info/{number}")
    @ResponseBody
    public  CommonResult<Student> getInfo(@PathVariable Integer number){
        QueryWrapper<Student> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("number",number);
        Student student = studentService.getOne(queryWrapper);
        return CommonResult.success(student);
    }


    /**
     * 更新学生信息
     * @param student
     * @param bindingResult
     * @return
     */
    @ApiOperation("根据id更新学生个人信息")
    @PostMapping( "/update")
    @ResponseBody
    public  CommonResult<Student> getUpdate(@RequestBody Student student,
                                            BindingResult bindingResult){
        if(bindingResult.hasErrors()){
            return CommonResult.failed();
        }
//        QueryWrapper<Student> studentQueryWrapper = new QueryWrapper<>();
//        Student id = studentService.getById(student.getId());
//        studentQueryWrapper.eq("id",id);
        student.setUpdateTime(new Timestamp(System.currentTimeMillis()));
        studentService.saveOrUpdate(student);
        return CommonResult.success(student);
    }

    /**
     * 删除学生信息
     * @param id
     * @return
     */
    @ApiOperation("根据id删除学生个人信息")
    @GetMapping("/remove/{id}")
    @ResponseBody
    public CommonResult remove(@PathVariable Integer id){
        boolean success = studentService.removeById(id);
        if(success) {
            return CommonResult.success(id);
        }else {
            return CommonResult.failed();
        }
    }

    // 单个或批量删除学生
    //未测试

    @ApiOperation("根据id批量删除学生个人信息")
    @ResponseBody
    @PostMapping("/removeBatch")
    public  CommonResult removeBatch(@RequestParam("ids") List<Integer> ids) {

        boolean success = studentService.removeByIds(ids);
        if(success) {
            return CommonResult.success(ids);
        }else {
            return CommonResult.failed();
        }
    }


}

如果也想学习本系统,下面领取。关注并回复:114springboot

  • 20
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

夜未央5788

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值