diff --git a/src/main/java/com/msdw/tms/entity/request/QuestionsImportRequest.java b/src/main/java/com/msdw/tms/entity/request/QuestionsImportRequest.java index 77c6cf4..e671e12 100644 --- a/src/main/java/com/msdw/tms/entity/request/QuestionsImportRequest.java +++ b/src/main/java/com/msdw/tms/entity/request/QuestionsImportRequest.java @@ -10,59 +10,55 @@ import lombok.Data; */ @Data public class QuestionsImportRequest { - /** - * 试题科目 - */ - @ExcelAttribute(sort = 0) - private String subjects; + /** * 题干,问题描述 */ - @ExcelAttribute(sort = 1) + @ExcelAttribute(sort = 0) private String questionStem; /** * 题型 */ - @ExcelAttribute(sort = 2) + @ExcelAttribute(sort = 1) private String questionType; /** * 选项A */ - @ExcelAttribute(sort = 3) + @ExcelAttribute(sort = 2) private String optionA; /** * 选项B */ - @ExcelAttribute(sort = 4) + @ExcelAttribute(sort = 3) private String optionB; /** * 选项C */ - @ExcelAttribute(sort = 5) + @ExcelAttribute(sort = 4) private String optionC; /** * 选项D */ - @ExcelAttribute(sort = 6) + @ExcelAttribute(sort = 5) private String optionD; /** * 选项E */ - @ExcelAttribute(sort = 7) + @ExcelAttribute(sort = 6) private String optionE; /** * 选项F */ - @ExcelAttribute(sort = 8) + @ExcelAttribute(sort = 7) private String optionF; /** * 正确答案 */ - @ExcelAttribute(sort = 9) + @ExcelAttribute(sort = 8) private String answer; /** * 答案解析 */ - @ExcelAttribute(sort = 10) + @ExcelAttribute(sort = 9) private String answerAnalysis; } diff --git a/src/main/resources/excel-template/试题导入模板.xlsx b/src/main/resources/excel-template/试题导入模板.xlsx index 4c064f0..30c5e14 100644 Binary files a/src/main/resources/excel-template/试题导入模板.xlsx and b/src/main/resources/excel-template/试题导入模板.xlsx differ diff --git a/src/test/java/com/msdw/tms/service/EvaluationRulesServiceTest.java b/src/test/java/com/msdw/tms/service/EvaluationRulesServiceTest.java index 7f79ad0..2a9d364 100644 --- a/src/test/java/com/msdw/tms/service/EvaluationRulesServiceTest.java +++ b/src/test/java/com/msdw/tms/service/EvaluationRulesServiceTest.java @@ -5,6 +5,7 @@ import com.msdw.tms.entity.vo.EvaluationRulesVO; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.transaction.annotation.Transactional; /** * 测评规则信息记录,只记录一条信息 @@ -24,6 +25,7 @@ class EvaluationRulesServiceTest { } @Test + @Transactional void updateEvaluationRulesById() { EvaluationRulesEntity evaluationRules = new EvaluationRulesEntity(); boolean b = evaluationRulesService.updateEvaluationRulesById(evaluationRules); diff --git a/src/test/java/com/msdw/tms/service/QuestionsServiceTest.java b/src/test/java/com/msdw/tms/service/QuestionsServiceTest.java index 1ba4f4f..cf15c5f 100644 --- a/src/test/java/com/msdw/tms/service/QuestionsServiceTest.java +++ b/src/test/java/com/msdw/tms/service/QuestionsServiceTest.java @@ -13,6 +13,7 @@ import org.apache.commons.io.IOUtils; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.commons.CommonsMultipartFile; @@ -52,30 +53,35 @@ class QuestionsServiceTest { } @Test + @Transactional void saveQuestion() { QuestionsAddRequest questions = new QuestionsAddRequest(); System.out.println(questionsService.saveQuestion(questions)); } @Test + @Transactional void updateQuestionById() { QuestionsUpdateRequest questions = new QuestionsUpdateRequest(); System.out.println(questionsService.updateQuestionById(questions)); } @Test + @Transactional void isnable() { Integer id = 1; System.out.println(questionsService.isnable(id)); } @Test + @Transactional void deleteByIds() { List asList = new ArrayList<>(); System.out.println(questionsService.deleteByIds(asList)); } @Test + @Transactional void importQuestion() throws IOException { File file = new File("D:\\pic\\1.jpg"); FileItem fileItem = new DiskFileItem("file",