微信小程序|Springboot+Node+Vue实现学科竞赛管理系统(二)

简介: 微信小程序|Springboot+Node+Vue实现学科竞赛管理系统

微信小程序|Springboot+Node+Vue实现学科竞赛管理系统(一)https://developer.aliyun.com/article/1423239


四,核心代码展示

1. package com.sang.subjectcompetition.controller;
2. 
3. import com.sang.subjectcompetition.entity.Comp;
4. import com.sang.subjectcompetition.entity.Project;
5. import com.sang.subjectcompetition.entity.Teacher_Project;
6. import com.sang.subjectcompetition.entity.resultInfo.CompResult;
7. import com.sang.subjectcompetition.service.CompService;
8. import com.sang.subjectcompetition.service.ProjectService;
9. import org.apache.logging.log4j.util.PropertySource;
10. import org.springframework.beans.factory.annotation.Autowired;
11. import org.springframework.web.bind.annotation.*;
12. 
13. import java.util.Comparator;
14. import java.util.List;
15. 
16. @RestController
17. @RequestMapping("/comp")
18. public class CompController {
19. 
20. @Autowired
21. private CompService compService;
22. 
23. @Autowired
24. private ProjectService projectService;
25. 
26. /**
27.      * 返回全部的竞赛信息
28.      * @return
29.      */
30. @PostMapping("/getAllComps")
31. public List<Comp> selectAllComp(){
32.         List<Comp> allComps = compService.getAllComps();
33.         allComps.sort(Comparator.naturalOrder());
34. return allComps;
35.     }
36. 
37. /**
38.      * 发布竞赛/更新
39.      * @param comp
40.      * @return
41.      */
42. @PostMapping("/addComp")
43. public String addComp(Comp comp){
44. CompResult compResult = compService.createComp(comp);
45. return compResult.getMessage();
46.     }
47. 
48. /**
49.      * 多条件模糊查询
50.      * @return
51.      */
52. @PostMapping("/moreSearch")
53. public List<Comp> moreSearch(Comp comp){
54.         String compName=comp.getCompName();
55.         String organizer=comp.getOrganizer();
56.         Integer level=comp.getLevel();
57.         String subjectType=comp.getSubjectType();
58.         String place=comp.getPlace();
59.         Integer compState=comp.getCompState();
60. return compService.getCompsBySelf(compName,organizer,level,subjectType,place,compState);
61.     }
62. 
63. /**
64.      * 根据Id返回竞赛的项目
65.      */
66. @GetMapping("/getProjectLists/{compId}")
67. public List<Project> getProjectLists(@PathVariable Integer compId){
68.         List<Project> projectsBycompId = projectService.getProjectsBycompId(compId);
69. return projectService.getProjectsBycompId(compId);
70.     }
71. 
72. }
1. package com.sang.subjectcompetition.controller;
2. 
3. import com.sang.subjectcompetition.entity.*;
4. import com.sang.subjectcompetition.entity.resultInfo.MessageResult;
5. import com.sang.subjectcompetition.respository.AdminRepository;
6. import com.sang.subjectcompetition.respository.CollegeRepository;
7. import com.sang.subjectcompetition.respository.StudentRepository;
8. import com.sang.subjectcompetition.respository.TeacherRepository;
9. import com.sang.subjectcompetition.service.MessageService;
10. import org.springframework.beans.factory.annotation.Autowired;
11. import org.springframework.web.bind.annotation.GetMapping;
12. import org.springframework.web.bind.annotation.PathVariable;
13. import org.springframework.web.bind.annotation.RequestMapping;
14. import org.springframework.web.bind.annotation.RestController;
15. 
16. import java.util.ArrayList;
17. import java.util.HashMap;
18. import java.util.List;
19. import java.util.Map;
20. 
21. @RestController
22. @RequestMapping("/msg")
23. public class MessageController {
24. 
25. @Autowired
26. private MessageService messageService;
27. 
28. @Autowired
29. private AdminRepository adminRepository;
30. 
31. @Autowired
32. private StudentRepository studentRepository;
33. 
34. @Autowired
35. private CollegeRepository collegeRepository;
36. 
37. @Autowired
38. private TeacherRepository teacherRepository;
39. 
40. @GetMapping("/getUnReadListPopup/{receiver}")
41. public List<Message> getUnReadListPopup(@PathVariable String receiver ){
42. return messageService.findUnReadMessage(receiver);
43.     }
44. 
45. @GetMapping("/getUnReadList/{receive}")
46. public List<Map<String ,Object>> getUnReadList(@PathVariable String receive){
47.         List<Map<String ,Object>> result=new ArrayList<>();
48.         List<Message> unReadMessage = messageService.findUnReadMessage(receive);
49. for (Message message : unReadMessage) {
50.             Map<String ,Object> map=new HashMap<>();
51.             map.put("id",message.getId());
52.             map.put("date",message.getMsgDate());
53.             map.put("title",message.getTitle());
54.             map.put("content",message.getContent());
55. if(message.getSenderRole()==0){
56. Student student = studentRepository.findStudentByTargetId(message.getSender());
57.                 map.put("sendUsername",student.getUsername());
58.                 map.put("sendName",student.getNickname());
59.             }else if(message.getSenderRole()==1){
60. Teacher teacher = teacherRepository.findTeacherByTargetId(message.getSender());
61.                 map.put("sendUsername",teacher.getUsername());
62.                 map.put("sendName",teacher.getNickname());
63.             }else if(message.getSenderRole()==2){
64. College college = collegeRepository.findCollegeByTargetId(message.getSender());
65.                 map.put("sendUsername",college.getUsername());
66.                 map.put("sendName",college.getNickname());
67.             }else{
68. Admin admin = adminRepository.findAdminByTargetId(message.getSender());
69.                 map.put("sendUsername",admin.getUsername());
70.                 map.put("sendName",admin.getNickname());
71.             }
72.             result.add(map);
73.         }
74. return result;
75.     }
76. 
77. @GetMapping("/getReadList/{receive}")
78. public List<Map<String ,Object>> getReadList(@PathVariable String receive){
79.         List<Map<String ,Object>> result=new ArrayList<>();
80.         List<Message> readMessage = messageService.findReadMessage(receive);
81. for (Message message : readMessage) {
82.             Map<String ,Object> map=new HashMap<>();
83.             map.put("id",message.getId());
84.             map.put("date",message.getMsgDate());
85.             map.put("title",message.getTitle());
86.             map.put("content",message.getContent());
87. if(message.getSenderRole()==0){
88. Student student = studentRepository.findStudentByTargetId(message.getSender());
89.                 map.put("sendUsername",student.getUsername());
90.                 map.put("sendName",student.getNickname());
91.             }else if(message.getSenderRole()==1){
92. Teacher teacher = teacherRepository.findTeacherByTargetId(message.getSender());
93.                 map.put("sendUsername",teacher.getUsername());
94.                 map.put("sendName",teacher.getNickname());
95.             }else if(message.getSenderRole()==2){
96. College college = collegeRepository.findCollegeByTargetId(message.getSender());
97.                 map.put("sendUsername",college.getUsername());
98.                 map.put("sendName",college.getNickname());
99.             }else{
100. Admin admin = adminRepository.findAdminByTargetId(message.getSender());
101.                 map.put("sendUsername",admin.getUsername());
102.                 map.put("sendName",admin.getNickname());
103.             }
104.             result.add(map);
105.         }
106. return result;
107.     }
108. 
109. @GetMapping("/markMessage/{messageId}")
110. public MessageResult markMessage(@PathVariable Integer messageId){
111. return messageService.markRead(messageId);
112.     }
113. 
114. @GetMapping("/deleteMessage/{messageId}")
115. public MessageResult deleteMessage(@PathVariable Integer messageId){
116. return messageService.deleteMessage(messageId);
117.     }
118. 
119. }
1. package com.sang.subjectcompetition.controller;
2. 
3. import com.sang.subjectcompetition.entity.Project;
4. import com.sang.subjectcompetition.entity.resultInfo.ProResult;
5. import com.sang.subjectcompetition.service.ProjectService;
6. import com.sang.subjectcompetition.service.StudentService;
7. import com.sang.subjectcompetition.service.TeacherService;
8. import org.springframework.beans.factory.annotation.Autowired;
9. import org.springframework.web.bind.annotation.*;
10. 
11. import java.util.Comparator;
12. import java.util.List;
13. import java.util.TreeSet;
14. 
15. /**
16.  * 项目管理
17.  */
18. @RestController
19. @RequestMapping("/project")
20. public class ProjectController {
21. @Autowired
22. private ProjectService projectService;
23. 
24. @Autowired
25. private TeacherService teacherService;
26. 
27. @Autowired
28. private StudentService studentService;
29. 
30. /**
31.      * 得到参加项目的老师
32.      * @param projectId
33.      * @return
34.      */
35. @GetMapping("/getProjectJoinTeacher/{projectId}")
36. public List getProjectJoinTeacher(@PathVariable Integer projectId){
37. return projectService.getProjectJoinTeacher(projectId);
38.     }
39. 
40. /**
41.      * 得到参加项目的学生
42.      * @param projectId
43.      * @return
44.      */
45. @GetMapping("/getProjectJoinStudent/{projectId}")
46. public List getProjectJoinStudent(@PathVariable Integer projectId){
47. return projectService.getProjectJoinStudent(projectId);
48.     }
49. 
50. /**
51.      * 根据学院id来得到模糊查询
52.      * @param project
53.      * @param collegeId
54.      * @return
55.      */
56. @PostMapping("/getMoreSearchProjectByCollege")
57. public List<Project> getMoreSearchProjectByCollege(Project project,Integer collegeId){
58.         List<Project> moreSearchProjectByCollege = projectService.getMoreSearchProjectByCollege(collegeId, project);
59.         moreSearchProjectByCollege.sort(Comparator.naturalOrder());
60. return moreSearchProjectByCollege;
61.     }
62. 
63. /**
64.      * 根据学院id来得到模糊查询
65.      * @param project
66.      * @param teacherId
67.      * @return
68.      */
69. @PostMapping("/getMoreSearchProjectByTeacher")
70. public List<Project> getMoreSearchProjectByTeacher(Project project,Integer teacherId){
71.         Integer collegeId=teacherService.getTeacherById(teacherId).getCollege().getId();
72. 
73.         List<Project> projects = projectService.getMoreSearchProjectByCollege(collegeId, project);
74.         projects.sort(Comparator.naturalOrder());
75. return projects;
76.     }
77. 
78. /**
79.      * 根据学院id来得到模糊查询
80.      * @param project
81.      * @param studentId
82.      * @return
83.      */
84. @PostMapping("/getMoreSearchProjectByStudent")
85. public List<Project> getMoreSearchProjectByStudent(Project project,Integer studentId){
86.         Integer collegeId=studentService.getStudentById(studentId).getCollege().getId();
87.         List<Project> moreSearchProjectByCollege = projectService.getMoreSearchProjectByCollege(collegeId, project);
88.         moreSearchProjectByCollege.sort(Comparator.naturalOrder());
89. return moreSearchProjectByCollege;
90.     }
91. 
92. /**
93.      * 根据学院id来得到模糊查询
94.      * @param project
95.      * @return
96.      */
97. @PostMapping("/getMoreSearchAllProjects")
98. public List<Project> getMoreSearchAllProjects(Project project){
99.         List<Project> moreSearchAllProject = projectService.getMoreSearchAllProject(project);
100.         moreSearchAllProject.sort(Comparator.naturalOrder());
101. return moreSearchAllProject;
102.     }
103. 
104. /**
105.      * 得到学生参与的项目集合
106.      * @param studentId
107.      * @return
108.      */
109. @GetMapping("/getStudentProjects/{studentId}")
110. public List<Project> getStudentProjects(@PathVariable Integer studentId){
111.         List<Project> studentProjects = projectService.getStudentProjects(studentId);
112.         studentProjects.sort(Comparator.naturalOrder());
113. return studentProjects;
114.     }
115. 
116. /**
117.      * 得到教师领队的项目
118.      * @param teacherId
119.      * @return
120.      */
121. @GetMapping("/getTeacherJoinProjects/{teacherId}")
122. public List<Project> getTeacherJoinProjects(@PathVariable Integer teacherId){
123.         List<Project> teacherJoinProjects = projectService.getTeacherJoinProjects(teacherId);
124.         teacherJoinProjects.sort(Comparator.naturalOrder());
125. return teacherJoinProjects;
126.     }
127. 
128. /**
129.      * 解散项目组
130.      * @param projectId
131.      * @return
132.      */
133. @GetMapping("/invokeProject/{projectId}")
134. public ProResult invokeProject(@PathVariable Integer projectId) {
135. return teacherService.invokeProject(projectId);
136.     }
137. 
138. }

五,项目总结

本项目设计功能丰富,所使用的技术比较符合现在毕业设计的要求,使用springboot开发后台服务接口,使用Node+Vue开发前端操作界面,并使用微信小程序开发小程序端供用户使用。项目比较适合做毕业设计使用。

相关文章
|
1月前
|
存储 JavaScript 安全
基于Springboot和vue的餐饮管理系统的设计与实现
基于Springboot和vue的餐饮管理系统的设计与实现
|
6天前
|
前端开发 JavaScript Java
Springboot+vue的医患档案管理系统
这是一个医患档案管理系统,包含用户管理、病历管理和预约管理模块。示例展示了一个Spring Boot后端接口,用于获取所有病历信息,以及一个Vue.js前端,使用Axios调用该接口显示病历列表。实际项目需考虑登录、权限及病历CRUD功能,可按需求和技术栈扩展。
22 7
|
13天前
|
JavaScript Java 关系型数据库
基于 java + Springboot + vue +mysql 大学生实习管理系统(含源码)
本文档介绍了基于Springboot的实习管理系统的设计与实现。系统采用B/S架构,旨在解决实习管理中的人工管理问题,提高效率。系统特点包括对用户输入的验证和数据安全性保障。功能涵盖首页、个人中心、班级管理、学生管理、教师管理、实习单位管理、实习作业管理、教师评分管理、单位成绩管理和系统管理等。用户分为管理员、教师和学生,各自有不同的操作权限。
|
26天前
|
移动开发 缓存 JavaScript
|
26天前
|
前端开发 JavaScript Java
springboot+vue实现用户统一认证、管理-前端实现
springboot+vue实现用户统一认证、管理-前端实现
24 0
|
28天前
|
前端开发 JavaScript Java
springboot+mybatis plus+vue+elementui+axios 表格分页查询demo
springboot+mybatis plus+vue+elementui+axios 表格分页查询demo
32 0
|
1月前
|
小程序 Java 数据库
微信小程序的驾校预约管理系统
微信小程序的驾校预约管理系统
|
1月前
|
Java 关系型数据库 数据库
基于springboot+vue车辆充电桩管理系统
基于springboot+vue车辆充电桩管理系统
基于springboot+vue车辆充电桩管理系统
|
1月前
|
Java 关系型数据库 MySQL
springboot+vue“智慧食堂”设计与实现
springboot+vue“智慧食堂”设计与实现
|
1月前
|
搜索推荐 Java 数据库
基于springboot+vue学习平台
基于springboot+vue学习平台