文章目录
员工管理系统
一、项目演示
课程管理系统
二、项目介绍
基于springboot+vue的前后端分离选课成绩管理系统
该系统可做课程管理系统、成绩管理系统、选课管理系统
系统角色:学生、教师、管理员
1、管理员模块:系管理 专业管理 班级管理 学生管理 教师管理 课程管理 选课修改 管理员管理
2、教师模块:教师首页 授课查询 教师课表 成绩录入
3、学生模块:学生首页 选修课程 学生课程 课表查询 成绩查询 信息维护
三、系统部分功能截图
四、部分代码展示
java
package com.rainng.coursesystem.service.admin;
import com.rainng.coursesystem.manager.admin.CourseManager;
import com.rainng.coursesystem.model.bo.CourseItemBO;
import com.rainng.coursesystem.model.entity.CourseEntity;
import com.rainng.coursesystem.model.vo.response.ResultVO;
import com.rainng.coursesystem.model.vo.response.table.CourseItemVO;
import com.rainng.coursesystem.service.BaseService;
import com.rainng.coursesystem.util.LessonTimeConverter;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service
public class CourseService extends BaseService {
private final CourseManager manager;
private final LessonTimeConverter lessonTimeConverter;
public CourseService(CourseManager manager, LessonTimeConverter lessonTimeConverter) {
this.manager = manager;
this.lessonTimeConverter = lessonTimeConverter;
}
public ResultVO getPageCount(String departmentName, String teacherName, String name) {
return result(manager.getPageCount(departmentName, teacherName, name));
}
public ResultVO getPage(Integer index, String departmentName, String teacherName, String name) {
List<CourseItemBO> boList = manager.getPage(index, departmentName, teacherName, name);
List<CourseItemVO> voList = new ArrayList<>(boList.size());
for (CourseItemBO bo : boList) {
CourseItemVO vo = new CourseItemVO();
BeanUtils.copyProperties(bo, vo);
vo.setTime(lessonTimeConverter.covertTimePart(bo.getTime()));
voList.add(vo);
}
return result(voList);
}
public ResultVO get(Integer id) {
CourseEntity entity = manager.get(id);
if (entity == null) {
return failedResult("课程Id: " + id + "不存在!");
}
return result(entity);
}
public ResultVO update(CourseEntity entity) {
CourseEntity origin = manager.get(entity.getId());
if (origin == null) {
return failedResult("课程Id: " + entity.getId() + "不存在!");
}
if (manager.getTeacherById(entity.getTeacherId()) == null) {
return failedResult("授课教师Id: " + entity.getTeacherId() + "不存在!");
}
entity.setSelectedCount(origin.getSelectedCount());
manager.update(entity);
return result("更新成功");
}
public ResultVO delete(Integer id) {
if (manager.get(id) == null) {
return failedResult("课程Id: " + id + "不存在!");
}
if (manager.hasStudentCourse(id)) {
return failedResult("还有学生未退选此课程");
}
manager.delete(id);
return result("删除成功");
}
public ResultVO create(CourseEntity entity) {
if (manager.get(entity.getId()) != null) {
return failedResult("课程Id: " + entity.getId() + "已存在!");
}
if (manager.getTeacherById(entity.getTeacherId()) == null) {
return failedResult("授课教师Id: " + entity.getTeacherId() + "不存在!");
}
manager.create(entity);
return result("添加成功");
}
public ResultVO listName() {
return result(manager.listName());
}
}
java
package com.rainng.coursesystem.service.admin;
import com.rainng.coursesystem.manager.admin.StudentCourseManager;
import com.rainng.coursesystem.model.entity.CourseEntity;
import com.rainng.coursesystem.model.entity.StudentCourseEntity;
import com.rainng.coursesystem.model.vo.response.ResultVO;
import com.rainng.coursesystem.service.BaseService;
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("添加成功");
}
}
java
package com.rainng.coursesystem.service.admin;
import com.rainng.coursesystem.manager.admin.TeacherManager;
import com.rainng.coursesystem.model.entity.TeacherEntity;
import com.rainng.coursesystem.model.vo.response.ResultVO;
import com.rainng.coursesystem.service.BaseService;
import com.rainng.coursesystem.service.UserService;
import org.springframework.stereotype.Service;
@Service
public class TeacherService extends BaseService {
private final TeacherManager manager;
private final UserService userService;
public TeacherService(TeacherManager manager, UserService userService) {
this.manager = manager;
this.userService = userService;
}
public ResultVO getPageCount(String departmentName, String name) {
return result(manager.getPageCount(departmentName, name));
}
public ResultVO getPage(Integer index, String departmentName, String name) {
return result(manager.getPage(index, departmentName, name));
}
public ResultVO get(Integer id) {
TeacherEntity entity = manager.get(id);
if (entity == null) {
return failedResult("教师Id: " + id + "不存在!");
}
entity.setPassword("");
return result(entity);
}
public ResultVO update(TeacherEntity entity) {
TeacherEntity originEntity = manager.get(entity.getId());
if (originEntity == null) {
return failedResult("教师Id: " + entity.getId() + "不存在!");
}
if (manager.getDepartmentById(entity.getDepartmentId()) == null) {
return failedResult("所属系Id: " + entity.getDepartmentId() + "不存在!");
}
if (entity.getPassword().equals("")) {
entity.setPassword(originEntity.getPassword());
} else {
entity.setPassword(userService.computePasswordHash(entity.getPassword()));
}
manager.update(entity);
return result("更新成功");
}
public ResultVO delete(Integer id) {
if (manager.get(id) == null) {
return failedResult("教师Id: " + id + "不存在!");
}
if (manager.hasCourse(id)) {
return failedResult("此教师还有教授的课程未被删除");
}
manager.delete(id);
return result("删除成功");
}
public ResultVO create(TeacherEntity entity) {
if (manager.get(entity.getId()) != null) {
return failedResult("教师Id: " + entity.getId() + "已存在!");
}
if (manager.getDepartmentById(entity.getDepartmentId()) == null) {
return failedResult("所属系Id: " + entity.getDepartmentId() + "不存在!");
}
// entity.setPassword(userService.computePasswordHash(entity.getPassword()));
manager.create(entity);
return result("添加成功");
}
public ResultVO listName() {
return result(manager.listName());
}
}
五、底部获取项目(9.9¥)
有问题,或者需要协助调试运行项目的也可以