作者主页:夜未央5788
简介:Java领域优质创作者、Java项目、学习资料、技术互助
文末获取源码
项目介绍
本项目为前后端分离的项目;
系统分为管理员、老师、学生等三种角色
管理员:学生管理、教师管理、课程管理、开课表管理、学生成绩管理
教师:教师信息编辑、课程设置、教师成绩管理
学生:学生信息编辑、选课管理、学生成绩管理
使用人群:
正在做毕设的学生,或者需要项目实战练习的Java学习者
由于本程序规模不大,可供课程设计,毕业设计学习演示之用
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 前端推荐使用vscode;
3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
4.数据库:MySql 5.7/8.0版本均可;
5.是否Maven项目:是;
6.是否为前后端分离项目:是;
技术栈
后端框架:Springboot
前端技术:ElementUI、Vue、nodejs
使用说明
后端项目运行:
1. 使用Navicat或者其它工具,在mysql中创建对应sql文件名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入源码中的student_server项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
4. 运行项目,控制台提示运行成功后再去运行前端项目;
前端项目运行:
1.打开运行中的cmd;
2.cd到student_client文件夹目录;
3.执行命令:npm run serve
4. 运行成功后,在浏览器中输入地址:http://localhost:8080/
管理员:666/123456
学生:23/123456
老师:14/123456
运行截图
相关代码
CourseController
package com.auggie.student_server.controller;
import com.auggie.student_server.entity.Course;
import com.auggie.student_server.service.CourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* @Auther: auggie
* @Date: 2022/2/9 13:45
* @Description: CourseController
* @Version 1.0.0
*/
@RestController
@CrossOrigin("*")
@RequestMapping("/course")
public class CourseController {
@Autowired
private CourseService courseService;
@PostMapping("/findBySearch")
public List<Course> findBySearch(@RequestBody Map<String, String> map) {
return courseService.findBySearch(map);
}
@GetMapping("/findById/{cid}")
public List<Course> findById(@PathVariable Integer cid) {
return courseService.findBySearch(cid);
}
@PostMapping("/save")
public boolean save(@RequestBody Course course) {
System.out.println(course);
return courseService.insertCourse(course);
}
@GetMapping("/deleteById/{cid}")
public boolean deleteById(@PathVariable Integer cid) {
System.out.println("正在删除课程 cid: " + cid);
return courseService.deleteById(cid);
}
@PostMapping("/updateCourse")
public boolean updateCourse(@RequestBody Course course) {
System.out.println("正在修改课程: " + course);
return courseService.updateById(course);
}
}
CourseTeacherController
package com.auggie.student_server.controller;
import com.auggie.student_server.entity.Course;
import com.auggie.student_server.entity.CourseTeacher;
import com.auggie.student_server.entity.CourseTeacherInfo;
import com.auggie.student_server.service.CourseTeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* @Auther: auggie
* @Date: 2022/2/10 16:51
* @Description: CourseTeacherController
* @Version 1.0.0
*/
@RestController
@CrossOrigin("*")
@RequestMapping("/courseTeacher")
public class CourseTeacherController {
@Autowired
private CourseTeacherService courseTeacherService;
@GetMapping("/insert/{cid}/{tid}/{term}")
public boolean insert(@PathVariable Integer cid, @PathVariable Integer tid, @PathVariable String term) {
if (courseTeacherService.findBySearch(cid, tid, term).size() != 0) {
return false;
}
return courseTeacherService.insertCourseTeacher(cid, tid, term);
}
@GetMapping("/findMyCourse/{tid}/{term}")
public List<Course> findMyCourse(@PathVariable Integer tid, @PathVariable String term) {
System.out.println("查询教师课程:" + tid + " " + term);
return courseTeacherService.findMyCourse(tid, term);
}
@PostMapping("/findCourseTeacherInfo")
public List<CourseTeacherInfo> findCourseTeacherInfo(@RequestBody Map<String, String> map) {
return courseTeacherService.findCourseTeacherInfo(map);
}
@PostMapping("/deleteById")
public boolean deleteById(@RequestBody CourseTeacher courseTeacher) {
return courseTeacherService.deleteById(courseTeacher);
}
}
SCTcontroller
package com.auggie.student_server.controller;
import com.auggie.student_server.entity.CourseTeacherInfo;
import com.auggie.student_server.entity.SCTInfo;
import com.auggie.student_server.entity.StudentCourseTeacher;
import com.auggie.student_server.service.SCTService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* @Auther: auggie
* @Date: 2022/2/10 20:15
* @Description: SCTcontroller
* @Version 1.0.0
*/
@RestController
@CrossOrigin("*")
@RequestMapping("/SCT")
public class SCTcontroller {
@Autowired
private SCTService sctService;
@PostMapping("/save")
public String save(@RequestBody StudentCourseTeacher studentCourseTeacher) {
if (sctService.isSCTExist(studentCourseTeacher)) {
return "禁止重复选课";
}
System.out.println("正在保存 sct 记录:" + studentCourseTeacher);
return sctService.save(studentCourseTeacher) ? "选课成功" : "选课失败,联系管理员";
}
@GetMapping("/findBySid/{sid}/{term}")
public List<CourseTeacherInfo> findBySid(@PathVariable Integer sid, @PathVariable String term) {
return sctService.findBySid(sid, term);
}
@GetMapping("/findAllTerm")
public List<String> findAllTerm() {
return sctService.findAllTerm();
}
@PostMapping("/deleteBySCT")
public boolean deleteBySCT(@RequestBody StudentCourseTeacher studentCourseTeacher) {
System.out.println("正在删除 sct 记录:" + studentCourseTeacher);
return sctService.deleteBySCT(studentCourseTeacher);
}
@PostMapping("/findBySearch")
public List<SCTInfo> findBySearch(@RequestBody Map<String, String> map) {
return sctService.findBySearch(map);
}
@GetMapping("/findById/{sid}/{cid}/{tid}/{term}")
public SCTInfo findById(@PathVariable Integer sid,
@PathVariable Integer cid,
@PathVariable Integer tid,
@PathVariable String term) {
return sctService.findByIdWithTerm(sid, cid, tid, term);
}
@GetMapping("/updateById/{sid}/{cid}/{tid}/{term}/{grade}")
public boolean updateById(@PathVariable Integer sid,
@PathVariable Integer cid,
@PathVariable Integer tid,
@PathVariable String term,
@PathVariable Integer grade) {
return sctService.updateById(sid, cid, tid, term, grade);
}
@GetMapping("/deleteById/{sid}/{cid}/{tid}/{term}")
public boolean deleteById(@PathVariable Integer sid,
@PathVariable Integer cid,
@PathVariable Integer tid,
@PathVariable String term) {
return sctService.deleteById(sid, cid, tid, term);
}
}
StudentController
package com.auggie.student_server.controller;
import com.auggie.student_server.entity.Student;
import com.auggie.student_server.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* @Auther: auggie
* @Date: 2022/2/8 17:37
* @Description: StudentController
* @Version 1.0.0
*/
@RestController
@CrossOrigin("*")
@RequestMapping("/student")
public class StudentController {
@Autowired
private StudentService studentService;
@PostMapping("/addStudent")
public boolean addStudent(@RequestBody Student student) {
System.out.println("正在保存学生对象" + student);
return studentService.save(student);
}
@PostMapping("/login")
public boolean login(@RequestBody Student student) {
System.out.println("正在验证学生登陆 " + student);
Student s = studentService.findById(student.getSid());
if (s == null || !s.getPassword().equals(student.getPassword())) {
return false;
}
else {
return true;
}
}
@PostMapping("/findBySearch")
public List<Student> findBySearch(@RequestBody Student student) {
Integer fuzzy = (student.getPassword() == null) ? 0 : 1;
return studentService.findBySearch(student.getSid(), student.getSname(), fuzzy);
}
@GetMapping("/findById/{sid}")
public Student findById(@PathVariable("sid") Integer sid) {
System.out.println("正在查询学生信息 By id " + sid);
return studentService.findById(sid);
}
@GetMapping("/findByPage/{page}/{size}")
public List<Student> findByPage(@PathVariable("page") int page, @PathVariable("size") int size) {
System.out.println("查询学生列表分页 " + page + " " + size);
return studentService.findByPage(page, size);
}
@GetMapping("/getLength")
public Integer getLength() {
return studentService.getLength();
}
@GetMapping("/deleteById/{sid}")
public boolean deleteById(@PathVariable("sid") int sid) {
System.out.println("正在删除学生 sid:" + sid);
return studentService.deleteById(sid);
}
@PostMapping("/updateStudent")
public boolean updateStudent(@RequestBody Student student) {
System.out.println("更新 " + student);
return studentService.updateById(student);
}
}
如果也想学习本系统,下面领取。关注并回复:229boot