微信小程序|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开发前端操作界面,并使用微信小程序开发小程序端供用户使用。项目比较适合做毕业设计使用。

相关文章
|
18天前
|
JavaScript 前端开发 Java
|
1天前
|
移动开发 安全 JavaScript
SpringBoot接入微信JSSDK,看这篇妥妥的
这篇教程详细介绍了如何在Spring Boot项目中接入微信JSSDK,实现H5页面的自定义分享和调用相册选取图片等功能。文章首先通过对比理想与现实的分享效果,引出了接入微信JSSDK的必要性。接着,作者提供了GitHub和Gitee上的项目源码链接,并逐步讲解了整个接入过程的关键步骤,包括配置文件、主要类和方法的实现细节,以及必要的微信公众号设置。此外,还特别强调了几个常见问题及其解决方案,如域名绑定、IP白名单设置和签名验证等。最后,通过实际测试验证了功能的正确性。适合初学者快速上手微信JSSDK接入。
15 8
SpringBoot接入微信JSSDK,看这篇妥妥的
|
2天前
|
小程序 JavaScript
Taro@3.x+Vue@3.x+TS开发微信小程序,使用轮播图
本文介绍了使用 Taro 和 Vue 创建轮播组件的两种方法:一是通过 `&lt;swiper&gt;` 实现,二是利用 Nut UI 的 `&lt;nut-swiper&gt;` 组件实现。
Taro@3.x+Vue@3.x+TS开发微信小程序,使用轮播图
|
2天前
|
小程序
Taro@3.x+Vue@3.x+TS开发微信小程序,设置转发分享
本文介绍了Taro中`useShareAppMessage`的使用方法,需在页面配置`enableShareAppMessage: true`并重新编译。
Taro@3.x+Vue@3.x+TS开发微信小程序,设置转发分享
|
2天前
|
小程序 数据安全/隐私保护
Taro@3.x+Vue@3.x+TS开发微信小程序,网络请求封装
在 `src/http` 目录下创建 `request.ts` 文件,并配置 Taro 的网络请求方法 `Taro.request`,支持多种 HTTP 方法并处理数据加密。
Taro@3.x+Vue@3.x+TS开发微信小程序,网络请求封装
|
2天前
|
小程序
Taro@3.x+Vue@3.x+TS开发微信小程序,上传文件
本文介绍如何在Taro项目中使用Nut UI的`&lt;nut-uploader/&gt;`组件实现图片上传功能,并通过示例代码展示了自定义上传逻辑的方法。
Taro@3.x+Vue@3.x+TS开发微信小程序,上传文件
|
2天前
|
小程序
Taro@3.x+Vue@3.x+TS开发微信小程序,根据系统主题展示不同样式(darkMode)
本文介绍如何在Taro项目中配置深色模式。通过在`src/app.config.ts`设置`darkmode`选项和在`theme.json`中定义主题变量,可以实现跟随系统主题的界面风格切换。
Taro@3.x+Vue@3.x+TS开发微信小程序,根据系统主题展示不同样式(darkMode)
|
2天前
|
小程序 开发者
Taro@3.x+Vue@3.x+TS开发微信小程序,使用自定义tabBar
本文介绍了如何在Taro项目中实现自定义tabBar。首先,在`app.config.ts`中设置`custom: true`并配置`tabBar`。
Taro@3.x+Vue@3.x+TS开发微信小程序,使用自定义tabBar
|
12天前
|
小程序 JavaScript Java
微信小程序+SpringBoot接入后台服务,接口数据来自后端
这篇文章介绍了如何将微信小程序与SpringBoot后端服务进行数据交互,包括后端接口的编写、小程序获取接口数据的方法,以及数据在小程序中的展示。同时,还涉及到了使用Vue搭建后台管理系统,方便数据的查看和管理。
微信小程序+SpringBoot接入后台服务,接口数据来自后端
|
12天前
|
小程序
关于我花了一个星期学习微信小程序开发、并且成功开发出一个商城项目系统的心得体会
这篇文章是作者关于学习微信小程序开发并在一周内成功开发出一个商城项目系统的心得体会,分享了学习基础知识、实战项目开发的过程,以及小程序开发的易上手性和开发周期的简短。
关于我花了一个星期学习微信小程序开发、并且成功开发出一个商城项目系统的心得体会
下一篇
云函数