当前位置:   article > 正文

java基于的springboot学生选课系统,学校选课管理系统,附源码+数据库,适合课程设计、毕业设计_学生选课管理系统

学生选课管理系统

1、项目介绍

(1)专业管理系统:登录专业管理平台后,管理员能够对专业进行增加、删除、查看、修改等功能。专业信息包含专业名称、所属院系等。

(2)院系管理系统:登录院系管理平台后,可对院系进行增、删、改、查等功能。院系信息包含院系名称。

(3)课程管理系统:登录课程管理平台后,能够通过搜索课程快速检索出相关教师信息以及班级。课程信息包含课程名称、课程描述、所属专业及所属教师。

(4)学生管理系统:登录学生管理系统后,管理员能够查看所查找的学生相关信息对其进行增、删、改、查。学生信息包括学生编号、学生姓名、所属院系、性别、所属专业等。

(5)教师管理系统:登录教师管理平台后,可对教师所教课程进行管理。教师信息包含姓名、工号、所属院系等。同时也可以查看、删除、修改自己的信息。

2、技术框架

运行系统:windows

编程语言:java

系统架构:B/S

后端框框:SpringBoot(Spring+SpringMVC+Mybatis)

前端框架:HTML+CSS+JavaScript

前后端分离:否

数据库:MySQL

Maven项目:是

数据库表数量:9

运行环境:JDK8+MySQL5.6+Maven3.6+idea

3、演示视频

java基于的springboot学生选课系统,

4、项目截图

5、代码示例

  1. package com.yht.controller;
  2. import com.yht.entity.ClassEntity;
  3. import com.yht.entity.Curriculum;
  4. import com.yht.entity.Student;
  5. import com.yht.entity.Teacher;
  6. import com.yht.service.IClassService;
  7. import com.yht.service.ICurriculumService;
  8. import com.yht.service.IStudentService;
  9. import com.yht.service.ITeacherService;
  10. import org.springframework.beans.factory.annotation.Autowired;
  11. import org.springframework.stereotype.Controller;
  12. import org.springframework.web.bind.annotation.RequestMapping;
  13. import org.springframework.web.bind.annotation.RestController;
  14. import java.util.ArrayList;
  15. import java.util.HashMap;
  16. import java.util.List;
  17. import java.util.Map;
  18. @RestController
  19. public class AnalysisController {
  20. @Autowired
  21. private IStudentService studentService;
  22. @Autowired
  23. private ITeacherService teacherService;
  24. @Autowired
  25. private ICurriculumService curriculumService;
  26. @Autowired
  27. private IClassService classService;
  28. /**
  29. * 学生的选课数量
  30. * @param id
  31. * @return
  32. */
  33. @RequestMapping("/studentCount")
  34. public Map<String, Object> getData(Integer id){
  35. //先查到所有学生,再查到所有学生的选课数,最后添加到map
  36. List<Student> studentList = studentService.selectAll();
  37. for(Student student :studentList){
  38. List<String> stringList = studentService.selectClassCount(student.getStuNo());
  39. student.setClassCount(stringList.size());
  40. }
  41. Map<String, Object> map = new HashMap<>();
  42. //names:学生姓名,counts:学生选课数
  43. String[] names = new String[studentList.size()];
  44. int[] counts = new int[studentList.size()];
  45. int i = 0;
  46. //存入数据
  47. for(Student student :studentList){
  48. names[i] = student.getName();
  49. counts[i] = student.getClassCount();
  50. i++;
  51. }
  52. map.put("names", names);
  53. map.put("counts", counts);
  54. return map;
  55. }
  56. /**
  57. * 学生的年龄范围
  58. * @param id
  59. * @return
  60. */
  61. @RequestMapping("/studentAge")
  62. public Map<String, Object> getData2(Integer id){
  63. List<Student> studentList = studentService.selectAll();
  64. List<Integer> list = new ArrayList<>();
  65. Map<String, Object> map = new HashMap<>();
  66. for(Student student :studentList){
  67. String birth = student.getBirth().substring(0,4);
  68. int val = 2021 - Integer.parseInt(birth);
  69. list.add(val);
  70. }
  71. String[] ageRanges = new String[4];
  72. ageRanges[0] = "18岁以下";
  73. ageRanges[1] = "18岁到24岁";
  74. ageRanges[2] = "24岁到30岁";
  75. ageRanges[3] = "30岁以上";
  76. int[] ageCounts = new int[4];
  77. for(int i : list){
  78. if(i < 18){
  79. ageCounts[0] += 1;
  80. }else if(i >=18 && i < 24){
  81. ageCounts[1] += 1;
  82. }else if(i >=24 && i < 30){
  83. ageCounts[2] += 1;
  84. }else if(i >= 30){
  85. ageCounts[3] += 1;
  86. }
  87. }
  88. map.put("ageRanges", ageRanges);
  89. map.put("ageCounts", ageCounts);
  90. return map;
  91. }
  92. /**
  93. * 老师代课数量
  94. * @return
  95. */
  96. @RequestMapping("/takeClassCount")
  97. public Map<String, Object> takeClassCount(){
  98. List<Teacher> teacherList = teacherService.selectAll();
  99. for(Teacher teacher : teacherList){
  100. teacher.setClassCount(curriculumService.selectByTeacherNo(teacher.getTeacherNo()).size());
  101. }
  102. String[] names = new String[teacherList.size()];
  103. int[] counts = new int[teacherList.size()];
  104. int i = 0;
  105. for(Teacher teacher :teacherList){
  106. names[i] = teacher.getName();
  107. counts[i] = teacher.getClassCount();
  108. i++;
  109. }
  110. Map<String, Object> map = new HashMap<>();
  111. map.put("names", names);
  112. map.put("counts", counts);
  113. return map;
  114. }
  115. /**
  116. * 教师的年龄范围
  117. * @return
  118. */
  119. @RequestMapping("/teacherAge")
  120. public Map<String, Object> teacherAge(){
  121. List<Teacher> teacherList = teacherService.selectAll();
  122. Map<String, Object> map = new HashMap<>();
  123. String[] ageRanges = new String[4];
  124. ageRanges[0] = "30岁以下";
  125. ageRanges[1] = "30岁到40岁";
  126. ageRanges[2] = "40岁到55岁";
  127. ageRanges[3] = "55岁以上";
  128. int[] ageCounts = new int[4];
  129. for(Teacher teacher : teacherList){
  130. if(teacher.getAge() < 30){
  131. ageCounts[0] += 1;
  132. }else if(teacher.getAge() >=30 && teacher.getAge() < 40){
  133. ageCounts[1] += 1;
  134. }else if(teacher.getAge() >=40 && teacher.getAge() < 55){
  135. ageCounts[2] += 1;
  136. }else if(teacher.getAge() >= 55){
  137. ageCounts[3] += 1;
  138. }
  139. }
  140. map.put("ageRanges", ageRanges);
  141. map.put("ageCounts", ageCounts);
  142. return map;
  143. }
  144. /**
  145. * 课程等级
  146. * @return
  147. */
  148. @RequestMapping("/curriculumGrade")
  149. public Map<String, Object> curriculumGrade(){
  150. List<Curriculum> curriculumList = curriculumService.selectAll();
  151. String[] names = new String[curriculumList.size()];
  152. int[] grades = new int[curriculumList.size()];
  153. int i = 0;
  154. for(Curriculum curriculum :curriculumList){
  155. names[i] = curriculum.getClassName();
  156. grades[i] = curriculum.getClassGrade();
  157. i++;
  158. }
  159. Map<String, Object> map = new HashMap<>();
  160. map.put("names", names);
  161. map.put("grades", grades);
  162. return map;
  163. }
  164. /**
  165. * 课程课时
  166. * @return
  167. */
  168. @RequestMapping("/curriculumTime")
  169. public Map<String, Object> curriculumTime(){
  170. List<Curriculum> curriculumList = curriculumService.selectAll();
  171. Map<Integer, Integer> myMap = new HashMap<>();
  172. for(Curriculum curriculum : curriculumList){
  173. if(myMap.containsKey(curriculum.getClassHour())){
  174. myMap.put(curriculum.getClassHour(), myMap.get(curriculum.getClassHour())+1);
  175. }else{
  176. myMap.put(curriculum.getClassHour(), 1);
  177. }
  178. }
  179. System.out.println(myMap);
  180. int[] hours = new int[myMap.size()];
  181. int[] counts = new int[myMap.size()];
  182. int i = 0;
  183. for (Map.Entry<Integer, Integer> entry : myMap.entrySet()) {
  184. hours[i] = entry.getKey();
  185. counts[i] = entry.getValue();
  186. i++;
  187. }
  188. Map<String, Object> map = new HashMap<>();
  189. map.put("hours", hours);
  190. map.put("counts", counts);
  191. return map;
  192. }
  193. /**
  194. * 班级等级
  195. * @return
  196. */
  197. @RequestMapping("/classGrade")
  198. public Map<String, Object> classGrade(){
  199. List<ClassEntity> classEntityList = classService.selectAll();
  200. String[] names = new String[classEntityList.size()];
  201. int[] grades = new int[classEntityList.size()];
  202. int i = 0;
  203. for(ClassEntity classEntity :classEntityList){
  204. names[i] = classEntity.getMajor();
  205. grades[i] = classEntity.getClassGrade();
  206. i++;
  207. }
  208. Map<String, Object> map = new HashMap<>();
  209. map.put("names", names);
  210. map.put("grades", grades);
  211. return map;
  212. }
  213. /**
  214. * 班级人数
  215. * @return
  216. */
  217. @RequestMapping("/classCount")
  218. public Map<String, Object> classCount(){
  219. List<ClassEntity> classEntityList = classService.selectAll();
  220. for(ClassEntity classEntity : classEntityList){
  221. classEntity.setStuCount(studentService.selectByCondition("","", classEntity.getClassNo()).size());
  222. }
  223. String[] names = new String[classEntityList.size()];
  224. int[] counts = new int[classEntityList.size()];
  225. int i = 0;
  226. for(ClassEntity classEntity :classEntityList){
  227. names[i] = classEntity.getMajor();
  228. counts[i] = classEntity.getStuCount();
  229. i++;
  230. }
  231. Map<String, Object> map = new HashMap<>();
  232. map.put("names", names);
  233. map.put("counts", counts);
  234. return map;
  235. }
  236. }

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号