From 06404d4f3a7492d46c645a943af4c256e0cbad64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AC=A7=E9=98=B3=E8=92=BF?= Date: Mon, 5 Jun 2023 13:31:55 +0000 Subject: [PATCH 1/4] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=BA=86=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E6=89=B9=E5=8D=B7=E5=90=8E=E7=AB=AF=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E4=BB=A5=E5=8F=8A=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95=E5=92=8C?= =?UTF-8?q?=E9=9B=86=E6=88=90=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 欧阳蒿 --- .../com/lyt/bean/PaperQuestionStuuser.java | 21 +++ .../com/lyt/controller/GradeController.java | 41 ++++++ src/main/java/com/lyt/dao/GradeDao.java | 132 ++++++++++++++++++ .../java/com/lyt/service/GradeService.java | 37 +++++ .../java/com/lyt/GradeIntegrationTest.java | 43 ++++++ src/test/java/com/lyt/GradeTest.java | 49 +++++++ 6 files changed, 323 insertions(+) create mode 100644 src/main/java/com/lyt/bean/PaperQuestionStuuser.java create mode 100644 src/main/java/com/lyt/controller/GradeController.java create mode 100644 src/main/java/com/lyt/dao/GradeDao.java create mode 100644 src/main/java/com/lyt/service/GradeService.java create mode 100644 src/test/java/com/lyt/GradeIntegrationTest.java create mode 100644 src/test/java/com/lyt/GradeTest.java diff --git a/src/main/java/com/lyt/bean/PaperQuestionStuuser.java b/src/main/java/com/lyt/bean/PaperQuestionStuuser.java new file mode 100644 index 0000000..fe0edb3 --- /dev/null +++ b/src/main/java/com/lyt/bean/PaperQuestionStuuser.java @@ -0,0 +1,21 @@ +package com.lyt.bean; + +import lombok.*; +/** + * @author OuyangHao + * @date 5/6/2023 + * @version 1.0 + * @info 批卷表 + */ + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class PaperQuestionStuuser { + private Integer id; + private Integer testId; + private Integer userId; + private Integer questionId; + private String answer; + private Integer score; +} diff --git a/src/main/java/com/lyt/controller/GradeController.java b/src/main/java/com/lyt/controller/GradeController.java new file mode 100644 index 0000000..4b03e54 --- /dev/null +++ b/src/main/java/com/lyt/controller/GradeController.java @@ -0,0 +1,41 @@ +package com.lyt.controller; + +import com.lyt.bean.PaperQuestionStuuser; +import com.lyt.service.GradeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +@RequestMapping("/grade") +public class GradeController { + @Autowired + private GradeService gradeService; + + /** + * 批卷接口 + */ + @PostMapping("/autoGrade") + public String autoGrade() { + try { + // 调用批卷service中的方法,进行批卷并打印日志 + gradeService.insertStudentAnswerAndAutoScore(); + return "批卷成功!"; + } catch (Exception e) { + e.printStackTrace(); + return "批卷失败!"; + } + } + + /** + * 查询所有试卷题目-学生-答案关联表记录接口 + */ + @GetMapping("/paperQuestionStuuser") + public List getAllPaperQuestionStuuser() { + return gradeService.getAllPaperQuestionStuuser(); + } +} diff --git a/src/main/java/com/lyt/dao/GradeDao.java b/src/main/java/com/lyt/dao/GradeDao.java new file mode 100644 index 0000000..5e91e5d --- /dev/null +++ b/src/main/java/com/lyt/dao/GradeDao.java @@ -0,0 +1,132 @@ +package com.lyt.dao; +import com.lyt.bean.PaperQuestionStuuser; +import org.apache.ibatis.annotations.Insert; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.Update; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * @author OuyangHao + * @date 30/5/2023 + * @version 1.0 + * @info 批卷功能实现 + */ + +@Repository +public interface GradeDao { + +//原理解析: +//alter table paper_question_stuuser auto_increment=0; + // 如果以上sql无效,是因为您不能将计数器重置为小于或等于已使用的值。 + //对于MyISAM,如果该值小于或等于AUTO_INCREMENT列中当前的最大值,则该值将重置为当前的最大值加1。 + //对于InnoDB,如果该值小于该列中的当前最大值,则不会发生错误,并且当前序列值不会更改。 + // + //也许这就是问题的原因:您试图将auto_increment计数器恢复为0,但它已经高于该值-并且由于无法将其重置为小于已使用的任何值的值,因此不会工作。 + + + //插入学生测试答案到paper_question_stuuser表中 + @Insert("INSERT INTO paper_question_stuuser (test_id,user_id,question_id,answer) " + + "SELECT ta.test_id,ta.stu_test_id,la.question_id,la.answer " + + "FROM link_answer la " + + "JOIN test_answer ta ON FIND_IN_SET(la.id, REPLACE(REPLACE(ta.linkAnswers,'[',''),']','')) > 0 " + + "JOIN question ON question.question_id = la.question_id") + public void insertStudentAnswerToPaper(); + + //在第一个方法运行后,进行自动批卷。 + @Update("UPDATE paper_question_stuuser p " + + "JOIN question q ON p.question_id = q.question_id " + + "SET p.score = IF(p.answer COLLATE utf8mb4_general_ci = q.answer COLLATE utf8mb4_general_ci, q.score, 0)") + public void updatePaperQuestionStuuserScore(); + + // 查询 paper_question_stuuser 表中的所有数据 + @Select("SELECT * FROM paper_question_stuuser") + List selectAllPaperQuestionStuuser(); + + + + + + +//-- 将学生测试答案插入到试卷题目-学生-答案关联表 +// INSERT INTO paper_question_stuuser ( +// test_id, -- 试卷 ID +// user_id, -- 学生 ID +// question_id, -- 题目 ID +// answer -- 答案 +// ) +// SELECT +// ta.test_id, +// ta.stu_test_id, +// la.question_id, +// la.answer -- 获取 link_answer 表中的答案 +// FROM +// link_answer la -- 链接 link_answer 表,获取题目 ID 和答案 +// JOIN +// test_answer ta -- 链接 test_answer 表,获取学生 ID 和包含相关题目 ID 的 linkAnswers 字段 +// ON +// FIND_IN_SET(la.id, REPLACE(REPLACE(ta.linkAnswers, '[', ''), ']', '')) > 0 -- 使用 FIND_IN_SET 函数进行匹配 +// JOIN +// question -- 链接 question 表,以便获取题目信息 +// ON +// question.question_id = la.question_id -- 根据题目 ID 将 question 表和 link_answer 表连接起来 +// +//--以下是自动批卷: +// UPDATE paper_question_stuuser +// JOIN question ON paper_question_stuuser.question_id = question.question_id +// SET paper_question_stuuser.score = IF(paper_question_stuuser.answer COLLATE utf8mb4_general_ci = question.answer COLLATE utf8mb4_general_ci, question.score, 0) + +// -- 这条 SQL 语句会根据题目 ID 对应到 question 表中的 answer 字段来判断学生答案是否正确,如果正确则更新 score 为 question 表中该题对应的 score 值,否则更新为 0。 +// +// +// DROP TABLE IF EXISTS `paper_question_stuuser`; +// CREATE TABLE `paper_question_stuuser` ( +// `id` int NOT NULL, +// `test_id` int DEFAULT NULL, +// `user_id` int DEFAULT NULL, +// `question_id` int DEFAULT NULL, +// `answer` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, +// `score` int DEFAULT NULL, +// PRIMARY KEY (`id`) USING BTREE +//) +// +// DROP TABLE IF EXISTS `link_answer`; +// CREATE TABLE `link_answer` ( +// `id` int NOT NULL AUTO_INCREMENT, +// `_index` int DEFAULT NULL, +// `question_id` int DEFAULT NULL, +// `answer` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, +// PRIMARY KEY (`id`) USING BTREE +//) +// +// DROP TABLE IF EXISTS `question`; +// CREATE TABLE `question` ( +// `question_id` int unsigned NOT NULL AUTO_INCREMENT, +// `question_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, +// `type` int DEFAULT NULL, +// `content` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, +// `score` int DEFAULT NULL, +// `user_id` int unsigned DEFAULT NULL, +// `time` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, +// `answer` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, +// `detail` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, +// `course_id` int unsigned DEFAULT NULL, +// PRIMARY KEY (`question_id`) USING BTREE, +// KEY `FK_question_course_id` (`course_id`) USING BTREE +//) +// +// DROP TABLE IF EXISTS `test_answer`; +// CREATE TABLE `test_answer` ( +// `test_id` int NOT NULL AUTO_INCREMENT, +// `stu_test_id` int NOT NULL, +// `paper_id` int NOT NULL, +// `linkAnswers` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, +// PRIMARY KEY (`test_id`) USING BTREE +//) +// + + + + +} diff --git a/src/main/java/com/lyt/service/GradeService.java b/src/main/java/com/lyt/service/GradeService.java new file mode 100644 index 0000000..4e37875 --- /dev/null +++ b/src/main/java/com/lyt/service/GradeService.java @@ -0,0 +1,37 @@ +package com.lyt.service; + +import com.lyt.bean.PaperQuestionStuuser; +import com.lyt.dao.GradeDao; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +/** + * @author OuyangHao + * @date 1/6/2023 + * @version 1.0 + * @info 批卷service + */ +@Service +public class GradeService { + @Autowired + GradeDao gradeDao; + + @Transactional + public void insertStudentAnswerAndAutoScore() { + // 插入学生答案到试卷题目-学生-答案关联表 + gradeDao.insertStudentAnswerToPaper(); + System.out.println("插入学生答案成功!"); + + // 自动批卷并更新成绩 + gradeDao.updatePaperQuestionStuuserScore(); + System.out.println("自动批卷成功!"); + } + + public List getAllPaperQuestionStuuser() { + // 查询 paper_question_stuuser 表中的所有数据 + return gradeDao.selectAllPaperQuestionStuuser(); + } +} diff --git a/src/test/java/com/lyt/GradeIntegrationTest.java b/src/test/java/com/lyt/GradeIntegrationTest.java new file mode 100644 index 0000000..a944555 --- /dev/null +++ b/src/test/java/com/lyt/GradeIntegrationTest.java @@ -0,0 +1,43 @@ +package com.lyt; + +import com.lyt.bean.PaperQuestionStuuser; +import com.lyt.service.GradeService; +import org.junit.jupiter.api.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import java.util.List; + +/** + * @author OuyangHao + * @date 5/6/2023 + * @version 1.0 + * @info 测试批卷数据库的集成测试 + */ + +@RunWith(SpringRunner.class) +@SpringBootTest +class GradeIntegrationTest { + + @Autowired + private GradeService gradeService; + + /** + * 测试批卷 + */ + @Test + void testAutoGrade() { + // 调用需要测试的服务方法 + gradeService.insertStudentAnswerAndAutoScore(); + + // 验证数据库操作是否正确 + List list = gradeService.getAllPaperQuestionStuuser(); + for (PaperQuestionStuuser item : list) { + System.out.println(item); // 打印所有记录 + // TODO: 进行数据库操作验证 + } +} + +} diff --git a/src/test/java/com/lyt/GradeTest.java b/src/test/java/com/lyt/GradeTest.java new file mode 100644 index 0000000..9e57556 --- /dev/null +++ b/src/test/java/com/lyt/GradeTest.java @@ -0,0 +1,49 @@ +package com.lyt; + +import com.lyt.service.GradeService; +import org.junit.jupiter.api.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; +import static org.mockito.Mockito.*; +/** + * @author OuyangHao + * @date 5/6/2023 + * @version 1.0 + * @info 测试批卷请求的单元测试 + */ + +@RunWith(SpringRunner.class) +@SpringBootTest +@AutoConfigureMockMvc +class GradeTest { + + @Autowired + private MockMvc mockMvc; + + @MockBean + private GradeService gradeService; + + /** + * 测试批卷 + */ + @Test + void testAutoGrade() throws Exception { + // 模拟接口请求 + this.mockMvc.perform(post("/grade/autoGrade")) + // 验证请求是否成功 + .andExpect(status().isOk()) + // 验证返回结果是否正确 + .andExpect(content().string("批卷成功!")); + + // 验证是否调用了批卷service中的 insertStudentAnswerAndAutoScore() 方法 + verify(gradeService, times(1)).insertStudentAnswerAndAutoScore(); + } +} -- Gitee From 805f2988db667b6982fe02ecf577931cac899a7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AC=A7=E9=98=B3=E8=92=BF?= Date: Mon, 5 Jun 2023 13:38:30 +0000 Subject: [PATCH 2/4] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BA=86=E4=BD=9C?= =?UTF-8?q?=E8=80=85=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 欧阳蒿 --- src/main/java/com/lyt/controller/GradeController.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/lyt/controller/GradeController.java b/src/main/java/com/lyt/controller/GradeController.java index 4b03e54..829d0de 100644 --- a/src/main/java/com/lyt/controller/GradeController.java +++ b/src/main/java/com/lyt/controller/GradeController.java @@ -9,6 +9,12 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; +/** + * @author OuyangHao + * @date 5/6/2023 + * @version 1.0 + * @info 批卷接口 + */ @RestController @RequestMapping("/grade") @@ -16,9 +22,7 @@ public class GradeController { @Autowired private GradeService gradeService; - /** - * 批卷接口 - */ + @PostMapping("/autoGrade") public String autoGrade() { try { -- Gitee From 3585733e53ad671a774957af26ec28b77987b71f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AC=A7=E9=98=B3=E8=92=BF?= Date: Tue, 6 Jun 2023 02:25:44 +0000 Subject: [PATCH 3/4] IGNORE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 欧阳蒿 --- src/main/java/com/lyt/dao/GradeDao.java | 85 +------------------------ 1 file changed, 1 insertion(+), 84 deletions(-) diff --git a/src/main/java/com/lyt/dao/GradeDao.java b/src/main/java/com/lyt/dao/GradeDao.java index 5e91e5d..fff4de9 100644 --- a/src/main/java/com/lyt/dao/GradeDao.java +++ b/src/main/java/com/lyt/dao/GradeDao.java @@ -27,7 +27,7 @@ public interface GradeDao { //插入学生测试答案到paper_question_stuuser表中 - @Insert("INSERT INTO paper_question_stuuser (test_id,user_id,question_id,answer) " + + @Insert("INSERT IGNORE INTO paper_question_stuuser (test_id,user_id,question_id,answer) " + "SELECT ta.test_id,ta.stu_test_id,la.question_id,la.answer " + "FROM link_answer la " + "JOIN test_answer ta ON FIND_IN_SET(la.id, REPLACE(REPLACE(ta.linkAnswers,'[',''),']','')) > 0 " + @@ -46,87 +46,4 @@ public interface GradeDao { - - - -//-- 将学生测试答案插入到试卷题目-学生-答案关联表 -// INSERT INTO paper_question_stuuser ( -// test_id, -- 试卷 ID -// user_id, -- 学生 ID -// question_id, -- 题目 ID -// answer -- 答案 -// ) -// SELECT -// ta.test_id, -// ta.stu_test_id, -// la.question_id, -// la.answer -- 获取 link_answer 表中的答案 -// FROM -// link_answer la -- 链接 link_answer 表,获取题目 ID 和答案 -// JOIN -// test_answer ta -- 链接 test_answer 表,获取学生 ID 和包含相关题目 ID 的 linkAnswers 字段 -// ON -// FIND_IN_SET(la.id, REPLACE(REPLACE(ta.linkAnswers, '[', ''), ']', '')) > 0 -- 使用 FIND_IN_SET 函数进行匹配 -// JOIN -// question -- 链接 question 表,以便获取题目信息 -// ON -// question.question_id = la.question_id -- 根据题目 ID 将 question 表和 link_answer 表连接起来 -// -//--以下是自动批卷: -// UPDATE paper_question_stuuser -// JOIN question ON paper_question_stuuser.question_id = question.question_id -// SET paper_question_stuuser.score = IF(paper_question_stuuser.answer COLLATE utf8mb4_general_ci = question.answer COLLATE utf8mb4_general_ci, question.score, 0) - -// -- 这条 SQL 语句会根据题目 ID 对应到 question 表中的 answer 字段来判断学生答案是否正确,如果正确则更新 score 为 question 表中该题对应的 score 值,否则更新为 0。 -// -// -// DROP TABLE IF EXISTS `paper_question_stuuser`; -// CREATE TABLE `paper_question_stuuser` ( -// `id` int NOT NULL, -// `test_id` int DEFAULT NULL, -// `user_id` int DEFAULT NULL, -// `question_id` int DEFAULT NULL, -// `answer` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, -// `score` int DEFAULT NULL, -// PRIMARY KEY (`id`) USING BTREE -//) -// -// DROP TABLE IF EXISTS `link_answer`; -// CREATE TABLE `link_answer` ( -// `id` int NOT NULL AUTO_INCREMENT, -// `_index` int DEFAULT NULL, -// `question_id` int DEFAULT NULL, -// `answer` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, -// PRIMARY KEY (`id`) USING BTREE -//) -// -// DROP TABLE IF EXISTS `question`; -// CREATE TABLE `question` ( -// `question_id` int unsigned NOT NULL AUTO_INCREMENT, -// `question_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, -// `type` int DEFAULT NULL, -// `content` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, -// `score` int DEFAULT NULL, -// `user_id` int unsigned DEFAULT NULL, -// `time` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, -// `answer` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, -// `detail` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, -// `course_id` int unsigned DEFAULT NULL, -// PRIMARY KEY (`question_id`) USING BTREE, -// KEY `FK_question_course_id` (`course_id`) USING BTREE -//) -// -// DROP TABLE IF EXISTS `test_answer`; -// CREATE TABLE `test_answer` ( -// `test_id` int NOT NULL AUTO_INCREMENT, -// `stu_test_id` int NOT NULL, -// `paper_id` int NOT NULL, -// `linkAnswers` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, -// PRIMARY KEY (`test_id`) USING BTREE -//) -// - - - - } -- Gitee From de85ef626da9629596b8a708349e200c208b0c3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AC=A7=E9=98=B3=E8=92=BF?= Date: Tue, 6 Jun 2023 02:27:23 +0000 Subject: [PATCH 4/4] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BA=86=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E8=A1=A8=E7=BB=93=E6=9E=84=EF=BC=8C=E5=8F=AA?= =?UTF-8?q?=E5=AF=B9=E8=87=AA=E5=8A=A8=E6=89=B9=E5=8D=B7=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E6=89=B9=E5=8D=B7=E7=9B=B8=E5=85=B3=E6=9C=89=E5=BD=B1=E5=93=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 欧阳蒿 --- src/paper_question_stuuser.sql | 42 ++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/paper_question_stuuser.sql diff --git a/src/paper_question_stuuser.sql b/src/paper_question_stuuser.sql new file mode 100644 index 0000000..650bb68 --- /dev/null +++ b/src/paper_question_stuuser.sql @@ -0,0 +1,42 @@ +/* + Navicat Premium Data Transfer + + Source Server : db_test + Source Server Type : MySQL + Source Server Version : 80030 + Source Host : localhost:3306 + Source Schema : test + + Target Server Type : MySQL + Target Server Version : 80030 + File Encoding : 65001 + + Date: 06/06/2023 10:24:50 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for paper_question_stuuser +-- ---------------------------- +DROP TABLE IF EXISTS `paper_question_stuuser`; +CREATE TABLE `paper_question_stuuser` ( + `id` int(0) NOT NULL AUTO_INCREMENT, + `test_id` int(0) NULL DEFAULT NULL, + `user_id` int(0) NULL DEFAULT NULL, + `question_id` int(0) NULL DEFAULT NULL, + `answer` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `score` int(0) NULL DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `idx_test_question`(`test_id`, `question_id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of paper_question_stuuser +-- ---------------------------- +INSERT INTO `paper_question_stuuser` VALUES (1, 7, 20203778, 4140, '[\"B\"]', 0); +INSERT INTO `paper_question_stuuser` VALUES (2, 7, 20203778, 4141, '[\"B\",\"C\",\"A\",\"D\"]', 0); +INSERT INTO `paper_question_stuuser` VALUES (3, 7, 20203778, 4143, '[\"A\"]', 3); + +SET FOREIGN_KEY_CHECKS = 1; -- Gitee