UML大作业

main
kunkun 8 months ago
parent bbbd1b7801
commit 4dabb1269a

8
.idea/.gitignore vendored

@ -0,0 +1,8 @@
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_X" default="true" project-jdk-name="23" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/remotebelongstous.iml" filepath="$PROJECT_DIR$/.idea/remotebelongstous.iml" />
</modules>
</component>
</project>

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

@ -0,0 +1,37 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target
/.mvn/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
*.log
*.jar
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.2.RELEASE</version>
<relativePath/>
</parent>
<groupId>com.shanzhu</groupId>
<artifactId>OnlineExam-backend</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>OnlineExam-backend</name>
<description>在线考试系统</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!--MyBatis plus -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.0</version>
</dependency>
<!--Jdbc-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<!--Spring Web-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!--数据库相关-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.8</version>
</dependency>
<!-- 热部署模块 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>4.3.9.RELEASE</version>
</dependency>
<!-- lombok-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.10</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

@ -0,0 +1,27 @@
package com.shanzhu.oe;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* SpringBoot
* "BackendApplication"
*
* SpringBoothttps://www.php.cn/faq/498384.html
*
* @author: ShanZhu
* @date: 2023-11-10
*/
@Slf4j
@SpringBootApplication
public class BackendApplication {
public static void main(String[] args) {
//SpringBoot 执行启动
SpringApplication.run(BackendApplication.class, args);
log.info("=====================项目后端启动成功============================");
}
}

@ -0,0 +1,33 @@
package com.shanzhu.oe.common;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class R<T> {
/**
*
*/
private int code;
/**
*
*/
private String message;
/**
*
*/
private T data;
}

@ -0,0 +1,32 @@
package com.shanzhu.oe.config;
import org.springframework.web.servlet.HandlerInterceptor;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* 1.
* 2.
*
* @author: ShanZhu
* @date: 2023-11-20
*/
public class LoginInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
if (request.getCookies() == null) {
return false;
}
for (Cookie cookie : request.getCookies()) {
if ("rb_token".equals(cookie.getName()) && cookie.getValue() != null && !cookie.getValue().equals("")) {
return true;
}
}
return false;
}
}

@ -0,0 +1,56 @@
package com.shanzhu.oe.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* SpringMvc
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Configuration
public class MvcConfig implements WebMvcConfigurer {
/**
*
*
* @param registry
*/
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new LoginInterceptor())
.addPathPatterns()
.excludePathPatterns("/login");
}
/**
*
*
* @return
*/
@Bean
public CorsFilter corsFilter() {
// 1.创建 CORS 配置对象
CorsConfiguration config = new CorsConfiguration();
// 支持域
config.addAllowedOrigin("*");
// 是否发送 Cookie
config.setAllowCredentials(true);
// 支持请求方式
config.addAllowedMethod("*");
// 允许的原始请求头部信息
config.addAllowedHeader("*");
// 2.添加地址映射
UrlBasedCorsConfigurationSource corsConfigurationSource = new UrlBasedCorsConfigurationSource();
corsConfigurationSource.registerCorsConfiguration("/**", config);
// 3.返回 CorsFilter 对象
return new CorsFilter(corsConfigurationSource);
}
}

@ -0,0 +1,30 @@
package com.shanzhu.oe.config;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* Mybatis - plus
*
* MybatisPlus? https://blog.csdn.net/qq_52922453/article/details/127196313
*
* @author: ShanZhu
* @date: 2023-11-10
*/
@Configuration
public class MybatisPlusConfig {
/**
*
*
* @return MybatisPlusInterceptor
*/
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
return interceptor;
}
}

@ -0,0 +1,92 @@
package com.shanzhu.oe.controller;
import com.shanzhu.oe.common.R;
import com.shanzhu.oe.entity.Admin;
import com.shanzhu.oe.service.AdminService;
import com.shanzhu.oe.util.ApiResultHandler;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@RestController
@RequiredArgsConstructor
public class AdminController {
private final AdminService adminService;
/**
*
*
* @return
*/
@GetMapping("/admins")
public R<List<Admin>> findAll(){
return ApiResultHandler.success(adminService.findAll());
}
/**
* id
*
* @param adminId id
* @return
*/
@GetMapping("/admin/{adminId}")
public R<Admin> findById(@PathVariable("adminId") Integer adminId){
return ApiResultHandler.success(adminService.findById(adminId));
}
/**
* id
*
* @param adminId id
* @return
*/
@DeleteMapping("/admin/{adminId}")
public R deleteById(@PathVariable("adminId") Integer adminId){
adminService.deleteById(adminId);
return ApiResultHandler.success();
}
/**
*
*
* @param adminId id
* @param admin
* @return
*/
@PutMapping("/admin/{adminId}")
public R update(@PathVariable("adminId") Integer adminId, Admin admin){
return ApiResultHandler.success(adminService.update(admin));
}
/**
*
*
* @param admin
* @return
*/
@PostMapping("/admin")
public R add(Admin admin){
return ApiResultHandler.success(adminService.add(admin));
}
/**
*
*
* @param adminId id
* @param newPsw
* @param oldPsw
* @return
*/
@GetMapping("/admin/resetPsw/{adminId}/{oldPsw}/{newPsw}")
public R resetPsw(@PathVariable("adminId") Integer adminId, @PathVariable("newPsw") String newPsw, @PathVariable("oldPsw") String oldPsw) {
return ApiResultHandler.success(adminService.resetPsw(adminId, newPsw, oldPsw));
}
}

@ -0,0 +1,66 @@
package com.shanzhu.oe.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shanzhu.oe.common.R;
import com.shanzhu.oe.service.AnswerService;
import com.shanzhu.oe.util.ApiResultHandler;
import com.shanzhu.oe.vo.AnswerVO;
import com.shanzhu.oe.vo.QuestionVO;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@RestController
@RequiredArgsConstructor
public class AnswerController {
private final AnswerService answerService;
/**
*
*
* @param page
* @param size
* @param subject
* @param section
* @param question
* @return
*/
@GetMapping("/answers/{page}/{size}/{subject}/{section}/{question}")
public R<IPage<AnswerVO> > findAllQuestion(
@PathVariable("page") Integer page,
@PathVariable("size") Integer size,
@PathVariable("subject") String subject,
@PathVariable("section") String section,
@PathVariable("question") String question
){
IPage<AnswerVO> answerVOIPage = answerService.findAll(new Page<>(page,size), subject, section, question);
return ApiResultHandler.buildApiResult(200,"查询所有题库", answerVOIPage);
}
/**
* id
*
* @param type
* @param questionId id
* @return
*/
@GetMapping("/answers/{type}/{questionId}")
public R<QuestionVO> findByIdAndType(
@PathVariable("type") String type,
@PathVariable("questionId") Long questionId
) {
QuestionVO questionVO = answerService.findByIdAndType(type, questionId);
return ApiResultHandler.buildApiResult(200, "查询题目", questionVO);
}
}

@ -0,0 +1,112 @@
package com.shanzhu.oe.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shanzhu.oe.common.R;
import com.shanzhu.oe.entity.ExamManage;
import com.shanzhu.oe.service.ExamManageService;
import com.shanzhu.oe.util.ApiResultHandler;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@RestController
@RequiredArgsConstructor
public class ExamManageController {
private final ExamManageService examManageService;
/**
*
*
* @return
*/
@GetMapping("/exams")
public R<List<ExamManage>> findAll() {
return ApiResultHandler.buildApiResult(200, "请求成功!", examManageService.findAll());
}
/**
*
*
* @param page
* @param size
* @return
*/
@GetMapping("/exams/{page}/{size}")
public R<IPage<ExamManage>> findAll(@PathVariable("page") Integer page, @PathVariable("size") Integer size) {
return ApiResultHandler.buildApiResult(200, "请求成功!", examManageService.findAll(new Page<>(page, size)));
}
/**
*
*
* @param examCode
* @return
*/
@GetMapping("/exam/{examCode}")
public R<ExamManage> findById(@PathVariable("examCode") Integer examCode) {
ExamManage res = examManageService.findById(examCode);
if (res == null) {
return ApiResultHandler.buildApiResult(10000, "考试编号不存在", null);
}
return ApiResultHandler.buildApiResult(200, "请求成功!", res);
}
/**
*
*
* @param examCode
*/
@DeleteMapping("/exam/{examCode}")
public R deleteById(@PathVariable("examCode") Integer examCode) {
return ApiResultHandler.buildApiResult(200, "删除成功", examManageService.delete(examCode));
}
/**
*
*
* @param examManage
*/
@PutMapping("/exam")
public R update(@RequestBody ExamManage examManage) {
return ApiResultHandler.buildApiResult(200, "更新成功", examManageService.update(examManage));
}
/**
*
*
* @param examManage
*/
@PostMapping("/exam")
public R add(@RequestBody ExamManage examManage) {
int res = examManageService.add(examManage);
if (res == 1) {
return ApiResultHandler.buildApiResult(200, "添加成功", res);
} else {
return ApiResultHandler.buildApiResult(400, "添加失败", res);
}
}
/**
* paperId,
*
* @return
*/
@GetMapping("/examManagePaperId")
public R<ExamManage> findOnlyPaperId() {
ExamManage res = examManageService.findOnlyPaperId();
if (res != null) {
return ApiResultHandler.buildApiResult(200, "请求成功", res);
}
return ApiResultHandler.buildApiResult(400, "请求失败", res);
}
}

@ -0,0 +1,65 @@
package com.shanzhu.oe.controller;
import com.shanzhu.oe.common.R;
import com.shanzhu.oe.entity.FillQuestion;
import com.shanzhu.oe.service.FillQuestionService;
import com.shanzhu.oe.util.ApiResultHandler;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@RestController
@RequiredArgsConstructor
public class FillQuestionController {
private final FillQuestionService fillQuestionService;
/**
*
*
* @param fillQuestion
* @return
*/
@PostMapping("/fillQuestion")
public R add(@RequestBody FillQuestion fillQuestion) {
int res = fillQuestionService.add(fillQuestion);
if (res != 0) {
return ApiResultHandler.buildApiResult(200, "添加成功", res);
}
return ApiResultHandler.buildApiResult(400, "添加失败", res);
}
/**
*
*
* @return
*/
@GetMapping("/fillQuestionId")
public R<FillQuestion> findOnlyQuestionId() {
FillQuestion res = fillQuestionService.findOnlyQuestionId();
return ApiResultHandler.buildApiResult(200, "查询成功", res);
}
/**
*
*
* @param fillQuestion
* @return
*/
@PostMapping("/editFillQuestion")
public R edit(@RequestBody FillQuestion fillQuestion) {
int res = fillQuestionService.edit(fillQuestion);
if (res != 0) {
return ApiResultHandler.buildApiResult(200, "修改成功", res);
}
return ApiResultHandler.buildApiResult(400, "修改失败", res);
}
}

@ -0,0 +1,97 @@
package com.shanzhu.oe.controller;
import com.shanzhu.oe.common.R;
import com.shanzhu.oe.entity.PaperManage;
import com.shanzhu.oe.service.FillQuestionService;
import com.shanzhu.oe.service.JudgeQuestionService;
import com.shanzhu.oe.service.MultiQuestionService;
import com.shanzhu.oe.service.PaperService;
import com.shanzhu.oe.util.ApiResultHandler;
import com.shanzhu.oe.vo.Item;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@RestController
@RequiredArgsConstructor
public class ItemController {
private final MultiQuestionService multiQuestionService;
private final FillQuestionService fillQuestionService;
private final JudgeQuestionService judgeQuestionService;
private final PaperService paperService;
/**
*
*
* @param item
* @return
*/
@PostMapping("/item")
public R ItemController(@RequestBody Item item) {
// 选择题
Integer changeNumber = item.getChangeNumber();
// 填空题
Integer fillNumber = item.getFillNumber();
// 判断题
Integer judgeNumber = item.getJudgeNumber();
//出卷id
Integer paperId = item.getPaperId();
// 数据库获取数据
List<Integer> changeNumbers = multiQuestionService.findBySubject(item.getSubject(), changeNumber);
List<Integer> fills = fillQuestionService.findBySubject(item.getSubject(), fillNumber);
List<Integer> judges = judgeQuestionService.findBySubject(item.getSubject(), judgeNumber);
if (changeNumbers == null || changeNumbers.size() != changeNumber) {
return ApiResultHandler.buildApiResult(400,
"科目【" + item.getSubject() + "】题库【选择题】题目数量不足【" + changeNumber + "】,组卷失败", null);
}
if (fills == null || fills.size() != fillNumber) {
return ApiResultHandler.buildApiResult(400, "科目【" + item.getSubject() + "】题库【填空题】题目数量不足【" + fillNumber +
"】,组卷失败", null);
}
if (judges == null || judges.size() != judgeNumber) {
return ApiResultHandler.buildApiResult(400,
"科目【" + item.getSubject() + "】题库【判断题】题目数量不足【" + judgeNumber + "】,组卷失败", null);
}
// 符合组题条件,执行组题
// 选择题
for (Integer number : changeNumbers) {
PaperManage paperManage = new PaperManage(paperId, 1, number);
int index = paperService.add(paperManage);
if (index == 0)
return ApiResultHandler.buildApiResult(400, "选择题组卷保存失败", null);
}
// 填空题
for (Integer fillNum : fills) {
PaperManage paperManage = new PaperManage(paperId, 2, fillNum);
int index = paperService.add(paperManage);
if (index == 0)
return ApiResultHandler.buildApiResult(400, "填空题题组卷保存失败", null);
}
// 判断题
for (Integer judge : judges) {
PaperManage paperManage = new PaperManage(paperId, 3, judge);
int index = paperService.add(paperManage);
if (index == 0)
return ApiResultHandler.buildApiResult(400, "判断题题组卷保存失败", null);
}
return ApiResultHandler.buildApiResult(200, "试卷组卷成功", null);
}
}

@ -0,0 +1,65 @@
package com.shanzhu.oe.controller;
import com.shanzhu.oe.common.R;
import com.shanzhu.oe.entity.JudgeQuestion;
import com.shanzhu.oe.service.JudgeQuestionService;
import com.shanzhu.oe.util.ApiResultHandler;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@RestController
@RequiredArgsConstructor
public class JudgeQuestionController {
private final JudgeQuestionService judgeQuestionService;
/**
*
*
* @param judgeQuestion
* @return
*/
@PostMapping("/judgeQuestion")
public R add(@RequestBody JudgeQuestion judgeQuestion) {
int res = judgeQuestionService.add(judgeQuestion);
if (res != 0) {
return ApiResultHandler.buildApiResult(200,"添加成功",res);
}
return ApiResultHandler.buildApiResult(400,"添加失败",res);
}
/**
* id
*
* @return
*/
@GetMapping("/judgeQuestionId")
public R<JudgeQuestion> findOnlyQuestionId() {
JudgeQuestion res = judgeQuestionService.findOnlyQuestionId();
return ApiResultHandler.buildApiResult(200,"查询成功",res);
}
/**
*
*
* @param judgeQuestion
* @return
*/
@PostMapping("/editJudgeQuestion")
public R edit(@RequestBody JudgeQuestion judgeQuestion) {
int res = judgeQuestionService.edit(judgeQuestion);
if (res != 0) {
return ApiResultHandler.buildApiResult(200,"修改成功",res);
}
return ApiResultHandler.buildApiResult(400,"修改失败",res);
}
}

@ -0,0 +1,101 @@
package com.shanzhu.oe.controller;
import com.shanzhu.oe.common.R;
import com.shanzhu.oe.entity.Admin;
import com.shanzhu.oe.entity.Login;
import com.shanzhu.oe.entity.Student;
import com.shanzhu.oe.entity.Teacher;
import com.shanzhu.oe.service.LoginService;
import com.shanzhu.oe.util.ApiResultHandler;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@RestController
@RequiredArgsConstructor
public class LoginController {
private final LoginService loginService;
/**
*
*
* @param login
* @param response http response
* @return
*/
@PostMapping("/login")
public R login(@RequestBody Login login, HttpServletResponse response) {
Integer username = login.getUsername();
String password = login.getPassword();
//登录管理员
Admin adminRes = loginService.adminLogin(username, password);
if (adminRes != null) {
Cookie token = new Cookie("rb_token", adminRes.getCardId());
token.setPath("/");
Cookie role = new Cookie("rb_role", "0");
role.setPath("/");
//将cookie对象加入response响应
response.addCookie(token);
response.addCookie(role);
return ApiResultHandler.buildApiResult(200, "请求成功", adminRes);
}
//登录教师
Teacher teacherRes = loginService.teacherLogin(username, password);
if (teacherRes != null) {
Cookie token = new Cookie("rb_token", teacherRes.getCardId());
token.setPath("/");
Cookie role = new Cookie("rb_role", "1");
role.setPath("/");
response.addCookie(token);
response.addCookie(role);
return ApiResultHandler.buildApiResult(200, "请求成功", teacherRes);
}
//登录选
Student studentRes = loginService.studentLogin(username, password);
if (studentRes != null) {
Cookie token = new Cookie("rb_token", studentRes.getCardId());
token.setPath("/");
Cookie role = new Cookie("rb_role", "2");
role.setPath("/");
response.addCookie(token);
response.addCookie(role);
return ApiResultHandler.buildApiResult(200, "请求成功", studentRes);
}
return ApiResultHandler.buildApiResult(400, "请求失败", null);
}
/**
*
*
* @param response http response
*/
@PostMapping("/logout")
public void logout(HttpServletResponse response) {
//清楚cookie里的token信息
Cookie token = new Cookie("rb_token", null);
token.setPath("/");
token.setMaxAge(0);
Cookie role = new Cookie("rb_role", null);
role.setPath("/");
role.setMaxAge(0);
response.addCookie(token);
response.addCookie(role);
}
}

@ -0,0 +1,77 @@
package com.shanzhu.oe.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shanzhu.oe.common.R;
import com.shanzhu.oe.entity.Message;
import com.shanzhu.oe.service.MessageService;
import com.shanzhu.oe.util.ApiResultHandler;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@RestController
@RequiredArgsConstructor
public class MessageController {
private final MessageService messageService;
/**
*
*
* @param page
* @param size
* @return
*/
@GetMapping("/messages/{page}/{size}")
public R<IPage<Message>> findAll(@PathVariable("page") Integer page, @PathVariable("size") Integer size) {
Page<Message> messagePage = new Page<>(page, size);
IPage<Message> all = messageService.findPage(messagePage);
return ApiResultHandler.buildApiResult(200, "查询所有留言", all);
}
/**
* id
*
* @param id id
* @return
*/
@GetMapping("/message/{id}")
public R<Message> findById(@PathVariable("id") Integer id) {
Message res = messageService.findById(id);
return ApiResultHandler.buildApiResult(200, "根据Id查询", res);
}
/**
*
*
* @param id id
* @return
*/
@DeleteMapping("/message/{id}")
public Integer delete(@PathVariable("id") Integer id) {
return messageService.delete(id);
}
/**
*
*
* @param message
* @return
*/
@PostMapping("/message")
public R<Integer> add(@RequestBody Message message) {
Integer res = messageService.add(message);
if (res == 0) {
return ApiResultHandler.buildApiResult(400, "添加失败", res);
} else {
return ApiResultHandler.buildApiResult(200, "添加成功", res);
}
}
}

@ -0,0 +1,66 @@
package com.shanzhu.oe.controller;
import com.shanzhu.oe.common.R;
import com.shanzhu.oe.entity.MultiQuestion;
import com.shanzhu.oe.service.MultiQuestionService;
import com.shanzhu.oe.util.ApiResultHandler;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@RestController
@RequiredArgsConstructor
public class MultiQuestionController {
private final MultiQuestionService multiQuestionService;
/**
* id
*
* @return
*/
@GetMapping("/multiQuestionId")
public R<MultiQuestion> findOnlyQuestion() {
MultiQuestion res = multiQuestionService.findOnlyQuestionId();
return ApiResultHandler.buildApiResult(200,"查询成功",res);
}
/**
*
*
* @param multiQuestion
* @return
*/
@PostMapping("/MultiQuestion")
public R<Integer> add(@RequestBody MultiQuestion multiQuestion) {
Integer res = multiQuestionService.add(multiQuestion);
if (res != 0) {
return ApiResultHandler.buildApiResult(200,"添加成功",res);
}
return ApiResultHandler.buildApiResult(400,"添加失败",res);
}
/**
*
*
* @param multiQuestion
* @return
*/
@PostMapping("/editMultiQuestion")
public R<Integer> edit(@RequestBody MultiQuestion multiQuestion) {
Integer res = multiQuestionService.edit(multiQuestion);
if (res != 0) {
return ApiResultHandler.buildApiResult(200,"修改成功",res);
}
return ApiResultHandler.buildApiResult(400,"修改失败",res);
}
}

@ -0,0 +1,101 @@
package com.shanzhu.oe.controller;
import com.shanzhu.oe.common.R;
import com.shanzhu.oe.entity.FillQuestion;
import com.shanzhu.oe.entity.JudgeQuestion;
import com.shanzhu.oe.entity.MultiQuestion;
import com.shanzhu.oe.entity.PaperManage;
import com.shanzhu.oe.serviceimpl.FillQuestionServiceImpl;
import com.shanzhu.oe.serviceimpl.JudgeQuestionServiceImpl;
import com.shanzhu.oe.serviceimpl.MultiQuestionServiceImpl;
import com.shanzhu.oe.serviceimpl.PaperServiceImpl;
import com.shanzhu.oe.util.ApiResultHandler;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@RestController
@RequiredArgsConstructor
public class PaperController {
private final PaperServiceImpl paperService;
private final JudgeQuestionServiceImpl judgeQuestionService;
private final MultiQuestionServiceImpl multiQuestionService;
private final FillQuestionServiceImpl fillQuestionService;
/**
*
*
* @return
*/
@GetMapping("/papers")
public R<List<PaperManage>> findAll() {
return ApiResultHandler.buildApiResult(200, "请求成功", paperService.findAll());
}
/**
* id
*
* @param paperId id
* @return
*/
@GetMapping("/paper/{paperId}")
public Map<Integer, List<?>> findById(@PathVariable("paperId") Integer paperId) {
//选择题题库 1
List<MultiQuestion> multiQuestionRes = multiQuestionService.findByIdAndType(paperId);
//填空题题库 2
List<FillQuestion> fillQuestionsRes = fillQuestionService.findByIdAndType(paperId);
//判断题题库 3
List<JudgeQuestion> judgeQuestionRes = judgeQuestionService.findByIdAndType(paperId);
Map<Integer, List<?>> questionMap = new HashMap<>();
questionMap.put(1, multiQuestionRes);
questionMap.put(2, fillQuestionsRes);
questionMap.put(3, judgeQuestionRes);
return questionMap;
}
/**
*
*
* @param paperManage
* @return
*/
@PostMapping("/paperManage")
public R<Integer> add(@RequestBody PaperManage paperManage) {
int res = paperService.add(paperManage);
if (res != 0) {
return ApiResultHandler.buildApiResult(200, "添加成功", res);
}
return ApiResultHandler.buildApiResult(400, "添加失败", res);
}
/**
*
*
* @param paperId id
* @param type 123
* @param questionId id
*/
@GetMapping("/paper/delete/{paperId}/{type}/{questionId}")
public R delete(
@PathVariable("paperId") String paperId,
@PathVariable("type") String type,
@PathVariable("questionId") String questionId
) {
paperService.delete(paperId, type, questionId);
return ApiResultHandler.buildApiResult(200, "删除成功", null);
}
}

@ -0,0 +1,50 @@
package com.shanzhu.oe.controller;
import com.shanzhu.oe.common.R;
import com.shanzhu.oe.entity.Replay;
import com.shanzhu.oe.service.ReplayService;
import com.shanzhu.oe.util.ApiResultHandler;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@RestController
@RequiredArgsConstructor
public class ReplayController {
private final ReplayService replayService;
/**
*
*
* @param replay
* @return
*/
@PostMapping("/replay")
public R add(@RequestBody Replay replay) {
int data = replayService.add(replay);
if (data != 0) {
return ApiResultHandler.buildApiResult(200, "添加成功!", data);
} else {
return ApiResultHandler.buildApiResult(400, "添加失败!", null);
}
}
/**
* id
*
* @param messageId id
* @return
*/
@GetMapping("/replay/{messageId}")
public R<List<Replay>> findAllById(@PathVariable("messageId") Integer messageId) {
return ApiResultHandler.buildApiResult(200, "根据messageId查询", replayService.findAllById(messageId));
}
}

@ -0,0 +1,98 @@
package com.shanzhu.oe.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shanzhu.oe.common.R;
import com.shanzhu.oe.entity.Score;
import com.shanzhu.oe.service.ScoreService;
import com.shanzhu.oe.util.ApiResultHandler;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@RestController
@RequiredArgsConstructor
public class ScoreController {
private final ScoreService scoreService;
/**
*
*
* @return
*/
@GetMapping("/scores")
public R<List<Score>> findAll() {
List<Score> res = scoreService.findAll();
return ApiResultHandler.buildApiResult(200, "查询所有学生成绩", res);
}
/**
*
*
* @param page
* @param size
* @param studentId id
* @return
*/
@GetMapping("/score/{page}/{size}/{studentId}")
public R<Page<Score>> findById(
@PathVariable("page") Integer page,
@PathVariable("size") Integer size,
@PathVariable("studentId") Integer studentId
) {
IPage<Score> res = scoreService.findById(new Page<>(page, size), studentId);
return ApiResultHandler.buildApiResult(200, "根据ID查询成绩", res);
}
/**
*
*
* @param studentId id
* @return
*/
@GetMapping("/score/{studentId}")
public R<List<Score>> findById(@PathVariable("studentId") Integer studentId) {
List<Score> res = scoreService.findById(studentId);
if (!res.isEmpty()) {
return ApiResultHandler.buildApiResult(200, "根据ID查询成绩", res);
} else {
return ApiResultHandler.buildApiResult(400, "ID不存在", res);
}
}
/**
*
*
* @param score
* @return
*/
@PostMapping("/score")
public R add(@RequestBody Score score) {
int res = scoreService.add(score);
if (res == 0) {
return ApiResultHandler.buildApiResult(400, "成绩添加失败", res);
} else {
return ApiResultHandler.buildApiResult(200, "成绩添加成功", res);
}
}
/**
*
*
* @param examCode
* @return
*/
@GetMapping("/scores/{examCode}")
public R<List<Score>> findByExamCode(@PathVariable("examCode") Integer examCode) {
List<Score> scores = scoreService.findByExamCode(examCode);
return ApiResultHandler.buildApiResult(200, "查询成功", scores);
}
}

@ -0,0 +1,124 @@
package com.shanzhu.oe.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shanzhu.oe.common.R;
import com.shanzhu.oe.entity.Student;
import com.shanzhu.oe.service.StudentService;
import com.shanzhu.oe.util.ApiResultHandler;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@RestController
@RequiredArgsConstructor
public class StudentController {
private final StudentService studentService;
/**
*
*
* @param page
* @param size
* @param name
* @param grade
* @param tel
* @param institute
* @param major
* @param clazz
* @return
*/
@GetMapping("/students/{page}/{size}/{name}/{grade}/{tel}/{institute}/{major}/{clazz}")
public R<IPage<Student>> findAll(
@PathVariable Integer page,
@PathVariable Integer size,
@PathVariable String name,
@PathVariable String grade,
@PathVariable String tel,
@PathVariable String institute,
@PathVariable String major,
@PathVariable String clazz
) {
IPage<Student> res = studentService.findAll(
new Page<>(page, size), name, grade, tel, institute, major, clazz
);
return ApiResultHandler.buildApiResult(200, "分页查询所有学生", res);
}
/**
* id
*
* @param studentId id
* @return
*/
@GetMapping("/student/{studentId}")
public R<Student> findById(@PathVariable("studentId") Integer studentId) {
Student res = studentService.findById(studentId);
if (res != null) {
return ApiResultHandler.buildApiResult(200, "请求成功", res);
} else {
return ApiResultHandler.buildApiResult(404, "查询的用户不存在", null);
}
}
/**
*
*
* @param studentId id
* @return
*/
@DeleteMapping("/student/{studentId}")
public R<Integer> deleteById(@PathVariable("studentId") Integer studentId) {
return ApiResultHandler.buildApiResult(200, "删除成功", studentService.deleteById(studentId));
}
/**
*
*
* @param student
* @return
*/
@PutMapping("/student")
public R update(@RequestBody Student student) {
int res = studentService.update(student);
if (res != 0) {
return ApiResultHandler.buildApiResult(200, "更新成功", res);
}
return ApiResultHandler.buildApiResult(400, "更新失败", res);
}
/**
*
*
* @param student
* @return
*/
@PostMapping("/student")
public R add(@RequestBody Student student) {
int res = studentService.add(student);
if (res == 1) {
return ApiResultHandler.buildApiResult(200, "添加成功", null);
} else {
return ApiResultHandler.buildApiResult(400, "添加失败", null);
}
}
/**
*
*
* @param student
* @return
*/
@PutMapping("/studentPWD")
public R updatePwd(@RequestBody Student student) {
studentService.updatePwd(student);
return ApiResultHandler.buildApiResult(200, "密码更新成功", null);
}
}

@ -0,0 +1,82 @@
package com.shanzhu.oe.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shanzhu.oe.common.R;
import com.shanzhu.oe.entity.Teacher;
import com.shanzhu.oe.service.TeacherService;
import com.shanzhu.oe.util.ApiResultHandler;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@RestController
@RequiredArgsConstructor
public class TeacherController {
private final TeacherService teacherService;
/**
*
*
* @param page
* @param size
* @return
*/
@GetMapping("/teachers/{page}/{size}")
public R<IPage<Teacher>> findAll(@PathVariable Integer page, @PathVariable Integer size){
Page<Teacher> teacherPage = new Page<>(page,size);
IPage<Teacher> teacherIPage = teacherService.findAll(teacherPage);
return ApiResultHandler.buildApiResult(200,"查询所有教师",teacherIPage);
}
/**
* id
*
* @param teacherId id
* @return
*/
@GetMapping("/teacher/{teacherId}")
public R findById(@PathVariable("teacherId") Integer teacherId){
return ApiResultHandler.success(teacherService.findById(teacherId));
}
/**
*
*
* @param teacherId id
* @return
*/
@DeleteMapping("/teacher/{teacherId}")
public R deleteById(@PathVariable("teacherId") Integer teacherId){
return ApiResultHandler.success(teacherService.deleteById(teacherId));
}
/**
*
*
* @param teacher
* @return
*/
@PutMapping("/teacher")
public R update(@RequestBody Teacher teacher){
return ApiResultHandler.success(teacherService.update(teacher));
}
/**
*
*
* @param teacher
* @return
*/
@PostMapping("/teacher")
public R add(@RequestBody Teacher teacher){
return ApiResultHandler.success(teacherService.add(teacher));
}
}

@ -0,0 +1,54 @@
package com.shanzhu.oe.entity;
import lombok.Data;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Data
public class Admin {
/**
* id
*/
private Integer adminId;
/**
*
*/
private String adminName;
/**
*
*/
private String sex;
/**
*
*/
private String tel;
/**
*
*/
private String email;
/**
*
*/
private String pwd;
/**
*
*/
private String cardId;
/**
*
*/
private String role;
}

@ -0,0 +1,79 @@
package com.shanzhu.oe.entity;
import lombok.Data;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Data
public class ExamManage {
/**
*
*/
private Integer examCode;
/**
*
*/
private String description;
/**
*
*/
private String source;
/**
*
*/
private Integer paperId;
/**
*
*/
private String examDate;
/**
*
*/
private Integer totalTime;
/**
*
*/
private String grade;
/**
*
*/
private String term;
/**
*
*/
private String major;
/**
*
*/
private String institute;
/**
*
*/
private Integer totalScore;
/**
*
*/
private String type;
/**
*
*/
private String tips;
}

@ -0,0 +1,54 @@
package com.shanzhu.oe.entity;
import lombok.Data;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Data
public class FillQuestion {
/**
*
*/
private Integer questionId;
/**
*
*/
private String subject;
/**
*
*/
private String question;
/**
*
*/
private String answer;
/**
*
*/
private Integer score;
/**
*
*/
private String level;
/**
*
*/
private String section;
/**
*
*/
private String analysis;
}

@ -0,0 +1,54 @@
package com.shanzhu.oe.entity;
import lombok.Data;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Data
public class JudgeQuestion {
/**
*
*/
private Integer questionId;
/**
*
*/
private String subject;
/**
*
*/
private String question;
/**
*
*/
private String answer;
/**
*
*/
private String level;
/**
*
*/
private String section;
/**
*
*/
private Integer score;
/**
*
*/
private String analysis;
}

@ -0,0 +1,24 @@
package com.shanzhu.oe.entity;
import lombok.Data;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Data
public class Login {
/**
* id
*/
private Integer username;
/**
*
*/
private String password;
}

@ -0,0 +1,50 @@
package com.shanzhu.oe.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Data
public class Message {
/**
* id
*/
private Integer id;
/**
* idnullid
*/
private Integer temp_id;
/**
*
*/
private String title;
/**
*
*/
private String content;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd", timezone="GMT+8")
private Date time;
/**
*
*/
List<Replay> replays;
}

@ -0,0 +1,74 @@
package com.shanzhu.oe.entity;
import lombok.Data;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Data
public class MultiQuestion {
/**
*
*/
private Integer questionId;
/**
*
*/
private String subject;
/**
*
*/
private String section;
/**
* A
*/
private String answerA;
/**
* B
*/
private String answerB;
/**
* C
*/
private String answerC;
/**
* D
*/
private String answerD;
/**
*
*/
private String question;
/**
*
*/
private String level;
/**
*
*/
private String rightAnswer;
/**
*
*/
private String analysis;
/**
*
*/
private Integer score;
}

@ -0,0 +1,33 @@
package com.shanzhu.oe.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PaperManage {
/**
* id
*/
private Integer paperId;
/**
*
*/
private Integer questionType;
/**
*
*/
private Integer questionId;
}

@ -0,0 +1,38 @@
package com.shanzhu.oe.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Data
public class Replay {
/**
* id
*/
private Integer messageId;
/**
* id
*/
private Integer replayId;
/**
*
*/
private String replay;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date replayTime;
}

@ -0,0 +1,55 @@
package com.shanzhu.oe.entity;
import lombok.Data;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Data
public class Score {
/**
*
*/
private Integer examCode;
/**
*
*/
private Integer studentId;
/**
*
*/
private String subject;
/**
*
*/
private Integer ptScore;
/**
*
*/
private Integer etScore;
/**
*
*/
private Integer score;
/**
*
*/
private Integer scoreId;
/**
*
*/
private String answerDate;
}

@ -0,0 +1,73 @@
package com.shanzhu.oe.entity;
import lombok.Data;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Data
public class Student {
/**
* id
*/
private Integer studentId;
/**
*
*/
private String studentName;
/**
*
*/
private String grade;
/**
*
*/
private String major;
/**
*
*/
private String clazz;
/**
*
*/
private String institute;
/**
*
*/
private String sex;
/**
*
*/
private String tel;
/**
*
*/
private String email;
/**
*
*/
private String pwd;
/**
*
*/
private String cardId;
/**
*
*/
private String role;
}

@ -0,0 +1,64 @@
package com.shanzhu.oe.entity;
import lombok.Data;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Data
public class Teacher {
/**
* id
*/
private Integer teacherId;
/**
*
*/
private String teacherName;
/**
*
*/
private String institute;
/**
*
*/
private String sex;
/**
*
*/
private String tel;
/**
*
*/
private String email;
/**
*
*/
private String pwd;
/**
*
*/
private String cardId;
/**
*
*/
private String type;
/**
*
*/
private String role;
}

@ -0,0 +1,63 @@
package com.shanzhu.oe.mapper;
import com.shanzhu.oe.entity.Admin;
import org.apache.ibatis.annotations.*;
import java.util.List;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Mapper
public interface AdminMapper {
/**
*
*
* @return
*/
@Select("select adminName,sex,tel,email,cardId,role from admin")
List<Admin> findAll();
/**
* id
*
* @param adminId id
* @return
*/
@Select("select adminId,adminName,sex,tel,email,cardId,role,pwd from admin where adminId = #{adminId}")
Admin findById(Integer adminId);
/**
* id
*
* @param adminId id
* @return
*/
@Delete("delete from admin where adminId = #{adminId}")
Integer deleteById(Integer adminId);
/**
*
*
* @param admin
* @return
*/
@Update("update admin set adminName = #{adminName},sex = #{sex}," +
"tel = #{tel}, email = #{email},pwd = #{pwd},cardId = #{cardId},role = #{role} where adminId = #{adminId}")
Integer update(Admin admin);
/**
*
*
* @param admin
* @return
*/
@Options(useGeneratedKeys = true, keyProperty = "adminId")
@Insert("insert into admin(adminName,sex,tel,email,pwd,cardId,role) " +
"values(#{adminName},#{sex},#{tel},#{email},#{pwd},#{cardId},#{role})")
Integer add(Admin admin);
}

@ -0,0 +1,63 @@
package com.shanzhu.oe.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shanzhu.oe.entity.FillQuestion;
import com.shanzhu.oe.entity.JudgeQuestion;
import com.shanzhu.oe.entity.MultiQuestion;
import com.shanzhu.oe.vo.AnswerVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Mapper
public interface AnswerMapper {
/**
*
*
* @param page
* @param subject
* @param section
* @param question
* @return
*/
@Select("select questionId, question, subject, score, section,level, \"选择题\" as type from multi_question where question like concat('%',#{question},'%') and subject like concat('%',#{subject},'%') and section like concat('%',#{section},'%')" +
"union select questionId,question, subject, score, section,level, \"判断题\" as type from judge_question where question like concat('%',#{question},'%') and subject like concat('%',#{subject},'%') and section like concat('%',#{section},'%')" +
"union select questionId,question, subject, score, section,level, \"填空题\" as type from fill_question where question like concat('%',#{question},'%') and subject like concat('%',#{subject},'%') and section like concat('%',#{section},'%')")
IPage<AnswerVO> findAll(Page<AnswerVO> page, @Param("subject") String subject, @Param("section") String section, @Param("question") String question);
/**
*
*
* @param questionId id
* @return
*/
@Select("select questionId, subject, question, answerA, answerB, answerC, answerD, rightAnswer, section, level, analysis from multi_question where questionId = #{questionId}")
MultiQuestion findMultiQuestionById(Long questionId);
/**
*
*
* @param questionId id
* @return
*/
@Select("select questionId, subject, question, answer, analysis, level, section from fill_question where questionId = #{questionId}")
FillQuestion findFillQuestionById(Long questionId);
/**
*
*
* @param questionId id
* @return
*/
@Select("select questionId, subject, question, answer, analysis, level, section from judge_question where questionId = #{questionId}")
JudgeQuestion findJudgeQuestionById(Long questionId);
}

@ -0,0 +1,57 @@
package com.shanzhu.oe.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shanzhu.oe.entity.ExamManage;
import org.apache.ibatis.annotations.*;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Mapper
public interface ExamManageMapper {
@Select("select * from exam_manage")
IPage<ExamManage> findAll(Page page);
/**
*
*
* @param examCode
* @return
*/
@Select("select * from exam_manage where examCode = #{examCode}")
ExamManage findById(Integer examCode);
/**
*
*
* @param examCode
*/
@Delete("delete from exam_manage where examCode = #{examCode}")
int delete(Integer examCode);
@Update("update exam_manage set description = #{description},source = #{source},paperId = #{paperId}," +
"examDate = #{examDate},totalTime = #{totalTime},grade = #{grade},term = #{term}," +
"major = #{major},institute = #{institute},totalScore = #{totalScore}," +
"type = #{type},tips = #{tips} where examCode = #{examCode}")
int update(ExamManage exammanage);
@Options(useGeneratedKeys = true, keyProperty = "examCode")
@Insert("insert into exam_manage(description,source,paperId,examDate,totalTime,grade,term,major,institute," +
"totalScore,type,tips)" +
" values(#{description},#{source},#{paperId},#{examDate},#{totalTime},#{grade},#{term},#{major}," +
"#{institute},#{totalScore},#{type},#{tips})")
int add(ExamManage exammanage);
/**
* paperId,
*
* @return paperId
*/
@Select("select paperId from exam_manage order by paperId desc limit 1")
ExamManage findOnlyPaperId();
}

@ -0,0 +1,65 @@
package com.shanzhu.oe.mapper;
import com.shanzhu.oe.entity.FillQuestion;
import org.apache.ibatis.annotations.*;
import java.util.List;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Mapper
public interface FillQuestionMapper {
/**
* id
*
* @param paperId id
* @return
*/
@Select("select * from fill_question where questionId in (select questionId from paper_manage where questionType " +
"= 2 and paperId = #{paperId})")
List<FillQuestion> findByIdAndType(Integer paperId);
/**
*
*
* @return
*/
@Select("select questionId from fill_question order by questionId desc limit 1")
FillQuestion findOnlyQuestionId();
/**
*
*
* @param fillQuestion
* @return
*/
@Options(useGeneratedKeys = true, keyProperty = "questionId")
@Insert("insert into fill_question(subject,question,answer,analysis,level,section) values " +
"(#{subject},#{question},#{answer},#{analysis},#{level},#{section})")
Integer add(FillQuestion fillQuestion);
/**
*
*
* @param subject
* @param pageNo
* @return
*/
@Select("select questionId from fill_question where subject = #{subject} order by rand() desc limit #{pageNo}")
List<Integer> findBySubject(@Param("subject") String subject, @Param("pageNo") Integer pageNo);
/**
*
*
* @param fillQuestion
* @return
*/
@Update("update fill_question set section = #{section}, question = #{question}, answer = #{answer}, level = " +
"#{level}, analysis = #{analysis} where questionId = #{questionId}")
Integer edit(FillQuestion fillQuestion);
}

@ -0,0 +1,62 @@
package com.shanzhu.oe.mapper;
import com.shanzhu.oe.entity.JudgeQuestion;
import org.apache.ibatis.annotations.*;
import java.util.List;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Mapper
public interface JudgeQuestionMapper {
/**
* id
*
* @param paperId id
* @return
*/
@Select("select * from judge_question where questionId in (select questionId from paper_manage where questionType = 3 and paperId = #{paperId})")
List<JudgeQuestion> findByIdAndType(Integer paperId);
/**
* id
*
* @return
*/
@Select("select questionId from judge_question order by questionId desc limit 1")
JudgeQuestion findOnlyQuestionId();
/**
*
*
* @param judgeQuestion
* @return
*/
@Insert("insert into judge_question(subject,question,answer,analysis,level,section) values " +
"(#{subject},#{question},#{answer},#{analysis},#{level},#{section})")
int add(JudgeQuestion judgeQuestion);
/**
*
*
* @param subject
* @param pageNo
* @return id
*/
@Select("select questionId from judge_question where subject=#{subject} order by rand() desc limit #{pageNo}")
List<Integer> findBySubject(@Param("subject") String subject, @Param("pageNo") Integer pageNo);
/**
*
*
* @param judgeQuestion
* @return
*/
@Update("update judge_question set subject = #{subject}, question = #{question}, answer = #{answer}, section = #{section}, analysis = #{analysis}, level = #{level} where questionId = #{questionId}")
int edit(JudgeQuestion judgeQuestion);
}

@ -0,0 +1,51 @@
package com.shanzhu.oe.mapper;
import com.shanzhu.oe.entity.Admin;
import com.shanzhu.oe.entity.Student;
import com.shanzhu.oe.entity.Teacher;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Mapper
public interface LoginMapper {
/**
*
*
* @param username
* @param password
* @return
*/
@Select("select adminId,adminName,sex,tel,email,cardId,role from admin where adminId = #{username} and pwd = " +
"#{password}")
Admin adminLogin(@Param("username") Integer username, @Param("password") String password);
/**
*
*
* @param username
* @param password
* @return
*/
@Select("select teacherId,teacherName,institute,sex,tel,email,cardId," +
"type,role from teacher where teacherId = #{username} and pwd = #{password}")
Teacher teacherLogin(@Param("username") Integer username, @Param("password") String password);
/**
*
*
* @param username
* @param password
* @return
*/
@Select("select studentId,studentName,grade,major,clazz,institute,tel," +
"email,cardId,sex,role from student where studentId = #{username} and pwd = #{password}")
Student studentLogin(@Param("username") Integer username, @Param("password") String password);
}

@ -0,0 +1,72 @@
package com.shanzhu.oe.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shanzhu.oe.entity.Message;
import org.apache.ibatis.annotations.*;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Mapper
public interface MessageMapper {
/**
*
*
* @param page
* @return
*/
@Select("select id,id as temp_id,title,content,time from message order by id desc")
@Results({
@Result(property = "replays", column = "temp_id", many = @Many(select = "com.shanzhu.oe.mapper" +
".ReplayMapper.findAllById"))
})
IPage<Message> findAll(Page page);
/**
* id
*
* @param id id
* @return
*/
@Select("select id,title,content,time from message where id = #{id}")
@Results({
@Result(property = "replays", column = "id", many = @Many(select = "com.shanzhu.oe.mapper.ReplayMapper" +
".findAllById"))
})
Message findById(Integer id);
/**
*
*
* @param id id
* @return
*/
@Delete("delete from message where id = #{id}")
Integer delete(Integer id);
/**
*
*
* @param message
* @return
*/
@Update("update message set title = #{title}, content = #{content}, time = #{time} where " +
"id = #{id}")
Integer update(Message message);
/**
*
*
* @param message
* @return
*/
@Options(useGeneratedKeys = true, keyProperty = "id")
@Insert("insert into message(title, content, time) values(#{title},#{content},#{time})")
int add(Message message);
}

@ -0,0 +1,68 @@
package com.shanzhu.oe.mapper;
import com.shanzhu.oe.entity.MultiQuestion;
import org.apache.ibatis.annotations.*;
import java.util.List;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Mapper
public interface MultiQuestionMapper {
/**
* id
*
* @param paperId id
* @return
*/
@Select("select * from multi_question where questionId in (select questionId from paper_manage where questionType" +
" = 1 and paperId = #{paperId})")
List<MultiQuestion> findByIdAndType(Integer paperId);
/**
* id
*
* @return
*/
@Select("select questionId from multi_question order by questionId desc limit 1")
MultiQuestion findOnlyQuestionId();
/**
*
*
* @param multiQuestion
* @return
*/
@Options(useGeneratedKeys = true, keyProperty = "questionId")
@Insert("insert into multi_question(subject,question,answerA,answerB,answerC,answerD,rightAnswer,analysis," +
"section,level) " +
"values(#{subject},#{question},#{answerA},#{answerB},#{answerC},#{answerD},#{rightAnswer},#{analysis}," +
"#{section},#{level})")
Integer add(MultiQuestion multiQuestion);
/**
*
*
* @param subject
* @param pageNo
* @return id
*/
@Select("select questionId from multi_question where subject =#{subject} order by rand() desc limit #{pageNo}")
List<Integer> findBySubject(@Param("subject") String subject, @Param("pageNo") Integer pageNo);
/**
*
*
* @param multiQuestion
* @return
*/
@Update("update multi_question set subject = #{subject}, question = #{question}, answerA = #{answerA}, answerB = " +
"#{answerB}, answerC = #{answerC}, answerD = #{answerD}, rightAnswer = #{rightAnswer}, analysis = " +
"#{analysis}, section = #{section}, level = #{level} where questionId = #{questionId}")
int edit(MultiQuestion multiQuestion);
}

@ -0,0 +1,45 @@
package com.shanzhu.oe.mapper;
import com.shanzhu.oe.entity.PaperManage;
import org.apache.ibatis.annotations.*;
import java.util.List;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Mapper
public interface PaperMapper {
/**
*
*
* @return
*/
@Select("select paperId, questionType,questionId from paper_manage")
List<PaperManage> findAll();
/**
*
*
* @param paperManage
* @return
*/
@Insert("insert into paper_manage(paperId,questionType,questionId) values " +
"(#{paperId},#{questionType},#{questionId})")
Integer add(PaperManage paperManage);
/**
*
*
* @param paperId id
* @param type 123
* @param questionId id
*/
@Delete("delete from paper_manage where paperId = #{paperId} and questionType = #{type} and questionId = " +
"#{questionId}")
void delete(@Param("paperId") String paperId, @Param("type") String type, @Param("questionId") String questionId);
}

@ -0,0 +1,54 @@
package com.shanzhu.oe.mapper;
import com.shanzhu.oe.entity.Replay;
import org.apache.ibatis.annotations.*;
import java.util.List;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Mapper
public interface ReplayMapper {
/**
* id
*
* @param messageId id
* @return
*/
@Select("select messageId,replayId,replay,replayTime from replay where messageId = #{messageId}")
List<Replay> findAllById(Integer messageId);
/**
*
*
* @param replayId id
* @return
*/
@Delete("delete from replay where replayId = #{replayId}")
Integer delete(Integer replayId);
/**
*
*
* @param replay
* @return
*/
@Update("update replay set title = #{title}, replay = #{replay}, replayTime = #{replayTime} where replayId = " +
"#{replayId}")
Integer update(Replay replay);
/**
*
*
* @param replay
* @return
*/
@Options(useGeneratedKeys = true, keyProperty = "replayId")
@Insert("insert into replay(messageId,replay,replayTime) values(#{messageId}, #{replay},#{replayTime})")
int add(Replay replay);
}

@ -0,0 +1,58 @@
package com.shanzhu.oe.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shanzhu.oe.entity.Score;
import org.apache.ibatis.annotations.*;
import java.util.List;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Mapper
public interface ScoreMapper {
/**
*
*
* @param score
* @return
*/
@Options(useGeneratedKeys = true, keyProperty = "scoreId")
@Insert("insert into score(examCode,studentId,subject,ptScore,etScore,score,answerDate) values(#{examCode}," +
"#{studentId},#{subject},#{ptScore},#{etScore},#{score},#{answerDate})")
Integer add(Score score);
/**
*
*
* @return
*/
@Select("select scoreId,examCode,studentId,subject,ptScore,etScore,score,answerDate from score order by scoreId " +
"desc")
List<Score> findAll();
/**
*
*
* @param page
* @param studentId id
* @return
*/
@Select("select scoreId,examCode,studentId,subject,ptScore,etScore,score,answerDate from score where studentId = " +
"#{studentId} order by scoreId asc")
IPage<Score> findById(Page<?> page, @Param("studentId") Integer studentId);
/**
*
*
* @param examCode
* @return
*/
@Select("select max(etScore) as etScore from score where examCode = #{examCode} group by studentId")
List<Score> findByExamCode(Integer examCode);
}

@ -0,0 +1,88 @@
package com.shanzhu.oe.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shanzhu.oe.entity.Student;
import org.apache.ibatis.annotations.*;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Mapper
public interface StudentMapper {
/**
*
*
* @param page
* @param name
* @param grade
* @param tel
* @param institute
* @param major
* @param clazz
* @return
*/
@Select("select * from student where " +
"studentName like concat('%',#{name},'%') " +
"and grade like concat('%',#{grade},'%') " +
"and tel like concat('%',#{tel},'%') " +
"and major like concat('%',#{major},'%') " +
"and institute like concat('%',#{institute},'%') " +
"and clazz like concat('%',#{clazz},'%')")
IPage<Student> findAll(Page page, @Param("name") String name, @Param("grade") String grade,
@Param("tel") String tel, @Param("institute") String institute,
@Param("major")String major, @Param("clazz") String clazz);
/**
* id
*
* @param studentId id
* @return
*/
@Select("select * from student where studentId = #{studentId}")
Student findById(Integer studentId);
/**
*
*
* @param studentId id
* @return
*/
@Delete("delete from student where studentId = #{studentId}")
Integer deleteById(Integer studentId);
/**
*
*
* @param student
* @return
*/
@Update("update student set studentName = #{studentName},grade = #{grade},major = #{major},clazz = #{clazz}," +
"institute = #{institute},tel = #{tel},email = #{email},pwd = #{pwd},cardId = #{cardId},sex = #{sex},role = #{role} " +
"where studentId = #{studentId}")
Integer update(Student student);
/**
*
*
* @param student
* @return
*/
@Options(useGeneratedKeys = true,keyProperty = "studentId")
@Insert("insert into student(studentName,grade,major,clazz,institute,tel,email,pwd,cardId,sex,role) values " +
"(#{studentName},#{grade},#{major},#{clazz},#{institute},#{tel},#{email},#{pwd},#{cardId},#{sex},#{role})")
Integer add(Student student);
/**
*
*
* @param student
* @return
*/
@Update("update student set pwd = #{pwd} where studentId = #{studentId}")
Integer updatePwd(Student student);
}

@ -0,0 +1,65 @@
package com.shanzhu.oe.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shanzhu.oe.entity.Teacher;
import org.apache.ibatis.annotations.*;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Mapper
public interface TeacherMapper {
/**
*
*
* @param page
* @return
*/
@Select("select * from teacher")
IPage<Teacher> findAll(Page page);
/**
* id
*
* @param teacherId id
* @return
*/
@Select("select * from teacher where teacherId = #{teacherId}")
Teacher findById(Integer teacherId);
/**
*
*
* @param teacherId id
* @return
*/
@Delete("delete from teacher where teacherId = #{teacherId}")
Integer deleteById(Integer teacherId);
/**
*
*
* @param teacher
* @return
*/
@Update("update teacher set teacherName = #{teacherName},sex = #{sex}," +
"tel = #{tel}, email = #{email},pwd = #{pwd},cardId = #{cardId}," +
"role = #{role},institute = #{institute},type = #{type} where teacherId = #{teacherId}")
Integer update(Teacher teacher);
/**
*
*
* @param teacher
* @return
*/
@Options(useGeneratedKeys = true, keyProperty = "teacherId")
@Insert("insert into teacher(teacherName,sex,tel,email,pwd,cardId,role,type,institute) " +
"values(#{teacherName},#{sex},#{tel},#{email},#{pwd},#{cardId},#{role},#{type},#{institute})")
Integer add(Teacher teacher);
}

@ -0,0 +1,63 @@
package com.shanzhu.oe.service;
import com.shanzhu.oe.entity.Admin;
import java.util.List;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
public interface AdminService {
/**
*
*
* @return
*/
List<Admin> findAll();
/**
* id
*
* @param adminId id
* @return
*/
Admin findById(Integer adminId);
/**
* id
*
* @param adminId id
* @return
*/
Integer deleteById(Integer adminId);
/**
*
*
* @param admin
* @return
*/
Integer update(Admin admin);
/**
*
*
* @param admin
* @return
*/
Integer add(Admin admin);
/**
*
*
* @param adminId id
* @param newPsw
* @param oldPsw
* @return
*/
Object resetPsw(Integer adminId, String newPsw, String oldPsw);
}

@ -0,0 +1,35 @@
package com.shanzhu.oe.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shanzhu.oe.vo.AnswerVO;
import com.shanzhu.oe.vo.QuestionVO;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
public interface AnswerService {
/**
*
*
* @param page
* @param subject
* @param section
* @param question
* @return
*/
IPage<AnswerVO> findAll(Page<AnswerVO> page, String subject, String section, String question);
/**
* id
*
* @param type
* @param questionId id
* @return
*/
QuestionVO findByIdAndType(String type, Long questionId);
}

@ -0,0 +1,69 @@
package com.shanzhu.oe.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shanzhu.oe.entity.ExamManage;
import java.util.List;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
public interface ExamManageService {
/**
*
*
* @return
*/
List<ExamManage> findAll();
/**
*
*
* @param page
* @return
*/
IPage<ExamManage> findAll(Page<ExamManage> page);
/**
*
*
* @param examCode
* @return
*/
ExamManage findById(Integer examCode);
/**
*
*
* @param examCode
*/
Integer delete(Integer examCode);
/**
*
*
* @param examManage
*/
Integer update(ExamManage examManage);
/**
*
*
* @param examManage
*/
Integer add(ExamManage examManage);
/**
* paperId,
*
* @return
*/
ExamManage findOnlyPaperId();
}

@ -0,0 +1,55 @@
package com.shanzhu.oe.service;
import com.shanzhu.oe.entity.FillQuestion;
import java.util.List;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
public interface FillQuestionService {
/**
* id
*
* @param paperId id
* @return
*/
List<FillQuestion> findByIdAndType(Integer paperId);
/**
*
*
* @return
*/
FillQuestion findOnlyQuestionId();
/**
*
*
* @param fillQuestion
* @return
*/
Integer add(FillQuestion fillQuestion);
/**
*
*
* @param subject
* @param pageNo
* @return
*/
List<Integer> findBySubject(String subject,Integer pageNo);
/**
*
*
* @param fillQuestion
* @return
*/
Integer edit(FillQuestion fillQuestion);
}

@ -0,0 +1,54 @@
package com.shanzhu.oe.service;
import com.shanzhu.oe.entity.JudgeQuestion;
import java.util.List;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
public interface JudgeQuestionService {
/**
* id
*
* @param paperId id
* @return
*/
List<JudgeQuestion> findByIdAndType(Integer paperId);
/**
* id
*
* @return
*/
JudgeQuestion findOnlyQuestionId();
/**
*
*
* @param judgeQuestion
* @return
*/
Integer add(JudgeQuestion judgeQuestion);
/**
*
*
* @param subject
* @param pageNo
* @return id
*/
List<Integer> findBySubject(String subject,Integer pageNo);
/**
*
*
* @param judgeQuestion
* @return
*/
Integer edit(JudgeQuestion judgeQuestion);
}

@ -0,0 +1,41 @@
package com.shanzhu.oe.service;
import com.shanzhu.oe.entity.Admin;
import com.shanzhu.oe.entity.Student;
import com.shanzhu.oe.entity.Teacher;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
public interface LoginService {
/**
*
*
* @param username
* @param password
* @return
*/
Admin adminLogin(Integer username, String password);
/**
*
*
* @param username
* @param password
* @return
*/
Teacher teacherLogin(Integer username, String password);
/**
*
*
* @param username
* @param password
* @return
*/
Student studentLogin(Integer username, String password);
}

@ -0,0 +1,55 @@
package com.shanzhu.oe.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shanzhu.oe.entity.Message;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
public interface MessageService {
/**
*
*
* @param page
* @return
*/
IPage<Message> findPage(Page page);
/**
* id
*
* @param id id
* @return
*/
Message findById(Integer id);
/**
*
*
* @param id id
* @return
*/
Integer delete(Integer id);
/**
*
*
* @param message
* @return
*/
Integer update(Message message);
/**
*
*
* @param message
* @return
*/
Integer add(Message message);
}

@ -0,0 +1,54 @@
package com.shanzhu.oe.service;
import com.shanzhu.oe.entity.MultiQuestion;
import java.util.List;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
public interface MultiQuestionService {
/**
* id
*
* @param paperId id
* @return
*/
List<MultiQuestion> findByIdAndType(Integer paperId);
/**
* id
*
* @return
*/
MultiQuestion findOnlyQuestionId();
/**
*
*
* @param multiQuestion
* @return
*/
Integer add(MultiQuestion multiQuestion);
/**
*
*
* @param subject
* @param pageNo
* @return id
*/
List<Integer> findBySubject(String subject,Integer pageNo);
/**
*
*
* @param multiQuestion
* @return
*/
Integer edit(MultiQuestion multiQuestion);
}

@ -0,0 +1,46 @@
package com.shanzhu.oe.service;
import com.shanzhu.oe.entity.PaperManage;
import java.util.List;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
public interface PaperService {
/**
*
*
* @return
*/
List<PaperManage> findAll();
/**
*
*
* @param paperManage
* @return
*/
Integer add(PaperManage paperManage);
/**
*
*
* @param paperId id
* @return
*/
Integer getMaxScore(Integer paperId);
/**
*
*
* @param paperId id
* @param type 123
* @param questionId id
*/
void delete(String paperId, String type, String questionId);
}

@ -0,0 +1,46 @@
package com.shanzhu.oe.service;
import com.shanzhu.oe.entity.Replay;
import java.util.List;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
public interface ReplayService {
/**
* id
*
* @param messageId id
* @return
*/
List<Replay> findAllById(Integer messageId);
/**
*
*
* @param replayId id
* @return
*/
Integer delete(Integer replayId);
/**
*
*
* @param replay
* @return
*/
Integer update(Replay replay);
/**
*
*
* @param replay
* @return
*/
Integer add(Replay replay);
}

@ -0,0 +1,56 @@
package com.shanzhu.oe.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shanzhu.oe.entity.Score;
import java.util.List;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
public interface ScoreService {
/**
*
*
* @param score
* @return
*/
Integer add(Score score);
/**
*
*
* @return
*/
List<Score> findAll();
/**
*
*
* @param page
* @param studentId id
* @return
*/
IPage<Score> findById(Page page, Integer studentId);
/**
*
*
* @param studentId id
* @return
*/
List<Score> findById(Integer studentId);
/**
*
*
* @param examCode
* @return
*/
List<Score> findByExamCode(Integer examCode);
}

@ -0,0 +1,72 @@
package com.shanzhu.oe.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shanzhu.oe.entity.Student;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
public interface StudentService {
/**
*
*
* @param page
* @param name
* @param grade
* @param tel
* @param institute
* @param major
* @param clazz
* @return
*/
IPage<Student> findAll(
Page<Student> page, String name,
String grade, String tel,
String institute, String major, String clazz
);
/**
* id
*
* @param studentId id
* @return
*/
Student findById(Integer studentId);
/**
*
*
* @param studentId id
* @return
*/
Integer deleteById(Integer studentId);
/**
*
*
* @param student
* @return
*/
Integer update(Student student);
/**
*
*
* @param student
* @return
*/
Integer add(Student student);
/**
*
*
* @param student
* @return
*/
Integer updatePwd(Student student);
}

@ -0,0 +1,58 @@
package com.shanzhu.oe.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shanzhu.oe.entity.Teacher;
import java.util.List;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
public interface TeacherService {
/**
*
*
* @param page
* @return
*/
IPage<Teacher> findAll(Page<Teacher> page);
List<Teacher> findAll();
/**
* id
*
* @param teacherId id
* @return
*/
Teacher findById(Integer teacherId);
/**
*
*
* @param teacherId id
* @return
*/
Integer deleteById(Integer teacherId);
/**
*
*
* @param teacher
* @return
*/
Integer update(Teacher teacher);
/**
*
*
* @param teacher
* @return
*/
Integer add(Teacher teacher);
}

@ -0,0 +1,98 @@
package com.shanzhu.oe.serviceimpl;
import com.shanzhu.oe.entity.Admin;
import com.shanzhu.oe.mapper.AdminMapper;
import com.shanzhu.oe.service.AdminService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Service
@RequiredArgsConstructor
public class AdminServiceImpl implements AdminService {
private final AdminMapper adminMapper;
/**
*
*
* @return
*/
@Override
public List<Admin> findAll() {
return adminMapper.findAll();
}
/**
* id
*
* @param adminId id
* @return
*/
@Override
public Admin findById(Integer adminId) {
return adminMapper.findById(adminId);
}
/**
* id
*
* @param adminId id
* @return
*/
@Override
public Integer deleteById(Integer adminId) {
return adminMapper.deleteById(adminId);
}
/**
*
*
* @param admin
* @return
*/
@Override
public Integer update(Admin admin) {
return adminMapper.update(admin);
}
/**
*
*
* @param admin
* @return
*/
@Override
public Integer add(Admin admin) {
return adminMapper.add(admin);
}
/**
*
*
* @param adminId id
* @param newPsw
* @param oldPsw
* @return
*/
@Override
public Object resetPsw(Integer adminId, String newPsw, String oldPsw) {
Admin admin = findById(adminId);
if(!admin.getPwd().equals(oldPsw)) {
return "原密码错误";
}
admin.setPwd(String.valueOf(newPsw));
update(admin);
return Boolean.TRUE;
}
}

@ -0,0 +1,65 @@
package com.shanzhu.oe.serviceimpl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shanzhu.oe.mapper.AnswerMapper;
import com.shanzhu.oe.service.AnswerService;
import com.shanzhu.oe.vo.AnswerVO;
import com.shanzhu.oe.vo.QuestionVO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Service
@RequiredArgsConstructor
public class AnswerServiceImpl implements AnswerService {
private final AnswerMapper answerMapper;
/**
*
*
* @param page
* @param subject
* @param section
* @param question
* @return
*/
@Override
public IPage<AnswerVO> findAll(Page<AnswerVO> page, String subject, String section, String question) {
subject = (subject.equals("@") ? "" : subject);
section = (section.equals("@") ? "" : section);
question = (question.equals("@") ? "" : question);
return answerMapper.findAll(page, subject, section, question);
}
/**
* id
*
* @param type
* @param questionId id
* @return
*/
@Override
public QuestionVO findByIdAndType(String type, Long questionId) {
QuestionVO questionVO = new QuestionVO();
questionVO.setType(type);
switch (type) {
case "选择题":
questionVO.setMultiQuestion(answerMapper.findMultiQuestionById(questionId));
break;
case "判断题":
questionVO.setJudgeQuestion(answerMapper.findJudgeQuestionById(questionId));
break;
case "填空题":
questionVO.setFillQuestion(answerMapper.findFillQuestionById(questionId));
break;
}
return questionVO;
}
}

@ -0,0 +1,117 @@
package com.shanzhu.oe.serviceimpl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shanzhu.oe.entity.ExamManage;
import com.shanzhu.oe.mapper.ExamManageMapper;
import com.shanzhu.oe.service.ExamManageService;
import com.shanzhu.oe.service.PaperService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Service
@RequiredArgsConstructor
public class ExamManageServiceImpl implements ExamManageService {
private final ExamManageMapper examManageMapper;
private final PaperService paperService;
/**
*
*
* @return
*/
@Override
public List<ExamManage> findAll() {
Page<ExamManage> examManage = new Page<>(0, 9999);
List<ExamManage> examManageList = examManageMapper.findAll(examManage).getRecords();
setMaxScore(examManageList);
return examManageList;
}
/**
*
*
* @param page
* @return
*/
@Override
public IPage<ExamManage> findAll(Page<ExamManage> page) {
IPage<ExamManage> iPage = examManageMapper.findAll(page);
setMaxScore(iPage.getRecords());
return iPage;
}
/**
*
*
* @param examCode
* @return
*/
@Override
public ExamManage findById(Integer examCode) {
ExamManage examManage = examManageMapper.findById(examCode);
examManage.setTotalScore(paperService.getMaxScore(examManage.getPaperId()));
return examManage;
}
/**
*
*
* @param examCode
*/
@Override
public Integer delete(Integer examCode) {
return examManageMapper.delete(examCode);
}
/**
*
*
* @param examManage
*/
@Override
public Integer update(ExamManage examManage) {
return examManageMapper.update(examManage);
}
/**
*
*
* @param examManage
*/
@Override
public Integer add(ExamManage examManage) {
return examManageMapper.add(examManage);
}
/**
* paperId,
*
* @return
*/
@Override
public ExamManage findOnlyPaperId() {
return examManageMapper.findOnlyPaperId();
}
/**
*
*
* @param examManageList
*/
private void setMaxScore(List<ExamManage> examManageList) {
for (ExamManage examManage : examManageList) {
examManage.setTotalScore(paperService.getMaxScore(examManage.getPaperId()));
}
}
}

@ -0,0 +1,77 @@
package com.shanzhu.oe.serviceimpl;
import com.shanzhu.oe.entity.FillQuestion;
import com.shanzhu.oe.mapper.FillQuestionMapper;
import com.shanzhu.oe.service.FillQuestionService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Service
@RequiredArgsConstructor
public class FillQuestionServiceImpl implements FillQuestionService {
private final FillQuestionMapper fillQuestionMapper;
/**
* id
*
* @param paperId id
* @return
*/
@Override
public List<FillQuestion> findByIdAndType(Integer paperId) {
return fillQuestionMapper.findByIdAndType(paperId);
}
/**
*
*
* @return
*/
@Override
public FillQuestion findOnlyQuestionId() {
return fillQuestionMapper.findOnlyQuestionId();
}
/**
*
*
* @param fillQuestion
* @return
*/
@Override
public Integer add(FillQuestion fillQuestion) {
return fillQuestionMapper.add(fillQuestion);
}
/**
*
*
* @param subject
* @param pageNo
* @return
*/
@Override
public List<Integer> findBySubject(String subject, Integer pageNo) {
return fillQuestionMapper.findBySubject(subject,pageNo);
}
/**
*
*
* @param fillQuestion
* @return
*/
@Override
public Integer edit(FillQuestion fillQuestion) {
return fillQuestionMapper.edit(fillQuestion);
}
}

@ -0,0 +1,77 @@
package com.shanzhu.oe.serviceimpl;
import com.shanzhu.oe.entity.JudgeQuestion;
import com.shanzhu.oe.mapper.JudgeQuestionMapper;
import com.shanzhu.oe.service.JudgeQuestionService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Service
@RequiredArgsConstructor
public class JudgeQuestionServiceImpl implements JudgeQuestionService {
private final JudgeQuestionMapper judgeQuestionMapper;
/**
* id
*
* @param paperId id
* @return
*/
@Override
public List<JudgeQuestion> findByIdAndType(Integer paperId) {
return judgeQuestionMapper.findByIdAndType(paperId);
}
/**
* id
*
* @return
*/
@Override
public JudgeQuestion findOnlyQuestionId() {
return judgeQuestionMapper.findOnlyQuestionId();
}
/**
*
*
* @param judgeQuestion
* @return
*/
@Override
public Integer add(JudgeQuestion judgeQuestion) {
return judgeQuestionMapper.add(judgeQuestion);
}
/**
*
*
* @param subject
* @param pageNo
* @return id
*/
@Override
public List<Integer> findBySubject(String subject, Integer pageNo) {
return judgeQuestionMapper.findBySubject(subject,pageNo);
}
/**
*
*
* @param judgeQuestion
* @return
*/
@Override
public Integer edit(JudgeQuestion judgeQuestion) {
return judgeQuestionMapper.edit(judgeQuestion);
}
}

@ -0,0 +1,58 @@
package com.shanzhu.oe.serviceimpl;
import com.shanzhu.oe.entity.Admin;
import com.shanzhu.oe.entity.Student;
import com.shanzhu.oe.entity.Teacher;
import com.shanzhu.oe.mapper.LoginMapper;
import com.shanzhu.oe.service.LoginService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Service
@RequiredArgsConstructor
public class LoginServiceImpl implements LoginService {
private final LoginMapper loginMapper;
/**
*
*
* @param username
* @param password
* @return
*/
@Override
public Admin adminLogin(Integer username, String password) {
return loginMapper.adminLogin(username,password);
}
/**
*
*
* @param username
* @param password
* @return
*/
@Override
public Teacher teacherLogin(Integer username, String password) {
return loginMapper.teacherLogin(username,password);
}
/**
*
*
* @param username
* @param password
* @return
*/
@Override
public Student studentLogin(Integer username, String password) {
return loginMapper.studentLogin(username,password);
}
}

@ -0,0 +1,78 @@
package com.shanzhu.oe.serviceimpl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shanzhu.oe.entity.Message;
import com.shanzhu.oe.mapper.MessageMapper;
import com.shanzhu.oe.service.MessageService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Service
@RequiredArgsConstructor
public class MessageServiceImpl implements MessageService {
private final MessageMapper messageMapper;
/**
*
*
* @param page
* @return
*/
@Override
public IPage<Message> findPage(Page page) {
return messageMapper.findAll(page);
}
/**
* id
*
* @param id id
* @return
*/
@Override
public Message findById(Integer id) {
return messageMapper.findById(id);
}
/**
*
*
* @param id id
* @return
*/
@Override
public Integer delete(Integer id) {
return messageMapper.delete(id);
}
/**
*
*
* @param message
* @return
*/
@Override
public Integer update(Message message) {
return messageMapper.update(message);
}
/**
*
*
* @param message
* @return
*/
@Override
public Integer add(Message message) {
return messageMapper.add(message);
}
}

@ -0,0 +1,77 @@
package com.shanzhu.oe.serviceimpl;
import com.shanzhu.oe.entity.MultiQuestion;
import com.shanzhu.oe.mapper.MultiQuestionMapper;
import com.shanzhu.oe.service.MultiQuestionService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Service
@RequiredArgsConstructor
public class MultiQuestionServiceImpl implements MultiQuestionService {
private final MultiQuestionMapper multiQuestionMapper;
/**
* id
*
* @param paperId id
* @return
*/
@Override
public List<MultiQuestion> findByIdAndType(Integer paperId) {
return multiQuestionMapper.findByIdAndType(paperId);
}
/**
* id
*
* @return
*/
@Override
public MultiQuestion findOnlyQuestionId() {
return multiQuestionMapper.findOnlyQuestionId();
}
/**
*
*
* @param multiQuestion
* @return
*/
@Override
public Integer add(MultiQuestion multiQuestion) {
return multiQuestionMapper.add(multiQuestion);
}
/**
*
*
* @param subject
* @param pageNo
* @return id
*/
@Override
public List<Integer> findBySubject(String subject, Integer pageNo) {
return multiQuestionMapper.findBySubject(subject,pageNo);
}
/**
*
*
* @param multiQuestion
* @return
*/
@Override
public Integer edit(MultiQuestion multiQuestion) {
return multiQuestionMapper.edit(multiQuestion);
}
}

@ -0,0 +1,80 @@
package com.shanzhu.oe.serviceimpl;
import com.shanzhu.oe.entity.FillQuestion;
import com.shanzhu.oe.entity.JudgeQuestion;
import com.shanzhu.oe.entity.MultiQuestion;
import com.shanzhu.oe.entity.PaperManage;
import com.shanzhu.oe.mapper.PaperMapper;
import com.shanzhu.oe.service.PaperService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Service
@RequiredArgsConstructor
public class PaperServiceImpl implements PaperService {
private final PaperMapper paperMapper;
private final JudgeQuestionServiceImpl judgeQuestionService;
private final MultiQuestionServiceImpl multiQuestionService;
private final FillQuestionServiceImpl fillQuestionService;
/**
*
*
* @return
*/
@Override
public List<PaperManage> findAll() {
return paperMapper.findAll();
}
/**
*
*
* @param paperManage
* @return
*/
@Override
public Integer add(PaperManage paperManage) {
return paperMapper.add(paperManage);
}
/**
*
*
* @param paperId id
* @return
*/
@Override
public Integer getMaxScore(Integer paperId) {
List<MultiQuestion> multiQuestionRes = multiQuestionService.findByIdAndType(paperId); //选择题题库 1
List<FillQuestion> fillQuestionsRes = fillQuestionService.findByIdAndType(paperId); //填空题题库 2
List<JudgeQuestion> judgeQuestionRes = judgeQuestionService.findByIdAndType(paperId); //判断题题库 3
return 2 * (multiQuestionRes.size() + fillQuestionsRes.size() + judgeQuestionRes.size());
}
/**
*
*
* @param paperId id
* @param type 123
* @param questionId id
*/
@Override
public void delete(String paperId, String type, String questionId) {
paperMapper.delete(paperId, type, questionId);
}
}

@ -0,0 +1,66 @@
package com.shanzhu.oe.serviceimpl;
import com.shanzhu.oe.entity.Replay;
import com.shanzhu.oe.mapper.ReplayMapper;
import com.shanzhu.oe.service.ReplayService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Service
@RequiredArgsConstructor
public class ReplayServiceImpl implements ReplayService {
private final ReplayMapper replayMapper;
/**
* id
*
* @param messageId id
* @return
*/
@Override
public List<Replay> findAllById(Integer messageId) {
return replayMapper.findAllById(messageId);
}
/**
*
*
* @param replayId id
* @return
*/
@Override
public Integer delete(Integer replayId) {
return replayMapper.delete(replayId);
}
/**
*
*
* @param replay
* @return
*/
@Override
public Integer update(Replay replay) {
return replayMapper.update(replay);
}
/**
*
*
* @param replay
* @return
*/
@Override
public Integer add(Replay replay) {
return replayMapper.add(replay);
}
}

@ -0,0 +1,80 @@
package com.shanzhu.oe.serviceimpl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shanzhu.oe.entity.Score;
import com.shanzhu.oe.mapper.ScoreMapper;
import com.shanzhu.oe.service.ScoreService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Service
@RequiredArgsConstructor
public class ScoreServiceImpl implements ScoreService {
private final ScoreMapper scoreMapper;
/**
*
*
* @param score
* @return
*/
@Override
public Integer add(Score score) {
return scoreMapper.add(score);
}
/**
*
*
* @return
*/
@Override
public List<Score> findAll() {
return scoreMapper.findAll();
}
/**
*
*
* @param page
* @param studentId id
* @return
*/
@Override
public IPage<Score> findById(Page page, Integer studentId) {
return scoreMapper.findById(page, studentId);
}
/**
*
*
* @param studentId id
* @return
*/
@Override
public List<Score> findById(Integer studentId) {
Page<Score> scorePage = new Page<>(0, 9999);
return scoreMapper.findById(scorePage, studentId).getRecords();
}
/**
*
*
* @param examCode
* @return
*/
@Override
public List<Score> findByExamCode(Integer examCode) {
return scoreMapper.findByExamCode(examCode);
}
}

@ -0,0 +1,103 @@
package com.shanzhu.oe.serviceimpl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shanzhu.oe.entity.Student;
import com.shanzhu.oe.mapper.StudentMapper;
import com.shanzhu.oe.service.StudentService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Service
@RequiredArgsConstructor
public class StudentServiceImpl implements StudentService {
private final StudentMapper studentMapper;
/**
*
*
* @param page
* @param name
* @param grade
* @param tel
* @param institute
* @param major
* @param clazz
* @return
*/
@Override
public IPage<Student> findAll(
Page<Student> page, String name, String grade,
String tel, String institute, String major, String clazz
) {
name = ("@".equals(name) ? "" : name);
grade = ("@".equals(grade) ? "" : grade);
tel = ("@".equals(tel) ? "" : tel);
institute = ("@".equals(institute) ? "" : institute);
major = ("@".equals(major) ? "" : major);
clazz = ("@".equals(clazz) ? "" : clazz);
return studentMapper.findAll(page, name, grade, tel, institute, major, clazz);
}
/**
* id
*
* @param studentId id
* @return
*/
@Override
public Student findById(Integer studentId) {
return studentMapper.findById(studentId);
}
/**
*
*
* @param studentId id
* @return
*/
@Override
public Integer deleteById(Integer studentId) {
return studentMapper.deleteById(studentId);
}
/**
*
*
* @param student
* @return
*/
@Override
public Integer update(Student student) {
return studentMapper.update(student);
}
/**
*
*
* @param student
* @return
*/
@Override
public Integer add(Student student) {
return studentMapper.add(student);
}
/**
*
*
* @param student
* @return
*/
@Override
public Integer updatePwd(Student student) {
return studentMapper.updatePwd(student);
}
}

@ -0,0 +1,86 @@
package com.shanzhu.oe.serviceimpl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shanzhu.oe.entity.Teacher;
import com.shanzhu.oe.mapper.TeacherMapper;
import com.shanzhu.oe.service.TeacherService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Service
@RequiredArgsConstructor
public class TeacherServiceImpl implements TeacherService {
private final TeacherMapper teacherMapper;
/**
*
*
* @param page
* @return
*/
@Override
public IPage<Teacher> findAll(Page<Teacher> page) {
return teacherMapper.findAll(page);
}
@Override
public List<Teacher> findAll() {
Page<Teacher> teacherPage = new Page<>(0,9999);
return teacherMapper.findAll(teacherPage).getRecords();
}
/**
* id
*
* @param teacherId id
* @return
*/
@Override
public Teacher findById(Integer teacherId) {
return teacherMapper.findById(teacherId);
}
/**
*
*
* @param teacherId id
* @return
*/
@Override
public Integer deleteById(Integer teacherId) {
return teacherMapper.deleteById(teacherId);
}
/**
*
*
* @param teacher
* @return
*/
@Override
public Integer update(Teacher teacher) {
return teacherMapper.update(teacher);
}
/**
*
*
* @param teacher
* @return
*/
@Override
public Integer add(Teacher teacher) {
teacher.setRole("1");
return teacherMapper.add(teacher);
}
}

@ -0,0 +1,33 @@
package com.shanzhu.oe.util;
import com.shanzhu.oe.common.R;
/**
* {@link R}
*
* @author: ShanZhu
* @date: 2023-11-20
*/
public class ApiResultHandler {
public static R success(Object object) {
R r = new R();
r.setData(object);
r.setCode(200);
r.setMessage("请求成功");
return r;
}
public static R success() {
return success(null);
}
public static <T> R buildApiResult(Integer code, String message, T data) {
R r = new R();
r.setCode(code);
r.setMessage(message);
r.setData(data);
return r;
}
}

@ -0,0 +1,51 @@
package com.shanzhu.oe.vo;
import lombok.Data;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Data
public class AnswerVO {
/**
* id
*/
private Long questionId;
/**
*
*/
private String question;
/**
*
*/
private String subject;
/**
*
*/
private String score;
/**
*
*/
private String section;
/**
*
*/
private String level;
/**
*
*/
private String type;
}

@ -0,0 +1,39 @@
package com.shanzhu.oe.vo;
import lombok.Data;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Data
public class Item {
/**
*
*/
private String subject;
/**
*
*/
private Integer paperId;
/**
*
*/
private Integer changeNumber;
/**
*
*/
private Integer fillNumber;
/**
*
*/
private Integer judgeNumber;
}

@ -0,0 +1,37 @@
package com.shanzhu.oe.vo;
import com.shanzhu.oe.entity.FillQuestion;
import com.shanzhu.oe.entity.JudgeQuestion;
import com.shanzhu.oe.entity.MultiQuestion;
import lombok.Data;
/**
*
*
* @author: ShanZhu
* @date: 2023-11-20
*/
@Data
public class QuestionVO {
/**
*
*/
private String type;
/**
*
*/
private FillQuestion fillQuestion;
/**
*
*/
private JudgeQuestion judgeQuestion;
/**
*
*/
private MultiQuestion multiQuestion;
}

@ -0,0 +1,31 @@
# YML是一种文件格式全称为YAMLYAML Ain't Markup LanguageSpringBoot通常使用YML作为项目配置。
# 它是一种人类可读的、简洁明了的数据序列化格式。YAML文件格式通常用于配置文件、数据交换、消息传递和其他应用程序。
# 可以通过文本编辑器进行编辑也可以通过程序进行解析。YML文件格式是一种以层级缩进的方式表示程序数据结构的格式。
# 在数据表示方面比XML等格式更加简洁清晰易读。YML文件格式通常以“.yml”为扩展名。
# 服务端口
server:
port: 8087
# Spring配置
spring:
# 数据库配置
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
# url: jdbc:mysql://localhost:3306/DB_OnlineExam?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
# username: root
# password: 12345678
# 线上库
url: jdbc:mysql://124.223.95.146:3306/DB_OnlineExam?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
username: root
password: f048fac128243533
#mybatis配置
mybatis:
configuration:
mapUnderscoreToCamelCase: true
#mybatis-plus配置
mybatis-plus:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

@ -0,0 +1,8 @@
████████ ██ ████████ ██
██░░░░░░ ░██ ░░░░░░██ ░██
░██ ░██ ██████ ███████ ██ ░██ ██ ██
░█████████░██████ ░░░░░░██ ░░██░░░██ ██ ░██████ ░██ ░██
░░░░░░░░██░██░░░██ ███████ ░██ ░██ ██ ░██░░░██░██ ░██
░██░██ ░██ ██░░░░██ ░██ ░██ ██ ░██ ░██░██ ░██
████████ ░██ ░██░░████████ ███ ░██ ████████░██ ░██░░██████
░░░░░░░░ ░░ ░░ ░░░░░░░░ ░░░ ░░ ░░░░░░░░ ░░ ░░ ░░░░░░

@ -0,0 +1,12 @@
{
"presets": [
["env", {
"modules": false,
"targets": {
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
}
}],
"stage-2"
],
"plugins": ["transform-vue-jsx", "transform-runtime"]
}

@ -0,0 +1,9 @@
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

@ -0,0 +1,25 @@
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files`
`
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

@ -0,0 +1 @@
registry=https://registry.npm.taobao.org/

@ -0,0 +1,10 @@
// https://github.com/michael-ciniawsky/postcss-load-config
module.exports = {
"plugins": {
"postcss-import": {},
"postcss-url": {},
// to edit target browsers: use "browserslist" field in package.json
"autoprefixer": {}
}
}

@ -0,0 +1,12 @@
# 项目介绍及启动说明
### 启动项目
``` bash
# 切换镜像
npm config set registry https://registry.npm.taobao.org
# 安装依赖对应node的版本是16.13.2
npm install --force
# 启动项目
npm run dev

@ -0,0 +1,41 @@
'use strict'
require('./check-versions')()
process.env.NODE_ENV = 'production'
const ora = require('ora')
const rm = require('rimraf')
const path = require('path')
const chalk = require('chalk')
const webpack = require('webpack')
const config = require('../config')
const webpackConfig = require('./webpack.prod.conf')
const spinner = ora('building for production...')
spinner.start()
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
if (err) throw err
webpack(webpackConfig, (err, stats) => {
spinner.stop()
if (err) throw err
process.stdout.write(stats.toString({
colors: true,
modules: false,
children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
chunks: false,
chunkModules: false
}) + '\n\n')
if (stats.hasErrors()) {
console.log(chalk.red(' Build failed with errors.\n'))
process.exit(1)
}
console.log(chalk.cyan(' Build complete.\n'))
console.log(chalk.yellow(
' Tip: built files are meant to be served over an HTTP server.\n' +
' Opening index.html over file:// won\'t work.\n'
))
})
})

@ -0,0 +1,54 @@
'use strict'
const chalk = require('chalk')
const semver = require('semver')
const packageConfig = require('../package.json')
const shell = require('shelljs')
function exec (cmd) {
return require('child_process').execSync(cmd).toString().trim()
}
const versionRequirements = [
{
name: 'node',
currentVersion: semver.clean(process.version),
versionRequirement: packageConfig.engines.node
}
]
if (shell.which('npm')) {
versionRequirements.push({
name: 'npm',
currentVersion: exec('npm --version'),
versionRequirement: packageConfig.engines.npm
})
}
module.exports = function () {
const warnings = []
for (let i = 0; i < versionRequirements.length; i++) {
const mod = versionRequirements[i]
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
warnings.push(mod.name + ': ' +
chalk.red(mod.currentVersion) + ' should be ' +
chalk.green(mod.versionRequirement)
)
}
}
if (warnings.length) {
console.log('')
console.log(chalk.yellow('To use this template, you must update following to modules:'))
console.log()
for (let i = 0; i < warnings.length; i++) {
const warning = warnings[i]
console.log(' ' + warning)
}
console.log()
process.exit(1)
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

@ -0,0 +1,99 @@
'use strict'
const path = require('path')
const config = require('../config')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const packageConfig = require('../package.json')
exports.assetsPath = function (_path) {
const assetsSubDirectory = process.env.NODE_ENV === 'production'
? config.build.assetsSubDirectory
: config.dev.assetsSubDirectory
return path.posix.join(assetsSubDirectory, _path)
}
exports.cssLoaders = function (options) {
options = options || {}
const cssLoader = {
loader: 'css-loader',
options: {
sourceMap: options.sourceMap
}
}
const postcssLoader = {
loader: 'postcss-loader',
options: {
sourceMap: options.sourceMap
}
}
// generate loader string to be used with extract text plugin
function generateLoaders (loader, loaderOptions) {
const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]
if (loader) {
loaders.push({
loader: loader + '-loader',
options: Object.assign({}, loaderOptions, {
sourceMap: options.sourceMap
})
})
}
// Extract CSS when that option is specified
// (which is the case during production build)
if (options.extract) {
return ExtractTextPlugin.extract({
use: loaders,
fallback: 'vue-style-loader'
})
} else {
return ['vue-style-loader'].concat(loaders)
}
}
// https://vue-loader.vuejs.org/en/configurations/extract-css.html
return {
css: generateLoaders(),
postcss: generateLoaders(),
less: generateLoaders('less'),
stylus: generateLoaders('stylus'),
styl: generateLoaders('stylus')
}
}
// Generate loaders for standalone style files (outside of .vue)
exports.styleLoaders = function (options) {
const output = []
const loaders = exports.cssLoaders(options)
for (const extension in loaders) {
const loader = loaders[extension]
output.push({
test: new RegExp('\\.' + extension + '$'),
use: loader
})
}
return output
}
exports.createNotifierCallback = () => {
const notifier = require('node-notifier')
return (severity, errors) => {
if (severity !== 'error') return
const error = errors[0]
const filename = error.file && error.file.split('!').pop()
notifier.notify({
title: packageConfig.name,
message: severity + ': ' + error.name,
subtitle: filename || '',
icon: path.join(__dirname, 'logo.png')
})
}
}

@ -0,0 +1,22 @@
'use strict'
const utils = require('./utils')
const config = require('../config')
const isProduction = process.env.NODE_ENV === 'production'
const sourceMapEnabled = isProduction
? config.build.productionSourceMap
: config.dev.cssSourceMap
module.exports = {
loaders: utils.cssLoaders({
sourceMap: sourceMapEnabled,
extract: isProduction
}),
cssSourceMap: sourceMapEnabled,
cacheBusting: config.dev.cacheBusting,
transformToRequire: {
video: ['src', 'poster'],
source: 'src',
img: 'src',
image: 'xlink:href'
}
}

@ -0,0 +1,99 @@
'use strict'
const path = require('path')
const utils = require('./utils')
const config = require('../config')
const vueLoaderConfig = require('./vue-loader.conf')
function resolve (dir) {
return path.join(__dirname, '..', dir)
}
module.exports = {
context: path.resolve(__dirname, '../'),
entry: {
app: './src/main.js'
},
output: {
path: config.build.assetsRoot,
filename: '[name].js',
publicPath: process.env.NODE_ENV === 'production'
? config.build.assetsPublicPath
: config.dev.assetsPublicPath
},
resolve: {
extensions: ['.js', '.vue', '.json'],
alias: {
'vue$': 'vue/dist/vue.esm.js',
'@': resolve('src'),
}
},
module: {
rules: [
{
test: /\.less$/,
loader: "style-loader!css-loader!less-loader"
},
{
test: /\.vue$/,
loader: 'vue-loader',
options: vueLoaderConfig
},
{
test: /\.js$/,
loader: 'babel-loader',
include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
},
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('img/[name].[hash:7].[ext]')
}
},
{
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('media/[name].[hash:7].[ext]')
}
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
}
},
// {
// test: /node_modules[\\\/]vis[\\\/].*\.js$/,
// loader: 'babel-loader',
// query: {
// cacheDirectory: true,
// presets: [ "babel-preset-es2015" ].map(require.resolve),
// plugins: [
// "transform-es3-property-literals", // #2452
// "transform-es3-member-expression-literals", // #2566
// "transform-runtime" // #2566
// ]
// }
// }
]
},
node: {
// prevent webpack from injecting useless setImmediate polyfill because Vue
// source contains it (although only uses it if it's native).
setImmediate: false,
// prevent webpack from injecting mocks to Node native modules
// that does not make sense for the client
dgram: 'empty',
fs: 'empty',
net: 'empty',
tls: 'empty',
child_process: 'empty'
}
}

@ -0,0 +1,95 @@
'use strict'
const utils = require('./utils')
const webpack = require('webpack')
const config = require('../config')
const merge = require('webpack-merge')
const path = require('path')
const baseWebpackConfig = require('./webpack.base.conf')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
const portfinder = require('portfinder')
const HOST = process.env.HOST
const PORT = process.env.PORT && Number(process.env.PORT)
const devWebpackConfig = merge(baseWebpackConfig, {
module: {
rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true })
},
// cheap-module-eval-source-map is faster for development
devtool: config.dev.devtool,
// these devServer options should be customized in /config/index.js
devServer: {
clientLogLevel: 'warning',
historyApiFallback: {
rewrites: [
{ from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') },
],
},
hot: true,
contentBase: false, // since we use CopyWebpackPlugin.
compress: true,
host: HOST || config.dev.host,
port: PORT || config.dev.port,
open: config.dev.autoOpenBrowser,
overlay: config.dev.errorOverlay
? { warnings: false, errors: true }
: false,
publicPath: config.dev.assetsPublicPath,
proxy: config.dev.proxyTable,
quiet: true, // necessary for FriendlyErrorsPlugin
watchOptions: {
poll: config.dev.poll,
}
},
plugins: [
new webpack.DefinePlugin({
'process.env': require('../config/dev.env')
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.
new webpack.NoEmitOnErrorsPlugin(),
// https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'index.html',
inject: true
}),
// copy custom static assets
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, '../static'),
to: config.dev.assetsSubDirectory,
ignore: ['.*']
}
])
]
})
module.exports = new Promise((resolve, reject) => {
portfinder.basePort = process.env.PORT || config.dev.port
portfinder.getPort((err, port) => {
if (err) {
reject(err)
} else {
// publish the new Port, necessary for e2e tests
process.env.PORT = port
// add port to devServer config
devWebpackConfig.devServer.port = port
// Add FriendlyErrorsPlugin
devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({
compilationSuccessInfo: {
messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`],
},
onErrors: config.dev.notifyOnErrors
? utils.createNotifierCallback()
: undefined
}))
resolve(devWebpackConfig)
}
})
})

@ -0,0 +1,145 @@
'use strict'
const path = require('path')
const utils = require('./utils')
const webpack = require('webpack')
const config = require('../config')
const merge = require('webpack-merge')
const baseWebpackConfig = require('./webpack.base.conf')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const env = require('../config/prod.env')
const webpackConfig = merge(baseWebpackConfig, {
module: {
rules: utils.styleLoaders({
sourceMap: config.build.productionSourceMap,
extract: true,
usePostCSS: true
})
},
devtool: config.build.productionSourceMap ? config.build.devtool : false,
output: {
path: config.build.assetsRoot,
filename: utils.assetsPath('js/[name].[chunkhash].js'),
chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
},
plugins: [
// http://vuejs.github.io/vue-loader/en/workflow/production.html
new webpack.DefinePlugin({
'process.env': env
}),
new UglifyJsPlugin({
uglifyOptions: {
compress: {
warnings: false
}
},
sourceMap: config.build.productionSourceMap,
parallel: true
}),
// extract css into its own file
new ExtractTextPlugin({
filename: utils.assetsPath('css/[name].[contenthash].css'),
// Setting the following option to `false` will not extract CSS from codesplit chunks.
// Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
// It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
// increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
allChunks: true,
}),
// Compress extracted CSS. We are using this plugin so that possible
// duplicated CSS from different components can be deduped.
new OptimizeCSSPlugin({
cssProcessorOptions: config.build.productionSourceMap
? { safe: true, map: { inline: false } }
: { safe: true }
}),
// generate dist index.html with correct asset hash for caching.
// you can customize output by editing /index.html
// see https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({
filename: config.build.index,
template: 'index.html',
inject: true,
minify: {
removeComments: true,
collapseWhitespace: true,
removeAttributeQuotes: true
// more options:
// https://github.com/kangax/html-minifier#options-quick-reference
},
// necessary to consistently work with multiple chunks via CommonsChunkPlugin
chunksSortMode: 'dependency'
}),
// keep module.id stable when vendor modules does not change
new webpack.HashedModuleIdsPlugin(),
// enable scope hoisting
new webpack.optimize.ModuleConcatenationPlugin(),
// split vendor js into its own file
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks (module) {
// any required modules inside node_modules are extracted to vendor
return (
module.resource &&
/\.js$/.test(module.resource) &&
module.resource.indexOf(
path.join(__dirname, '../node_modules')
) === 0
)
}
}),
// extract webpack runtime and module manifest to its own file in order to
// prevent vendor hash from being updated whenever app bundle is updated
new webpack.optimize.CommonsChunkPlugin({
name: 'manifest',
minChunks: Infinity
}),
// This instance extracts shared chunks from code splitted chunks and bundles them
// in a separate chunk, similar to the vendor chunk
// see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
new webpack.optimize.CommonsChunkPlugin({
name: 'app',
async: 'vendor-async',
children: true,
minChunks: 3
}),
// copy custom static assets
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, '../static'),
to: config.build.assetsSubDirectory,
ignore: ['.*']
}
])
]
})
if (config.build.productionGzip) {
const CompressionWebpackPlugin = require('compression-webpack-plugin')
webpackConfig.plugins.push(
new CompressionWebpackPlugin({
asset: '[path].gz[query]',
algorithm: 'gzip',
test: new RegExp(
'\\.(' +
config.build.productionGzipExtensions.join('|') +
')$'
),
threshold: 10240,
minRatio: 0.8
})
)
}
if (config.build.bundleAnalyzerReport) {
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
webpackConfig.plugins.push(new BundleAnalyzerPlugin())
}
module.exports = webpackConfig

@ -0,0 +1,7 @@
'use strict'
const merge = require('webpack-merge')
const prodEnv = require('./prod.env')
module.exports = merge(prodEnv, {
NODE_ENV: '"development"'
})

@ -0,0 +1,54 @@
/*
* index
*
* @Author: ShanZhu
* @Date: 2023-11-23
*/
'use strict'
const path = require('path')
module.exports = {
dev: {
// Paths
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {
'/api': {
target: 'http://localhost:8087',//本地地址
changeOrigin: true,
pathRewrite: {
'^/api': ''//这里理解成用‘/api代替target里面的地址后面组件中我们掉接口时直接用api代替 比如我要调用'http://40.00.100.100:3002/user/add',直接写‘/api/user/add即可
}
}
},
host: 'localhost',
port: 8088,
autoOpenBrowser: false,
errorOverlay: true,
notifyOnErrors: true,
poll: false,
devtool: 'cheap-module-eval-source-map',
cacheBusting: true,
cssSourceMap: true
},
build: {
index: path.resolve(__dirname, '../dist/index.html'),
// Paths
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: '/',
productionSourceMap: true,
// https://webpack.js.org/configuration/devtool/#production
devtool: '#source-map',
productionGzip: false,
productionGzipExtensions: ['js', 'css'],
bundleAnalyzerReport: process.env.npm_config_report
}
}

@ -0,0 +1,4 @@
'use strict'
module.exports = {
NODE_ENV: '"production"'
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save