Java项目:160SpringBoot Vue的学生成绩管理系统

 作者主页:夜未央5788

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

文末获取源码

项目介绍

本项目为前后端分离项目;

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

角色权限管理RBAC、学院管理、专业管理、班级管理、教师管理、学生管理、学期管理、考试管理、课程管理、留言管理、教学安排、成绩管理、成绩图表分析、统计分析、成绩打印等

使用人群:
正在做毕设的学生,或者需要项目实战练习的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项目:是;

6.node版本:14

技术栈

后端: SpringBoot+mybatisplus+redis

前端:Vue + Ant Design Vue

使用说明

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

前端frontend运行:
1.在命令行中cd到frontend目录;
2.执行npm run dev命令:
3.执行成功后,在浏览器中输入 http://localhost:8081/
管理员账号:admin/1234qwer
教师账号: bailu/1234qwer
学生账号:LinShao/1234qwer

运行截图

相关代码

ClazzController

package cc.mrbird.febs.school.controller;


import cc.mrbird.febs.common.annotation.Log;
import cc.mrbird.febs.common.controller.BaseController;
import cc.mrbird.febs.common.domain.QueryRequest;
import cc.mrbird.febs.common.domain.SchoolTree;
import cc.mrbird.febs.common.exception.FebsException;
import cc.mrbird.febs.school.entity.Clazz;
import cc.mrbird.febs.school.entity.Student;
import cc.mrbird.febs.school.entity.Teacher;
import cc.mrbird.febs.school.service.IClazzService;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.wuwenze.poi.ExcelKit;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.authz.annotation.RequiresUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import java.util.List;
import java.util.Map;

/**
 * @author IU
 */
@Slf4j
@Validated
@RestController
@RequestMapping("organization/clazz")
public class ClazzController extends BaseController {

    private String message;

    @Autowired
    private IClazzService iClazzService;


    /**
     * 班级列表
     *
     * @param request
     * @param clazz
     * @return
     */
    @GetMapping
    @RequiresPermissions("organization:clazz:view")
    public Map<String, Object> clazzList(QueryRequest request, Clazz clazz) {
        if (isTeacher()) {
            Teacher teacher = getTeacher();
            clazz.setManagerId(teacher.getTeacherId());
        }
        if (isStudent()) {
            Student student = getStudent();
            clazz.setClazzId(student.getClazzId());
        }
        return getDataTable(this.iClazzService.findClazzPage(request, clazz));
    }


    /**
     * 新增班级
     *
     * @param clazz
     * @throws FebsException
     */
    @Log("新增班级")
    @PostMapping
    @RequiresPermissions("organization:clazz:add")
    public void addClazz(@RequestBody @Valid Clazz clazz) throws FebsException {
        try {
            this.iClazzService.insert(clazz);
        } catch (Exception e) {
            message = "新增班级失败";
            log.error(message, e);
            throw new FebsException(message);
        }
    }


    /**
     * 修改班级
     *
     * @param clazz
     * @throws FebsException
     */
    @Log("修改班级")
    @PutMapping
    @RequiresPermissions("organization:clazz:update")
    public void updateClazz(@RequestBody @Valid Clazz clazz) throws FebsException {
        try {
            this.iClazzService.modify(clazz);
        } catch (Exception e) {
            message = "修改班级失败";
            log.error(message, e);
            throw new FebsException(message);
        }
    }

    /**
     * 删除班级
     *
     * @param clazzIds
     * @throws FebsException
     */
    @Log("删除班级")
    @DeleteMapping("/{clazzIds}")
    @RequiresPermissions("organization:clazz:delete")
    public void deleteClazz(@NotBlank(message = "{required}") @PathVariable String clazzIds) throws FebsException {
        try {
            String[] ids = clazzIds.split(StringPool.COMMA);
            this.iClazzService.deleteClazzList(ids);
        } catch (Exception e) {
            message = "删除班级失败";
            log.error(message, e);
            throw new FebsException(message);
        }
    }


    /**
     * 导出
     *
     * @param request
     * @param clazz
     * @param response
     * @throws FebsException
     */
    @PostMapping("excel")
    @RequiresPermissions("organization:clazz:export")
    public void export(QueryRequest request, Clazz clazz, HttpServletResponse response) throws FebsException {
        try {
            List<Clazz> clazzList = this.iClazzService.findClazzPage(request, clazz).getRecords();
            ExcelKit.$Export(Clazz.class, response).downXlsx(clazzList, false);
        } catch (Exception e) {
            message = "导出Excel失败";
            log.error(message, e);
            throw new FebsException(message);
        }
    }

    /**
     * 构造年级和学院树
     *
     * @return
     */
    @GetMapping("/tree")
    @RequiresUser
    public List<SchoolTree> organizationTreeList() {
        return iClazzService.buildOrganizationTreeList(true);
    }

    /**
     * 根据班级分析课程教学情况
     *
     * @param clazzId
     */

    @GetMapping("/analysis/{clazzId}")
    @RequiresPermissions("organization:clazz:analysis")
    public Map<String, Object> analysis(@PathVariable Long clazzId) {
        return iClazzService.findClazzAnalysisDetail(clazzId);
    }
}

CollegeController

package cc.mrbird.febs.school.controller;


import cc.mrbird.febs.common.annotation.Log;
import cc.mrbird.febs.common.controller.BaseController;
import cc.mrbird.febs.common.domain.QueryRequest;
import cc.mrbird.febs.common.exception.FebsException;
import cc.mrbird.febs.school.entity.Clazz;
import cc.mrbird.febs.school.entity.College;
import cc.mrbird.febs.school.entity.Grade;
import cc.mrbird.febs.school.entity.Student;
import cc.mrbird.febs.school.service.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.wuwenze.poi.ExcelKit;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.authz.annotation.RequiresUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import java.util.List;
import java.util.Map;

/**
 * @author IU
 */
@Slf4j
@Validated
@RestController
@RequestMapping("organization/college")
public class CollegeController extends BaseController {

    private String message;

    @Autowired
    private ICollegeService iCollegeService;

    @Autowired
    private IGradeService iGradeService;

    @Autowired
    private ITeacherService iTeacherService;

    @Autowired
    private IClazzService iClazzService;

    @Autowired
    private IStudentService iStudentService;


    /**
     * 返回全部的学院信息
     *
     * @return
     */
    @GetMapping("/all")
    @RequiresUser
    public List<College> allCollegeList() {
        return iCollegeService.list();
    }


    /**
     * 学院列表
     *
     * @param request
     * @param college
     * @return
     */
    @GetMapping
    @RequiresPermissions("organization:college:view")
    public Map<String, Object> collegeList(QueryRequest request, College college) {
        if (isStudent()) {
            Student student = getStudent();
            Clazz clazz = iClazzService.getById(student.getClazzId());
            Grade grade = iGradeService.getById(clazz.getGradeId());
            College currentCollege = iCollegeService.getById(grade.getCollegeId());
            college.setCollegeId(currentCollege.getCollegeId());
        }

        IPage<College> collegeIPage = this.iCollegeService.findColleges(request, college);
        List<College> collegeList = collegeIPage.getRecords();
        if (CollectionUtils.isNotEmpty(collegeList)) {
            collegeList.forEach(obj -> {
                //学院下年级(专业)数量
                Integer gradeCount = iGradeService.getGradeCountByCollegeId(obj.getCollegeId());
                if (gradeCount != null) {
                    obj.setGradeCount(gradeCount);
                }
                //学院下教师数量
                Integer teacherCount = iTeacherService.getTeacherCountByCollegeId(obj.getCollegeId());
                if (teacherCount != null) {
                    obj.setTeacherCount(teacherCount);
                }

                //学院下的学生数量
                List<Long> gradeIdList = iGradeService.getGradeIdListByCollegeId(obj.getCollegeId());
                if (CollectionUtils.isNotEmpty(gradeIdList)) {
                    List<Long> clazzIdList = iClazzService.getClazzIdListByGradeIdList(gradeIdList);
                    if (CollectionUtils.isNotEmpty(clazzIdList)) {
                        Integer studentCount = iStudentService.studentCountByClazzIdList(clazzIdList);
                        if (studentCount != null) {
                            obj.setStudentCount(studentCount);
                        }
                    }
                }
            });
        }
        return getDataTable(collegeIPage);
    }


    /**
     * 新增学院
     *
     * @param college
     * @throws FebsException
     */
    @Log("新增学院")
    @PostMapping
    @RequiresPermissions("organization:college:add")
    public void addCollege(@RequestBody @Valid College college) throws FebsException {
        try {
            this.iCollegeService.insert(college);
        } catch (Exception e) {
            message = "新增学院失败";
            log.error(message, e);
            throw new FebsException(message);
        }
    }


    /**
     * 修改学院
     *
     * @param college
     * @throws FebsException
     */
    @Log("修改学院")
    @PutMapping
    @RequiresPermissions("organization:college:update")
    public void updateCollege(@RequestBody @Valid College college) throws FebsException {
        try {
            this.iCollegeService.modify(college);
        } catch (Exception e) {
            message = "修改学院失败";
            log.error(message, e);
            throw new FebsException(message);
        }
    }

    /**
     * 删除学院
     *
     * @param collegeIds
     * @throws FebsException
     */
    @Log("删除学院")
    @DeleteMapping("/{collegeIds}")
    @RequiresPermissions("organization:college:delete")
    public void deleteCollege(@NotBlank(message = "{required}") @PathVariable String collegeIds) throws FebsException {
        try {
            String[] ids = collegeIds.split(StringPool.COMMA);
            this.iCollegeService.deleteColleges(ids);
        } catch (Exception e) {
            message = "删除学院失败";
            log.error(message, e);
            throw new FebsException(message);
        }
    }


    /**
     * 导出
     *
     * @param request
     * @param college
     * @param response
     * @throws FebsException
     */
    @PostMapping("excel")
    @RequiresPermissions("organization:college:export")
    public void export(QueryRequest request, College college, HttpServletResponse response) throws FebsException {
        try {
            List<College> colleges = this.iCollegeService.findColleges(request, college).getRecords();
            ExcelKit.$Export(College.class, response).downXlsx(colleges, false);
        } catch (Exception e) {
            message = "导出Excel失败";
            log.error(message, e);
            throw new FebsException(message);
        }
    }
}

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

  • 23
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

夜未央5788

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

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

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

打赏作者

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

抵扣说明:

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

余额充值