选课管理系统

文章目录

选课管理系统

一、项目演示

选课管理系统

二、项目介绍

基于springboot+vue的前后端分离选课管理系统

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

1、管理员:首页、院系管理、专业管理、班级管理、课程管理、选课管理、学生管理、教师管理、管理员管理

2、教师:首页、授课查询、教师课衷、成绩录入

3、学生:首页、选课、已选课程管理、课表查询、成绩查询、信息维护

语言:java

前端技术:Vue、ElementUI

后端技术:SpringBoot、Mybatis-Plus

数据库:MySQL

三、系统部分功能截图








四、部分代码展示

java 复制代码
package com.rabbiter.cm.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.rabbiter.cm.dao.mapper.CourseMapper;
import com.rabbiter.cm.model.bo.CourseItemBO;
import com.rabbiter.cm.model.bo.StudentCourseSelectItemBO;
import com.rabbiter.cm.model.entity.CourseEntity;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class CourseDAO extends BaseDAO {
    public static final int PAGE_SIZE = 20;

    private final CourseMapper mapper;

    public CourseDAO(CourseMapper mapper) {
        this.mapper = mapper;
    }

    public int insert(CourseEntity entity) {
        return mapper.insert(entity);
    }

    public int delete(Integer id) {
        return mapper.deleteById(id);
    }

    public CourseEntity get(Integer id) {
        return mapper.selectById(id);
    }

    public int update(CourseEntity entity) {
        return mapper.updateById(entity);
    }

    public int count(String departmentName, String teacherName, String name) {
        return mapper.count(departmentName, teacherName, name);
    }

    public List<CourseItemBO> getPage(Integer index, String departmentName, String teacherName, String name) {
        Page<CourseItemBO> page = new Page<>(index, PAGE_SIZE);

        return mapper.getPage(page, departmentName, teacherName, name).getRecords();
    }

    public Integer countByTeacherId(Integer teacherId) {
        LambdaQueryWrapper<CourseEntity> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(CourseEntity::getTeacherId, teacherId);

        return mapper.selectCount(wrapper);
    }

    public List<CourseEntity> listName() {
        LambdaQueryWrapper<CourseEntity> wrapper = new LambdaQueryWrapper<>();
        wrapper.select(CourseEntity::getId, CourseEntity::getName);

        return mapper.selectList(wrapper);
    }

    public int increaseSelectedCount(Integer courseId) {
        CourseEntity course = mapper.selectById(courseId);
        course.setSelectedCount(course.getSelectedCount() + 1);

        return mapper.updateById(course);
    }

    public int decreaseSelectedCount(Integer courseId) {
        CourseEntity course = mapper.selectById(courseId);
        course.setSelectedCount(course.getSelectedCount() - 1);

        return mapper.updateById(course);
    }

    public Integer countStudentCanSelect(Integer studentId, Integer departmentId, Integer grade, String courseName, String teacherName) {
        return mapper.countStudentCanSelect(studentId, departmentId, grade, courseName, teacherName);
    }

    public List<StudentCourseSelectItemBO> getStudentCanSelectPage(Integer index, Integer departmentId, Integer studentId, Integer grade, String courseName, String teacherName) {
        Page<StudentCourseSelectItemBO> page = new Page<>(index, PAGE_SIZE);

        return mapper.getStudentCanSelectPage(page, departmentId, studentId, grade, courseName, teacherName).getRecords();
    }

    public Integer getDepartmentIdById(Integer courseId) {
        return mapper.getDepartmentIdById(courseId);
    }
}
java 复制代码
package com.rabbiter.cm.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.rabbiter.cm.dao.mapper.StudentCourseMapper;
import com.rabbiter.cm.model.entity.StudentCourseEntity;
import com.rabbiter.cm.model.vo.response.table.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class StudentCourseDAO extends BaseDAO {
    public static final int PAGE_SIZE = 20;
    private final StudentCourseMapper mapper;

    public StudentCourseDAO(StudentCourseMapper mapper) {
        this.mapper = mapper;
    }


    public int insert(StudentCourseEntity entity) {
        return mapper.insert(entity);
    }

    public int delete(Integer id) {
        return mapper.deleteById(id);
    }

    public StudentCourseEntity get(Integer id) {
        return mapper.selectById(id);
    }

    public int update(StudentCourseEntity entity) {
        return mapper.updateById(entity);
    }

    public int count(String className, String courseName, String studentName) {
        return mapper.count(className, courseName, studentName);
    }

    public List<StudentCourseItemVO> getPage(Integer index, String className, String courseName, String studentName) {
        Page<StudentCourseItemVO> page = new Page<>(index, PAGE_SIZE);

        return mapper.getPage(page, className, courseName, studentName).getRecords();
    }

    public int countByCourseId(Integer courseId) {
        LambdaQueryWrapper<StudentCourseEntity> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(StudentCourseEntity::getCourseId, courseId);

        return mapper.selectCount(wrapper);
    }

    public int countByStudentId(Integer studentId) {
        LambdaQueryWrapper<StudentCourseEntity> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(StudentCourseEntity::getStudentId, studentId);

        return mapper.selectCount(wrapper);
    }

    public StudentCourseEntity getByCourseIdAndStudentId(Integer courseId, Integer studentId) {
        LambdaQueryWrapper<StudentCourseEntity> wrapper = new LambdaQueryWrapper<>();
        wrapper.select(StudentCourseEntity::getId)
                .eq(StudentCourseEntity::getCourseId, courseId)
                .eq(StudentCourseEntity::getStudentId, studentId);

        return mapper.selectOne(wrapper);
    }

    public List<StudentCourseSelectedItemVO> listStudentCourseSelected(Integer studentId) {
        return mapper.listStudentCourseSelected(studentId);
    }

    public List<StudentExamItemVO> listStudentExam(Integer studentId) {
        return mapper.listStudentExam(studentId);
    }

    public Integer countStudentCourseSelectedByTimePart(Integer studentId, String timePart) {
        return mapper.countStudentCourseSelectedByTimePart(studentId, timePart);
    }

    public List<TimetableItemVO> listStudentTimetable(Integer studentId) {
        return mapper.listStudentTimetable(studentId);
    }

    public Integer countTeacherGrade(Integer teacherId, String courseName, String studentName) {
        return mapper.countTeacherGrade(teacherId, courseName, studentName);
    }

    public List<TeacherGradeItemVO> getTeacherGradePage(Integer index, Integer teacherId, String courseName, String studentName) {
        Page<TeacherGradeItemVO> page = new Page<>(index, PAGE_SIZE);
        return mapper.getTeacherGradePage(page, teacherId, courseName, studentName).getRecords();
    }
}
java 复制代码
package com.rabbiter.cm.service.admin;

import com.rabbiter.cm.manager.admin.StudentCourseManager;
import com.rabbiter.cm.service.BaseService;
import com.rabbiter.cm.model.entity.CourseEntity;
import com.rabbiter.cm.model.entity.StudentCourseEntity;
import com.rabbiter.cm.model.vo.response.ResultVO;
import org.springframework.stereotype.Service;

@Service
public class StudentCourseService extends BaseService {
    private final StudentCourseManager manager;

    public StudentCourseService(StudentCourseManager manager) {
        this.manager = manager;
    }

    public ResultVO getPageCount(String className, String courseName, String studentName) {
        return result(manager.getPageCount(className, courseName, studentName));
    }

    public ResultVO getPage(Integer index, String className, String courseName, String studentName) {
        return result(manager.getPage(index, className, courseName, studentName));
    }

    public ResultVO get(Integer id) {
        StudentCourseEntity entity = manager.get(id);
        if (entity == null) {
            return failedResult("学生选课Id: " + id + "不存在!");
        }

        return result(entity);
    }

    public ResultVO update(StudentCourseEntity entity) {
        StudentCourseEntity originEntity = manager.get(entity.getId());
        if (originEntity == null) {
            return failedResult("学生选课Id: " + entity.getId() + "不存在!");
        }
        if (!originEntity.getCourseId().equals(entity.getCourseId())) {
            return failedResult("课程Id被篡改");
        }
        if (!originEntity.getStudentId().equals(entity.getStudentId())) {
            return failedResult("学生Id被篡改");
        }

        manager.update(entity);
        return result("更新成功");
    }

    public ResultVO delete(Integer id) {
        StudentCourseEntity entity = manager.get(id);
        if (entity == null) {
            return failedResult("学生选课Id: " + id + "不存在!");
        }

        manager.delete(entity);
        return result("删除成功");
    }

    public ResultVO create(StudentCourseEntity entity) {
        if (manager.get(entity.getId()) != null) {
            return failedResult("学生选课Id: " + entity.getId() + "已存在!");
        }
        if (manager.getStudentById(entity.getStudentId()) == null) {
            return failedResult("所属学生Id: " + entity.getStudentId() + "不存在!");
        }
        if (manager.getByCourseIdAndStudentId(entity.getCourseId(), entity.getStudentId()) != null) {
            return failedResult("学生已经选修此课程");
        }
        CourseEntity course = manager.getCourseById(entity.getCourseId());
        if (course == null) {
            return failedResult("所属课程Id: " + entity.getCourseId() + "不存在!");
        }
        if (course.getSelectedCount() >= course.getMaxSize()) {
            return failedResult("课容量已满");
        }
        if (!manager.inSameDepartment(entity.getCourseId(), entity.getStudentId())) {
            return failedResult("课程与学生不在同一教学系");
        }
        if (!course.getGrade().equals(manager.getStudentGradeById(entity.getStudentId()))) {
            return failedResult("课程与学生不在同一年级");
        }

        manager.create(entity);
        return result("添加成功");
    }
}

五、底部获取项目(9.9¥)

有问题,或者需要协助调试运行项目的也可以

相关推荐
代码小鑫1 小时前
A043-基于Spring Boot的秒杀系统设计与实现
java·开发语言·数据库·spring boot·后端·spring·毕业设计
计算机毕设源码qq-38365310413 小时前
(附项目源码)Java开发语言,215 springboot 大学生爱心互助代购网站,计算机毕设程序开发+文案(LW+PPT)
java·开发语言·spring boot·mysql·课程设计
计算机毕设孵化场9 小时前
计算机毕设-基于springboot的多彩吉安红色旅游网站的设计与实现(附源码+lw+ppt+开题报告)
vue.js·spring boot·后端·计算机外设·课程设计·计算机毕设论文·多彩吉安红色旅游网站
说书客啊1 天前
计算机毕业设计 | SpringBoot+vue汽车资讯网站 汽车购买咨询管理系统(附源码+论文)
java·spring boot·node.js·vue·汽车·毕业设计·课程设计
工业互联网专业2 天前
Python毕业设计选题:基于python的豆瓣电影数据分析可视化系统-flask+spider
vue.js·python·数据分析·flask·毕业设计·源码·课程设计
学长论文辅导2 天前
(计算机毕设)基于SpringBoot+Vue的房屋租赁系统的设计与实现
java·spring boot·毕业设计·论文·管理系统
代码小鑫3 天前
A037-基于Spring Boot的二手物品交易的设计与实现
java·开发语言·数据库·spring boot·后端·spring·毕业设计
沐欣工作室_lvyiyi3 天前
基于单片机的智能奶茶机设计(论文+源码)
stm32·单片机·嵌入式硬件·物联网·毕业设计·智能家居
工业互联网专业4 天前
Python毕业设计选题:基于Spark的国漫推荐系统的设计与实现-django+spider
vue.js·python·spark·django·毕业设计·源码·课程设计
B站计算机毕业设计超人4 天前
计算机毕业设计Python美食推荐系统 美团爬虫 美食可视化 机器学习 深度学习 混合神经网络推荐算法 Hadoop Spark 人工智能 大数据毕业设计
大数据·人工智能·爬虫·python·深度学习·机器学习·课程设计