From 9999ae551107df0b7cfc51f706ce5ec0e13f8bc8 Mon Sep 17 00:00:00 2001 From: xiaoCJ <406612557@qq.com> Date: Mon, 29 Apr 2024 10:52:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81=E6=96=B0?= =?UTF-8?q?=E5=A2=9Exml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tea/TeaExamManageController.java | 61 +- .../mapper/SysObjectiveQuestionMapper.java | 7 + .../mapper/SysObjectiveQuestionMapper.xml | 895 +++++++++--------- 3 files changed, 497 insertions(+), 466 deletions(-) diff --git a/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaExamManageController.java b/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaExamManageController.java index 964916e..7a60cb0 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaExamManageController.java +++ b/src/main/java/com/sztzjy/financial_bigdata/controller/tea/TeaExamManageController.java @@ -3,7 +3,6 @@ package com.sztzjy.financial_bigdata.controller.tea; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.sztzjy.financial_bigdata.annotation.AnonymousAccess; -import com.sztzjy.financial_bigdata.config.Constant; import com.sztzjy.financial_bigdata.entity.*; import com.sztzjy.financial_bigdata.entity.tea_dto.TeaExamManageCountDto; import com.sztzjy.financial_bigdata.entity.tea_dto.TeaExamManageDto; @@ -22,7 +21,10 @@ import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.*; import java.math.BigDecimal; -import java.util.*; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; /** * @Author xcj @@ -54,15 +56,8 @@ public class TeaExamManageController { @PostMapping("/getSelectCountAndScore") @ApiOperation("新增考试--获取选题量和分数") public ResultEntity> getsingleId(@RequestBody @ApiParam("所有ID用,隔开一次传过来") List ids) { - Map map = new HashMap<>(); - int i = 0; - BigDecimal score = BigDecimal.ZERO; - for (String id : ids) { - SysObjectiveQuestion sysObjectiveQuestion = sysObjectiveQuestionMapper.selectByPrimaryKey(id); - i++; - score = sysObjectiveQuestion.getScore().add(score); - } - map.put(i, score); + List list = new ArrayList<>(ids); + Map map = sysObjectiveQuestionMapper.selectByList(list); return new ResultEntity<>(map); } @@ -78,13 +73,9 @@ public class TeaExamManageController { @PostMapping("/selectObjectivityByType") @ApiOperation("新增考试--选择客观题时展示") public ResultEntity> selectObjectivityByType(@ApiParam("0单选 1多选 2判断") @RequestParam String type, - @RequestParam String schoolId) { - SysObjectiveQuestionExample sysObjectiveQuestionExample = new SysObjectiveQuestionExample(); - List l = new ArrayList<>(); - l.add(schoolId); - l.add(Constant.BUILT_IN_SCHOOL_ID); - sysObjectiveQuestionExample.createCriteria().andTypeEqualTo(type).andSchoolIdIn(l); - return new ResultEntity>(sysObjectiveQuestionMapper.selectByExample(sysObjectiveQuestionExample)); + @RequestParam String schoolId) { + List list = sysObjectiveQuestionMapper.selectObjectivityByType(type, schoolId); + return new ResultEntity<>(list); } @@ -217,27 +208,27 @@ public class TeaExamManageController { } } } - PageInfo pageInfo = new PageInfo(stuUsers); - return new ResultEntity<>(pageInfo); + PageInfo pageInfo = new PageInfo(stuUsers); + return new ResultEntity<>(pageInfo); } - @AnonymousAccess - @PostMapping("/reloadExamById") - @ApiOperation("考试管理--指定人重考") - public ResultEntity reloadExamById (@ApiParam("考试管理ID") @RequestParam String - examId, @RequestParam String userId){ - StuStudentExamExample studentExamExample = new StuStudentExamExample(); - studentExamExample.createCriteria().andUseridEqualTo(userId).andExamManageIdEqualTo(examId); - List stuStudentExamWithBLOBs = studentExamMapper.selectByExampleWithBLOBs(studentExamExample); - if (stuStudentExamWithBLOBs.isEmpty()) { - return new ResultEntity(HttpStatus.BAD_REQUEST, "学生暂未考试,无需重考"); - } else { - StuStudentExamWithBLOBs stuStudentExamWithBLOBs1 = stuStudentExamWithBLOBs.get(0); - studentExamMapper.deleteByPrimaryKey(stuStudentExamWithBLOBs1.getStudentExamId()); - return new ResultEntity(HttpStatus.OK, "指定重考成功!"); - } + @AnonymousAccess + @PostMapping("/reloadExamById") + @ApiOperation("考试管理--指定人重考") + public ResultEntity reloadExamById(@ApiParam("考试管理ID") @RequestParam String + examId, @RequestParam String userId) { + StuStudentExamExample studentExamExample = new StuStudentExamExample(); + studentExamExample.createCriteria().andUseridEqualTo(userId).andExamManageIdEqualTo(examId); + List stuStudentExamWithBLOBs = studentExamMapper.selectByExampleWithBLOBs(studentExamExample); + if (stuStudentExamWithBLOBs.isEmpty()) { + return new ResultEntity(HttpStatus.BAD_REQUEST, "学生暂未考试,无需重考"); + } else { + StuStudentExamWithBLOBs stuStudentExamWithBLOBs1 = stuStudentExamWithBLOBs.get(0); + studentExamMapper.deleteByPrimaryKey(stuStudentExamWithBLOBs1.getStudentExamId()); + return new ResultEntity(HttpStatus.OK, "指定重考成功!"); } } +} diff --git a/src/main/java/com/sztzjy/financial_bigdata/mapper/SysObjectiveQuestionMapper.java b/src/main/java/com/sztzjy/financial_bigdata/mapper/SysObjectiveQuestionMapper.java index cb1cc7d..0a26997 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/mapper/SysObjectiveQuestionMapper.java +++ b/src/main/java/com/sztzjy/financial_bigdata/mapper/SysObjectiveQuestionMapper.java @@ -3,7 +3,10 @@ package com.sztzjy.financial_bigdata.mapper; import com.sztzjy.financial_bigdata.entity.SysCaseQuestion; import com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion; import com.sztzjy.financial_bigdata.entity.SysObjectiveQuestionExample; + +import java.math.BigDecimal; import java.util.List; +import java.util.Map; import com.sztzjy.financial_bigdata.entity.tea_dto.TeaExamManageCountDto; import org.apache.ibatis.annotations.Mapper; @@ -50,4 +53,8 @@ public interface SysObjectiveQuestionMapper { List selectRandomObjectiveJudge(); List getGradeReportObjective(@Param("list") List list); + + Map selectByList(@Param("list") List list); + + List selectObjectivityByType(@Param("type")String type, @Param("schoolId")String schoolId); } \ No newline at end of file diff --git a/src/main/resources/mapper/SysObjectiveQuestionMapper.xml b/src/main/resources/mapper/SysObjectiveQuestionMapper.xml index fc9e429..cb1a657 100644 --- a/src/main/resources/mapper/SysObjectiveQuestionMapper.xml +++ b/src/main/resources/mapper/SysObjectiveQuestionMapper.xml @@ -1,462 +1,495 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + - - - - - - - objective_id, course_id, course_name, chapter_id, chapter_name, input_type, type, + + + + objective_id + , course_id, course_name, chapter_id, chapter_name, input_type, type, score, content, question_a, question_b, question_c, question_d, question_e, answer, analysis, school_id - - - - - delete from sys_objective_question - where objective_id = #{objectiveId,jdbcType=VARCHAR} - - - delete from sys_objective_question - - - - - - insert into sys_objective_question (objective_id, course_id, course_name, - chapter_id, chapter_name, input_type, - type, score, content, - question_a, question_b, question_c, - question_d, question_e, answer, - analysis, school_id) - values (#{objectiveId,jdbcType=VARCHAR}, #{courseId,jdbcType=VARCHAR}, #{courseName,jdbcType=VARCHAR}, - #{chapterId,jdbcType=VARCHAR}, #{chapterName,jdbcType=VARCHAR}, #{inputType,jdbcType=VARCHAR}, - #{type,jdbcType=VARCHAR}, #{score,jdbcType=DECIMAL}, #{content,jdbcType=VARCHAR}, - #{questionA,jdbcType=VARCHAR}, #{questionB,jdbcType=VARCHAR}, #{questionC,jdbcType=VARCHAR}, - #{questionD,jdbcType=VARCHAR}, #{questionE,jdbcType=VARCHAR}, #{answer,jdbcType=VARCHAR}, - #{analysis,jdbcType=VARCHAR}, #{schoolId,jdbcType=VARCHAR}) - - - insert into sys_objective_question - - - objective_id, - - - course_id, - - - course_name, - - - chapter_id, - - - chapter_name, - - - input_type, - - - type, - - - score, - - - content, - - - question_a, - - - question_b, - - - question_c, - - - question_d, - - - question_e, - - - answer, - - - analysis, - - - school_id, - - - - - #{objectiveId,jdbcType=VARCHAR}, - - - #{courseId,jdbcType=VARCHAR}, - - - #{courseName,jdbcType=VARCHAR}, - - - #{chapterId,jdbcType=VARCHAR}, - - - #{chapterName,jdbcType=VARCHAR}, - - - #{inputType,jdbcType=VARCHAR}, - - - #{type,jdbcType=VARCHAR}, - - - #{score,jdbcType=DECIMAL}, - - - #{content,jdbcType=VARCHAR}, - - - #{questionA,jdbcType=VARCHAR}, - - - #{questionB,jdbcType=VARCHAR}, - - - #{questionC,jdbcType=VARCHAR}, - - - #{questionD,jdbcType=VARCHAR}, - - - #{questionE,jdbcType=VARCHAR}, - - - #{answer,jdbcType=VARCHAR}, - - - #{analysis,jdbcType=VARCHAR}, - - - #{schoolId,jdbcType=VARCHAR}, - - - - - - update sys_objective_question - - - objective_id = #{record.objectiveId,jdbcType=VARCHAR}, - - + + + + + delete + from sys_objective_question + where objective_id = #{objectiveId,jdbcType=VARCHAR} + + + delete from sys_objective_question + + + + + + insert into sys_objective_question (objective_id, course_id, course_name, + chapter_id, chapter_name, input_type, + type, score, content, + question_a, question_b, question_c, + question_d, question_e, answer, + analysis, school_id) + values (#{objectiveId,jdbcType=VARCHAR}, #{courseId,jdbcType=VARCHAR}, #{courseName,jdbcType=VARCHAR}, + #{chapterId,jdbcType=VARCHAR}, #{chapterName,jdbcType=VARCHAR}, #{inputType,jdbcType=VARCHAR}, + #{type,jdbcType=VARCHAR}, #{score,jdbcType=DECIMAL}, #{content,jdbcType=VARCHAR}, + #{questionA,jdbcType=VARCHAR}, #{questionB,jdbcType=VARCHAR}, #{questionC,jdbcType=VARCHAR}, + #{questionD,jdbcType=VARCHAR}, #{questionE,jdbcType=VARCHAR}, #{answer,jdbcType=VARCHAR}, + #{analysis,jdbcType=VARCHAR}, #{schoolId,jdbcType=VARCHAR}) + + + insert into sys_objective_question + + + objective_id, + + + course_id, + + + course_name, + + + chapter_id, + + + chapter_name, + + + input_type, + + + type, + + + score, + + + content, + + + question_a, + + + question_b, + + + question_c, + + + question_d, + + + question_e, + + + answer, + + + analysis, + + + school_id, + + + + + #{objectiveId,jdbcType=VARCHAR}, + + + #{courseId,jdbcType=VARCHAR}, + + + #{courseName,jdbcType=VARCHAR}, + + + #{chapterId,jdbcType=VARCHAR}, + + + #{chapterName,jdbcType=VARCHAR}, + + + #{inputType,jdbcType=VARCHAR}, + + + #{type,jdbcType=VARCHAR}, + + + #{score,jdbcType=DECIMAL}, + + + #{content,jdbcType=VARCHAR}, + + + #{questionA,jdbcType=VARCHAR}, + + + #{questionB,jdbcType=VARCHAR}, + + + #{questionC,jdbcType=VARCHAR}, + + + #{questionD,jdbcType=VARCHAR}, + + + #{questionE,jdbcType=VARCHAR}, + + + #{answer,jdbcType=VARCHAR}, + + + #{analysis,jdbcType=VARCHAR}, + + + #{schoolId,jdbcType=VARCHAR}, + + + + + + update sys_objective_question + + + objective_id = #{record.objectiveId,jdbcType=VARCHAR}, + + + course_id = #{record.courseId,jdbcType=VARCHAR}, + + + course_name = #{record.courseName,jdbcType=VARCHAR}, + + + chapter_id = #{record.chapterId,jdbcType=VARCHAR}, + + + chapter_name = #{record.chapterName,jdbcType=VARCHAR}, + + + input_type = #{record.inputType,jdbcType=VARCHAR}, + + + type = #{record.type,jdbcType=VARCHAR}, + + + score = #{record.score,jdbcType=DECIMAL}, + + + content = #{record.content,jdbcType=VARCHAR}, + + + question_a = #{record.questionA,jdbcType=VARCHAR}, + + + question_b = #{record.questionB,jdbcType=VARCHAR}, + + + question_c = #{record.questionC,jdbcType=VARCHAR}, + + + question_d = #{record.questionD,jdbcType=VARCHAR}, + + + question_e = #{record.questionE,jdbcType=VARCHAR}, + + + answer = #{record.answer,jdbcType=VARCHAR}, + + + analysis = #{record.analysis,jdbcType=VARCHAR}, + + + school_id = #{record.schoolId,jdbcType=VARCHAR}, + + + + + + + + update sys_objective_question + set objective_id = #{record.objectiveId,jdbcType=VARCHAR}, course_id = #{record.courseId,jdbcType=VARCHAR}, - - course_name = #{record.courseName,jdbcType=VARCHAR}, - - chapter_id = #{record.chapterId,jdbcType=VARCHAR}, - - chapter_name = #{record.chapterName,jdbcType=VARCHAR}, - - input_type = #{record.inputType,jdbcType=VARCHAR}, - - type = #{record.type,jdbcType=VARCHAR}, - - score = #{record.score,jdbcType=DECIMAL}, - - content = #{record.content,jdbcType=VARCHAR}, - - question_a = #{record.questionA,jdbcType=VARCHAR}, - - question_b = #{record.questionB,jdbcType=VARCHAR}, - - question_c = #{record.questionC,jdbcType=VARCHAR}, - - question_d = #{record.questionD,jdbcType=VARCHAR}, - - question_e = #{record.questionE,jdbcType=VARCHAR}, - - answer = #{record.answer,jdbcType=VARCHAR}, - - analysis = #{record.analysis,jdbcType=VARCHAR}, - - - school_id = #{record.schoolId,jdbcType=VARCHAR}, - - - - - - - - update sys_objective_question - set objective_id = #{record.objectiveId,jdbcType=VARCHAR}, - course_id = #{record.courseId,jdbcType=VARCHAR}, - course_name = #{record.courseName,jdbcType=VARCHAR}, - chapter_id = #{record.chapterId,jdbcType=VARCHAR}, - chapter_name = #{record.chapterName,jdbcType=VARCHAR}, - input_type = #{record.inputType,jdbcType=VARCHAR}, - type = #{record.type,jdbcType=VARCHAR}, - score = #{record.score,jdbcType=DECIMAL}, - content = #{record.content,jdbcType=VARCHAR}, - question_a = #{record.questionA,jdbcType=VARCHAR}, - question_b = #{record.questionB,jdbcType=VARCHAR}, - question_c = #{record.questionC,jdbcType=VARCHAR}, - question_d = #{record.questionD,jdbcType=VARCHAR}, - question_e = #{record.questionE,jdbcType=VARCHAR}, - answer = #{record.answer,jdbcType=VARCHAR}, - analysis = #{record.analysis,jdbcType=VARCHAR}, - school_id = #{record.schoolId,jdbcType=VARCHAR} - - - - - - update sys_objective_question - - - course_id = #{courseId,jdbcType=VARCHAR}, - - - course_name = #{courseName,jdbcType=VARCHAR}, - - - chapter_id = #{chapterId,jdbcType=VARCHAR}, - - - chapter_name = #{chapterName,jdbcType=VARCHAR}, - - - input_type = #{inputType,jdbcType=VARCHAR}, - - - type = #{type,jdbcType=VARCHAR}, - - - score = #{score,jdbcType=DECIMAL}, - - - content = #{content,jdbcType=VARCHAR}, - - - question_a = #{questionA,jdbcType=VARCHAR}, - - - question_b = #{questionB,jdbcType=VARCHAR}, - - - question_c = #{questionC,jdbcType=VARCHAR}, - - - question_d = #{questionD,jdbcType=VARCHAR}, - - - question_e = #{questionE,jdbcType=VARCHAR}, - - - answer = #{answer,jdbcType=VARCHAR}, - - - analysis = #{analysis,jdbcType=VARCHAR}, - - - school_id = #{schoolId,jdbcType=VARCHAR}, - - - where objective_id = #{objectiveId,jdbcType=VARCHAR} - - - update sys_objective_question - set course_id = #{courseId,jdbcType=VARCHAR}, - course_name = #{courseName,jdbcType=VARCHAR}, - chapter_id = #{chapterId,jdbcType=VARCHAR}, - chapter_name = #{chapterName,jdbcType=VARCHAR}, - input_type = #{inputType,jdbcType=VARCHAR}, - type = #{type,jdbcType=VARCHAR}, - score = #{score,jdbcType=DECIMAL}, - content = #{content,jdbcType=VARCHAR}, - question_a = #{questionA,jdbcType=VARCHAR}, - question_b = #{questionB,jdbcType=VARCHAR}, - question_c = #{questionC,jdbcType=VARCHAR}, - question_d = #{questionD,jdbcType=VARCHAR}, - question_e = #{questionE,jdbcType=VARCHAR}, - answer = #{answer,jdbcType=VARCHAR}, - analysis = #{analysis,jdbcType=VARCHAR}, - school_id = #{schoolId,jdbcType=VARCHAR} - where objective_id = #{objectiveId,jdbcType=VARCHAR} - + school_id = #{record.schoolId,jdbcType=VARCHAR} + + + + + + update sys_objective_question + + + course_id = #{courseId,jdbcType=VARCHAR}, + + + course_name = #{courseName,jdbcType=VARCHAR}, + + + chapter_id = #{chapterId,jdbcType=VARCHAR}, + + + chapter_name = #{chapterName,jdbcType=VARCHAR}, + + + input_type = #{inputType,jdbcType=VARCHAR}, + + + type = #{type,jdbcType=VARCHAR}, + + + score = #{score,jdbcType=DECIMAL}, + + + content = #{content,jdbcType=VARCHAR}, + + + question_a = #{questionA,jdbcType=VARCHAR}, + + + question_b = #{questionB,jdbcType=VARCHAR}, + + + question_c = #{questionC,jdbcType=VARCHAR}, + + + question_d = #{questionD,jdbcType=VARCHAR}, + + + question_e = #{questionE,jdbcType=VARCHAR}, + + + answer = #{answer,jdbcType=VARCHAR}, + + + analysis = #{analysis,jdbcType=VARCHAR}, + + + school_id = #{schoolId,jdbcType=VARCHAR}, + + + where objective_id = #{objectiveId,jdbcType=VARCHAR} + + + update sys_objective_question + set course_id = #{courseId,jdbcType=VARCHAR}, + course_name = #{courseName,jdbcType=VARCHAR}, + chapter_id = #{chapterId,jdbcType=VARCHAR}, + chapter_name = #{chapterName,jdbcType=VARCHAR}, + input_type = #{inputType,jdbcType=VARCHAR}, + type = #{type,jdbcType=VARCHAR}, + score = #{score,jdbcType=DECIMAL}, + content = #{content,jdbcType=VARCHAR}, + question_a = #{questionA,jdbcType=VARCHAR}, + question_b = #{questionB,jdbcType=VARCHAR}, + question_c = #{questionC,jdbcType=VARCHAR}, + question_d = #{questionD,jdbcType=VARCHAR}, + question_e = #{questionE,jdbcType=VARCHAR}, + answer = #{answer,jdbcType=VARCHAR}, + analysis = #{analysis,jdbcType=VARCHAR}, + school_id = #{schoolId,jdbcType=VARCHAR} + where objective_id = #{objectiveId,jdbcType=VARCHAR} + + + + + + - + + - - + - + - + \ No newline at end of file