选课管理系统

文章目录

选课管理系统

一、项目演示

选课管理系统

二、项目介绍

基于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¥)

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

相关推荐
西瓜籽@35 分钟前
STM32——毕设基于单片机的多功能节能窗控制系统
stm32·单片机·课程设计
计算机学长felix1 小时前
基于SpringBoot的“校园交友网站”的设计与实现(源码+数据库+文档+PPT)
数据库·spring boot·毕业设计·交友
极客小张4 小时前
基于STM32的智能充电桩:集成RTOS、MQTT与SQLite的先进管理系统设计思路
stm32·单片机·嵌入式硬件·mqtt·sqlite·毕业设计·智能充电桩
paopaokaka_luck14 小时前
【360】基于springboot的志愿服务管理系统
java·spring boot·后端·spring·毕业设计
小飞鹰工程师15 小时前
基于Multisim拔河比赛游戏+计分电路(含仿真和报告)
课程设计·数字电路·multisim·模拟电路·数字电子技术
paopaokaka_luck21 小时前
基于Spring Boot+Vue的助农销售平台(协同过滤算法、限流算法、支付宝沙盒支付、实时聊天、图形化分析)
java·spring boot·小程序·毕业设计·mybatis·1024程序员节
工业互联网专业21 小时前
Python毕业设计选题:基于Hadoop的租房数据分析系统的设计与实现
vue.js·hadoop·python·flask·毕业设计·源码·课程设计
毕业设计制作和分享1 天前
ssm好例文共享平台的设计与实现+jsp
java·开发语言·vue.js·spring boot·毕业设计·mybatis
清风絮柳2 天前
25.停车场管理系统(基于web的Java项目)
毕业设计·j2ee·java项目·jsp·停车场管理系统