新增理论考试所有功能

newBigdata
yz 11 months ago
parent 9b1cda566d
commit e56506444f

@ -0,0 +1,31 @@
package com.sztzjy.financial_bigdata.controller.stu;
import com.sztzjy.financial_bigdata.annotation.AnonymousAccess;
import com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion;
import com.sztzjy.financial_bigdata.util.ResultEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@Api(tags = "实战考核")
@RequestMapping("api/stu/examController")
public class ExamController {
//基础知识题目展示
// @GetMapping("basicKnowledge")
// @ApiOperation("基础知识")
// @AnonymousAccess
// public ResultEntity<List<SysObjectiveQuestion>> basicKnowledge(@RequestParam String userId) {
//
// }
//交卷
//案例考核
}

@ -1,13 +1,20 @@
package com.sztzjy.financial_bigdata.controller.stu;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sztzjy.financial_bigdata.annotation.AnonymousAccess;
import com.sztzjy.financial_bigdata.entity.StuTheoryExam;
import com.sztzjy.financial_bigdata.entity.StuTheoryRecord;
import com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion;
import com.sztzjy.financial_bigdata.entity.stu_dto.StuTheoryExamDetailDto;
import com.sztzjy.financial_bigdata.entity.stu_dto.StuTheoryTestDto;
import com.sztzjy.financial_bigdata.mapper.StuTheoryRecordMapper;
import com.sztzjy.financial_bigdata.service.stu.ITheoryTestService;
import com.sztzjy.financial_bigdata.util.ResultEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
@ -20,6 +27,8 @@ import java.util.List;
public class TheoryTestController {
@Autowired
ITheoryTestService theoryTestService;
@Autowired
StuTheoryRecordMapper recordMapper;
//开始考试 选择 35道单选每题2分5道多选每题4分10道判断每题1分
@GetMapping("startTheoryTest")
@ -58,9 +67,45 @@ public class TheoryTestController {
}
//移除错题集
@GetMapping("removeError")
@ApiOperation("移除错题集")
public ResultEntity removeError(@RequestParam String userId,
@ApiParam("客观题id")@RequestParam String objectiveQuestionId,
@ApiParam("题目类型 single、many、judge")@RequestParam String type){
Boolean flag=theoryTestService.removeError(userId,objectiveQuestionId,type);
if(flag){
return new ResultEntity<>(HttpStatus.OK, "移除错题集成功");
}else {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "移除错题集失败");
}
}
//考试记录查询
@GetMapping("getTheoryTestList")
@ApiOperation("获取理论考试数据集")
public ResultEntity<PageInfo<StuTheoryExam>> getTheoryTestList(@RequestParam String userId,
@RequestParam Integer index,
@RequestParam Integer size){
PageInfo<StuTheoryExam> pageInfo=theoryTestService.getTheoryTestList(userId,index,size);
return new ResultEntity<>(HttpStatus.OK, "获取理论考试数据集成功",pageInfo);
}
//考试记录详情查询
//答题次数、平均正确率、排名
@GetMapping("getTheoryTestDetail")
@ApiOperation("获取理论考试数据详情")
public ResultEntity<List<StuTheoryExamDetailDto>> getTheoryTestDetail(@ApiParam("理论考试id")@RequestParam String theoryExamId,
@RequestParam Integer index,
@RequestParam Integer size){
List<StuTheoryExamDetailDto> detailDtoList=theoryTestService.getTheoryTestDetail(theoryExamId,index,size);
return new ResultEntity<>(HttpStatus.OK, "获取理论考试数据详情成功",detailDtoList);
}
//答题次数、平均正确率、排名(理论考试记录)
@GetMapping("getTheoryRecord")
@ApiOperation("获取理论考试记录数据")
public ResultEntity<StuTheoryRecord> getTheoryRecord(String userId){
StuTheoryRecord stuTheoryRecord = recordMapper.selectByPrimaryKey(userId);
return new ResultEntity<>(HttpStatus.OK, "获取理论考试记录数据成功",stuTheoryRecord);
}
}

@ -62,7 +62,7 @@ public class TeaObjectiveController {
@ApiOperation("客观题列表查看")
public ResultEntity<PageInfo<SysObjectiveQuestion>> selectObjectiveList(@RequestParam String schoolId,
@ApiParam("课程ID") @RequestParam String courseId,
@ApiParam("题目类型 0单选 1多选 2判断")@RequestParam(required = false)String type,
@ApiParam("题目类型 single单选 many多选 judge判断")@RequestParam(required = false)String type,
@ApiParam("搜索关键词")@RequestParam(required = false)String content,
@RequestParam Integer index,
@RequestParam Integer size) {

@ -42,13 +42,14 @@ public class TeaResourceCenterController {
//上传资源文件
@GetMapping("uploadResource")
@PostMapping("uploadResource")
@ApiOperation("上传资源文件")
@AnonymousAccess
public ResultEntity uploadResource(@RequestParam MultipartFile file,
@ApiParam("学校id") @RequestParam(required = false) String schoolId,
@ApiParam("章节Id") @RequestParam String chapterId,
@ApiParam("课程Id") @RequestParam String courseId,
@ApiParam("上传文件类型 文件/视频") @RequestParam String type) {
Boolean flag = resourceCenterService.uploadResource(file, schoolId, chapterId,type);
Boolean flag = resourceCenterService.uploadResource(file, schoolId, courseId,type);
if (flag) {
return new ResultEntity<>(HttpStatus.OK, "新增成功");
} else {
@ -61,14 +62,15 @@ public class TeaResourceCenterController {
@GetMapping("selectResource")
@ApiOperation("查看资源文件列表,图片资源使用默认图片")
public ResultEntity<List<TeaResourceCenter>> uploadResourceCenter(@ApiParam("学校id") @RequestParam(required = false) String schoolId,
@ApiParam("章节Id") @RequestParam String chapterId) {
List<TeaResourceCenter> list = resourceCenterService.selectResource(schoolId, chapterId);
@ApiParam("课程Id") @RequestParam String courseId) {
List<TeaResourceCenter> list = resourceCenterService.selectResource(schoolId, courseId);
return new ResultEntity(HttpStatus.OK, "查看资源文件列表,展示成功", list);
}
//下载资源文件
@GetMapping("downloadResource")
@ApiOperation("下载资源文件")
@AnonymousAccess
public void downloadResource(@ApiParam("资源ID") @RequestParam String resourceId, HttpServletResponse response) {
resourceCenterService.downloadResource(resourceId, response);
}
@ -76,6 +78,7 @@ public class TeaResourceCenterController {
//查看资源文件
@GetMapping("/getResource")
@ApiOperation("查看资源文件")
@AnonymousAccess
public ResponseEntity<FileSystemResource> streamVideo(@RequestParam String resourceId, HttpServletResponse response) {
TeaResourceCenter resourceCenter = resourceCenterMapper.selectByPrimaryKey(resourceId);
String url = resourceCenter.getResourceUrl();

@ -25,10 +25,10 @@ public class SysObjectiveQuestion {
@ApiModelProperty("章节名称")
private String chapterName;
@ApiModelProperty("内置,新增")
@ApiModelProperty("内置,新增 0为老师导入 1为内置")
private String inputType;
@ApiModelProperty("题目类型")
@ApiModelProperty("题目类型 0单选 1多选 2判断")
private String type;
@ApiModelProperty("分数")
@ -56,7 +56,7 @@ public class SysObjectiveQuestion {
private String answer;
@ApiModelProperty("答案解析")
private String analyze;
private String analysis;
@ApiModelProperty("学校Id")
private String schoolId;
@ -181,12 +181,12 @@ public class SysObjectiveQuestion {
this.answer = answer == null ? null : answer.trim();
}
public String getAnalyze() {
return analyze;
public String getAnalysis() {
return analysis;
}
public void setAnalyze(String analyze) {
this.analyze = analyze == null ? null : analyze.trim();
public void setAnalysis(String analysis) {
this.analysis = analysis == null ? null : analysis.trim();
}
public String getSchoolId() {

@ -1145,73 +1145,73 @@ public class SysObjectiveQuestionExample {
return (Criteria) this;
}
public Criteria andAnalyzeIsNull() {
addCriterion("analyze is null");
public Criteria andAnalysisIsNull() {
addCriterion("analysis is null");
return (Criteria) this;
}
public Criteria andAnalyzeIsNotNull() {
addCriterion("analyze is not null");
public Criteria andAnalysisIsNotNull() {
addCriterion("analysis is not null");
return (Criteria) this;
}
public Criteria andAnalyzeEqualTo(String value) {
addCriterion("analyze =", value, "analyze");
public Criteria andAnalysisEqualTo(String value) {
addCriterion("analysis =", value, "analysis");
return (Criteria) this;
}
public Criteria andAnalyzeNotEqualTo(String value) {
addCriterion("analyze <>", value, "analyze");
public Criteria andAnalysisNotEqualTo(String value) {
addCriterion("analysis <>", value, "analysis");
return (Criteria) this;
}
public Criteria andAnalyzeGreaterThan(String value) {
addCriterion("analyze >", value, "analyze");
public Criteria andAnalysisGreaterThan(String value) {
addCriterion("analysis >", value, "analysis");
return (Criteria) this;
}
public Criteria andAnalyzeGreaterThanOrEqualTo(String value) {
addCriterion("analyze >=", value, "analyze");
public Criteria andAnalysisGreaterThanOrEqualTo(String value) {
addCriterion("analysis >=", value, "analysis");
return (Criteria) this;
}
public Criteria andAnalyzeLessThan(String value) {
addCriterion("analyze <", value, "analyze");
public Criteria andAnalysisLessThan(String value) {
addCriterion("analysis <", value, "analysis");
return (Criteria) this;
}
public Criteria andAnalyzeLessThanOrEqualTo(String value) {
addCriterion("analyze <=", value, "analyze");
public Criteria andAnalysisLessThanOrEqualTo(String value) {
addCriterion("analysis <=", value, "analysis");
return (Criteria) this;
}
public Criteria andAnalyzeLike(String value) {
addCriterion("analyze like", value, "analyze");
public Criteria andAnalysisLike(String value) {
addCriterion("analysis like", value, "analysis");
return (Criteria) this;
}
public Criteria andAnalyzeNotLike(String value) {
addCriterion("analyze not like", value, "analyze");
public Criteria andAnalysisNotLike(String value) {
addCriterion("analysis not like", value, "analysis");
return (Criteria) this;
}
public Criteria andAnalyzeIn(List<String> values) {
addCriterion("analyze in", values, "analyze");
public Criteria andAnalysisIn(List<String> values) {
addCriterion("analysis in", values, "analysis");
return (Criteria) this;
}
public Criteria andAnalyzeNotIn(List<String> values) {
addCriterion("analyze not in", values, "analyze");
public Criteria andAnalysisNotIn(List<String> values) {
addCriterion("analysis not in", values, "analysis");
return (Criteria) this;
}
public Criteria andAnalyzeBetween(String value1, String value2) {
addCriterion("analyze between", value1, value2, "analyze");
public Criteria andAnalysisBetween(String value1, String value2) {
addCriterion("analysis between", value1, value2, "analysis");
return (Criteria) this;
}
public Criteria andAnalyzeNotBetween(String value1, String value2) {
addCriterion("analyze not between", value1, value2, "analyze");
public Criteria andAnalysisNotBetween(String value1, String value2) {
addCriterion("analysis not between", value1, value2, "analysis");
return (Criteria) this;
}

@ -11,8 +11,8 @@ public class TeaResourceCenter {
@ApiModelProperty("资源ID")
private String resourceId;
@ApiModelProperty("章节ID")
private String chapterId;
@ApiModelProperty("课程ID")
private String courseId;
@ApiModelProperty("资源地址")
private String resourceUrl;
@ -37,12 +37,12 @@ public class TeaResourceCenter {
this.resourceId = resourceId == null ? null : resourceId.trim();
}
public String getChapterId() {
return chapterId;
public String getCourseId() {
return courseId;
}
public void setChapterId(String chapterId) {
this.chapterId = chapterId == null ? null : chapterId.trim();
public void setCourseId(String courseId) {
this.courseId = courseId == null ? null : courseId.trim();
}
public String getResourceUrl() {

@ -174,73 +174,73 @@ public class TeaResourceCenterExample {
return (Criteria) this;
}
public Criteria andChapterIdIsNull() {
addCriterion("chapter_id is null");
public Criteria andCourseIdIsNull() {
addCriterion("course_id is null");
return (Criteria) this;
}
public Criteria andChapterIdIsNotNull() {
addCriterion("chapter_id is not null");
public Criteria andCourseIdIsNotNull() {
addCriterion("course_id is not null");
return (Criteria) this;
}
public Criteria andChapterIdEqualTo(String value) {
addCriterion("chapter_id =", value, "chapterId");
public Criteria andCourseIdEqualTo(String value) {
addCriterion("course_id =", value, "courseId");
return (Criteria) this;
}
public Criteria andChapterIdNotEqualTo(String value) {
addCriterion("chapter_id <>", value, "chapterId");
public Criteria andCourseIdNotEqualTo(String value) {
addCriterion("course_id <>", value, "courseId");
return (Criteria) this;
}
public Criteria andChapterIdGreaterThan(String value) {
addCriterion("chapter_id >", value, "chapterId");
public Criteria andCourseIdGreaterThan(String value) {
addCriterion("course_id >", value, "courseId");
return (Criteria) this;
}
public Criteria andChapterIdGreaterThanOrEqualTo(String value) {
addCriterion("chapter_id >=", value, "chapterId");
public Criteria andCourseIdGreaterThanOrEqualTo(String value) {
addCriterion("course_id >=", value, "courseId");
return (Criteria) this;
}
public Criteria andChapterIdLessThan(String value) {
addCriterion("chapter_id <", value, "chapterId");
public Criteria andCourseIdLessThan(String value) {
addCriterion("course_id <", value, "courseId");
return (Criteria) this;
}
public Criteria andChapterIdLessThanOrEqualTo(String value) {
addCriterion("chapter_id <=", value, "chapterId");
public Criteria andCourseIdLessThanOrEqualTo(String value) {
addCriterion("course_id <=", value, "courseId");
return (Criteria) this;
}
public Criteria andChapterIdLike(String value) {
addCriterion("chapter_id like", value, "chapterId");
public Criteria andCourseIdLike(String value) {
addCriterion("course_id like", value, "courseId");
return (Criteria) this;
}
public Criteria andChapterIdNotLike(String value) {
addCriterion("chapter_id not like", value, "chapterId");
public Criteria andCourseIdNotLike(String value) {
addCriterion("course_id not like", value, "courseId");
return (Criteria) this;
}
public Criteria andChapterIdIn(List<String> values) {
addCriterion("chapter_id in", values, "chapterId");
public Criteria andCourseIdIn(List<String> values) {
addCriterion("course_id in", values, "courseId");
return (Criteria) this;
}
public Criteria andChapterIdNotIn(List<String> values) {
addCriterion("chapter_id not in", values, "chapterId");
public Criteria andCourseIdNotIn(List<String> values) {
addCriterion("course_id not in", values, "courseId");
return (Criteria) this;
}
public Criteria andChapterIdBetween(String value1, String value2) {
addCriterion("chapter_id between", value1, value2, "chapterId");
public Criteria andCourseIdBetween(String value1, String value2) {
addCriterion("course_id between", value1, value2, "courseId");
return (Criteria) this;
}
public Criteria andChapterIdNotBetween(String value1, String value2) {
addCriterion("chapter_id not between", value1, value2, "chapterId");
public Criteria andCourseIdNotBetween(String value1, String value2) {
addCriterion("course_id not between", value1, value2, "courseId");
return (Criteria) this;
}

@ -0,0 +1,23 @@
package com.sztzjy.financial_bigdata.entity.stu_dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
public class StuTheoryExamDetailDto {
@ApiModelProperty("序号")
private String num;
@ApiModelProperty("题干")
private String content;
@ApiModelProperty("答案")
private String answer;
@ApiModelProperty("我的选项")
private String mychoice;
@ApiModelProperty("状态")
private String status;
@ApiModelProperty("得分")
private String score;
}

@ -62,7 +62,7 @@ public class SysObjectiveQuestionDto extends SysObjectiveQuestion{
private String answer;
@ApiModelProperty("答案解析")
private String analyze;
private String analysis;
@ApiModelProperty("学校Id")
private String schoolId;
@ -199,12 +199,12 @@ public class SysObjectiveQuestionDto extends SysObjectiveQuestion{
this.answer = answer;
}
public String getAnalyze() {
return analyze;
public String getAnalysis() {
return analysis;
}
public void setAnalyze(String analyze) {
this.analyze = analyze;
public void setAnalysis(String analysis) {
this.analysis = analysis;
}
public String getSchoolId() {
@ -233,7 +233,7 @@ public class SysObjectiveQuestionDto extends SysObjectiveQuestion{
this.questionD =sysObjectiveQuestion.getQuestionD();
this.questionE =sysObjectiveQuestion.getQuestionE();
this.answer =sysObjectiveQuestion.getAnswer();
this.analyze =sysObjectiveQuestion.getAnalyze();
this.analysis =sysObjectiveQuestion.getAnalysis();
this.schoolId =sysObjectiveQuestion.getSchoolId();
}
}

@ -1,6 +1,9 @@
package com.sztzjy.financial_bigdata.service.stu;
import com.github.pagehelper.PageInfo;
import com.sztzjy.financial_bigdata.entity.StuTheoryExam;
import com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion;
import com.sztzjy.financial_bigdata.entity.stu_dto.StuTheoryExamDetailDto;
import com.sztzjy.financial_bigdata.entity.stu_dto.StuTheoryTestDto;
import java.util.List;
@ -11,4 +14,10 @@ public interface ITheoryTestService {
int endTheoryTest(StuTheoryTestDto theoryTestDto);
List<SysObjectiveQuestion> selectErrors(String userId);
Boolean removeError(String userId, String objectiveQuestionId, String type);
PageInfo<StuTheoryExam> getTheoryTestList(String userId, Integer index, Integer size);
List<StuTheoryExamDetailDto> getTheoryTestDetail(String theoryExamId, Integer index, Integer size);
}

@ -13,10 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import java.util.*;
@Service
public class ExerciseServiceImpl implements IExerciseService {
@ -69,8 +66,8 @@ public class ExerciseServiceImpl implements IExerciseService {
trainingMapper.updateByPrimaryKey(bloBs);
return dtos;
}else {
if(bloBs.getLearningEvalAnswer().isEmpty()){ //判断是否提交过 未提交
List<String> learningEvalIdlist = Collections.singletonList(bloBs.getLearningEvalIdlist());
if(bloBs.getLearningEvalAnswer()==null){ //判断是否提交过 未提交
List<String> learningEvalIdlist = Arrays.asList(bloBs.getLearningEvalIdlist().substring(1, bloBs.getLearningEvalIdlist().length() - 1).split(", "));
for (int i = 0; i < learningEvalIdlist.size(); i++) {
String objectiveId = learningEvalIdlist.get(i);
SysObjectiveQuestion objectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(objectiveId);
@ -79,8 +76,8 @@ public class ExerciseServiceImpl implements IExerciseService {
}
return dtos;
}else { //提交
List<String> learningEvalAnswerList = Collections.singletonList(bloBs.getLearningEvalAnswer());
List<String> learningEvalIdlist = Collections.singletonList(bloBs.getLearningEvalIdlist());
List<String> learningEvalAnswerList = Arrays.asList(bloBs.getLearningEvalAnswer().substring(1, bloBs.getLearningEvalAnswer().length() - 1).split(", "));
List<String> learningEvalIdlist = Arrays.asList(bloBs.getLearningEvalIdlist().substring(1, bloBs.getLearningEvalIdlist().length() - 1).split(", "));
for (int i = 0; i < learningEvalIdlist.size(); i++) {
String objectiveId = learningEvalIdlist.get(i);
String stuAnswer = learningEvalAnswerList.get(i);
@ -102,7 +99,7 @@ public class ExerciseServiceImpl implements IExerciseService {
example.createCriteria().andUserIdEqualTo(userId).andChapterIdEqualTo(chapterId);
List<StuTrainingWithBLOBs> stuTrainingWithBLOBs = trainingMapper.selectByExampleWithBLOBs(example);
if (!stuTrainingWithBLOBs.get(0).getLearningEvalAnswer().isEmpty()){
if (stuTrainingWithBLOBs.get(0).getLearningEvalAnswer()!=null){
return false;
}
List<String> stuAnswerList = new ArrayList<>();
@ -129,7 +126,7 @@ public class ExerciseServiceImpl implements IExerciseService {
progress=progress.add(BigDecimal.valueOf(1));
}
bloBs.setProgress(progress);
int i = trainingMapper.updateByPrimaryKey(bloBs);
int i = trainingMapper.updateByPrimaryKeyWithBLOBs(bloBs);
return i==1;
}
}

@ -5,15 +5,15 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sztzjy.financial_bigdata.config.Constant;
import com.sztzjy.financial_bigdata.entity.*;
import com.sztzjy.financial_bigdata.entity.stu_dto.StuTheoryExamDetailDto;
import com.sztzjy.financial_bigdata.entity.stu_dto.StuTheoryTestDto;
import com.sztzjy.financial_bigdata.mapper.StuErrorMapper;
import com.sztzjy.financial_bigdata.mapper.StuTheoryExamMapper;
import com.sztzjy.financial_bigdata.mapper.SysObjectiveQuestionMapper;
import com.sztzjy.financial_bigdata.mapper.*;
import com.sztzjy.financial_bigdata.service.stu.ITheoryTestService;
import com.sztzjy.financial_bigdata.util.PageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.*;
@Service
@ -24,10 +24,15 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
SysObjectiveQuestionMapper objectiveQuestionMapper;
@Autowired
StuErrorMapper errorMapper;
@Autowired
StuUserMapper userMapper;
@Autowired
StuTheoryRecordMapper theoryRecordMapper;
//开始考试 1 先查询考试时间最近的一堂考试 判断是否超过2小时 如果没超过 根据理论考试表中的题目ID和答案进行回显
// 如果超过了两小时 定时方法算分将数据保存到理论考试表和理论记录表中 如果根据userid查询理论记录表中数据未null 则需要创建
// 之前没有进行考试 从客观题库表中查询 35道单选每题2分5道多选每题4分10道判断每题1分 并将id保存至理论考试表中
// 注意 开始考试后 要生成理论记录表基础数据
@Override
public List<SysObjectiveQuestion> startTheoryTest(String userId) {
StuTheoryExamExample example = new StuTheoryExamExample();
@ -36,6 +41,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
List<StuTheoryExamWithBLOBs> stuTheoryExams = theoryExamMapper.selectByExampleWithBLOBs(example);
if (stuTheoryExams.isEmpty()) { //之前没有进行考试
List<SysObjectiveQuestion> objectiveQuestionList = GenerateTest(userId);
GenerateTheoryRecordFirst(userId);
return objectiveQuestionList;
} else { //根据考试时间排序 查询最近的一条
StuTheoryExamWithBLOBs stuTheoryExam = stuTheoryExams.get(0);
@ -45,21 +51,21 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
List<SysObjectiveQuestion> objectiveQuestionList = GenerateTest(userId);
return objectiveQuestionList;
} else { //在两个小时内 返回最近的一条试卷
List<SysObjectiveQuestion> returnQuestionList=new ArrayList();
List<SysObjectiveQuestion> returnQuestionList = new ArrayList();
String singleIds = stuTheoryExam.getSingleIds();
String multipleIds = stuTheoryExam.getMultipleIds();
String judgeIds = stuTheoryExam.getJudgeIds();
List<String> singleIdList = Arrays.asList(singleIds);
List<String> singleIdList = Arrays.asList(singleIds.substring(1, singleIds.length() - 1).split(", "));
for (int i = 0; i < singleIdList.size(); i++) {
SysObjectiveQuestion objectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(singleIdList.get(i));
returnQuestionList.add(objectiveQuestion);
}
List<String> multipleIdList = Arrays.asList(multipleIds);
List<String> multipleIdList = Arrays.asList(multipleIds.substring(1, multipleIds.length() - 1).split(", "));
for (int i = 0; i < multipleIdList.size(); i++) {
SysObjectiveQuestion objectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(multipleIdList.get(i));
returnQuestionList.add(objectiveQuestion);
}
List<String> judgeIdList = Arrays.asList(judgeIds);
List<String> judgeIdList = Arrays.asList(judgeIds.substring(1, judgeIds.length() - 1).split(", "));
for (int i = 0; i < judgeIdList.size(); i++) {
SysObjectiveQuestion objectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(judgeIdList.get(i));
returnQuestionList.add(objectiveQuestion);
@ -69,6 +75,54 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
}
}
//第一次生成理论考试记录数据 先判断是否生成过理论考试记录数据
public void GenerateTheoryRecordFirst(String userId){
StuTheoryRecord record = theoryRecordMapper.selectByPrimaryKey(userId);
if(record==null){
StuUser stuUser = userMapper.selectByPrimaryKey(userId);
StuTheoryRecord stuTheoryRecord = new StuTheoryRecord();
stuTheoryRecord.setUserId(userId);
stuTheoryRecord.setSchoolId(stuUser.getSchoolId());
stuTheoryRecord.setClassId(stuUser.getClassId());
stuTheoryRecord.setName(stuUser.getName());
stuTheoryRecord.setStudentId(stuUser.getStudentId());
stuTheoryRecord.setExamCount(0);
}
}
public void UpdateTheoryRecord(String userId,BigDecimal score,Integer examDuration){
StuTheoryRecord record = theoryRecordMapper.selectByPrimaryKey(userId);
if(record!=null){
record.setExamCount(record.getExamCount()+1);
if(record.getHighestScore()==null){
record.setHighestScore(score);
}else {
if(record.getHighestScore().compareTo(score)<0){
record.setHighestScore(score);
}
}
if(record.getLowestScore()==null){
record.setLowestScore(score);
}else {
if(record.getLowestScore().compareTo(score)>0){
record.setLowestScore(score);
}
}
if(record.getTotalDuration()==null){
record.setTotalDuration(examDuration);
}else {
record.setTotalDuration(examDuration+record.getTotalDuration());
}
if(record.getAverageScore()==null){
record.setAverageScore(score);
}else {
Integer examCount = record.getExamCount();
BigDecimal averageScore = record.getAverageScore();
BigDecimal multiply = averageScore.multiply(BigDecimal.valueOf(examCount));
multiply.add(score).divide(BigDecimal.valueOf(examCount).add(BigDecimal.valueOf(1))).setScale(2,BigDecimal.ROUND_HALF_UP);
}
}
}
//随机生成100分题目
@ -102,13 +156,14 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
}
//交卷后 更新理论考试记录数据
@Override
public int endTheoryTest(StuTheoryTestDto theoryTestDto) {
StuTheoryExamExample example = new StuTheoryExamExample();
example.createCriteria().andUserIdEqualTo(theoryTestDto.getUserId());
example.setOrderByClause("exam_time DESC");
List<StuTheoryExamWithBLOBs> stuTheoryExams = theoryExamMapper.selectByExampleWithBLOBs(example);
StuTheoryExamWithBLOBs stuTheoryExam= stuTheoryExams.get(0);
StuTheoryExamWithBLOBs stuTheoryExam = stuTheoryExams.get(0);
stuTheoryExam.setExamDuration(theoryTestDto.getExamDuration());
stuTheoryExam.setScore(theoryTestDto.getScore());
stuTheoryExam.setAccuracy(theoryTestDto.getAccuracy());
@ -124,7 +179,7 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
StuErrorExample errorExample = new StuErrorExample();
errorExample.createCriteria().andUserIdEqualTo(theoryTestDto.getUserId());
List<StuErrorWithBLOBs> stuErrors = errorMapper.selectByExampleWithBLOBs(errorExample);
if(stuErrors.isEmpty()){
if (stuErrors.isEmpty()) {
StuErrorWithBLOBs stuError = new StuErrorWithBLOBs();
stuError.setErrorId(String.valueOf(UUID.randomUUID()));
stuError.setUserId(theoryTestDto.getUserId());
@ -132,10 +187,10 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
stuError.setMultipleIds(String.valueOf(theoryTestDto.getMultipleErrorIds()));
stuError.setJudgeIds(String.valueOf(theoryTestDto.getJudgeErrorIds()));
errorMapper.insert(stuError);
}else {
} else {
StuErrorWithBLOBs stuError = stuErrors.get(0);
if(!stuError.getSingleIds().isEmpty()){
List<String> stringList = Arrays.asList(stuError.getSingleIds());
if (!stuError.getSingleIds().isEmpty()) {
List<String> stringList = Arrays.asList(stuError.getSingleIds().substring(1, stuError.getSingleIds().length() - 1).split(", "));
List<String> singleErrorIds = theoryTestDto.getSingleErrorIds();
List<String> combinedList = new ArrayList<>(stringList);
@ -143,11 +198,11 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
Set<String> uniqueSet = new HashSet<>(combinedList);
List<String> uniqueList = new ArrayList<>(uniqueSet);
stuError.setSingleIds(String.valueOf(uniqueList));
}else {
} else {
stuError.setSingleIds(String.valueOf(theoryTestDto.getSingleErrorIds()));
}
if(!stuError.getMultipleIds().isEmpty()){
List<String> stringList = Arrays.asList(stuError.getMultipleIds());
if (!stuError.getMultipleIds().isEmpty()) {
List<String> stringList = Arrays.asList(stuError.getMultipleIds().substring(1, stuError.getMultipleIds().length() - 1).split(", "));
List<String> multipleErrorIds = theoryTestDto.getMultipleErrorIds();
List<String> combinedList = new ArrayList<>(stringList);
@ -155,22 +210,23 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
Set<String> uniqueSet = new HashSet<>(combinedList);
List<String> uniqueList = new ArrayList<>(uniqueSet);
stuError.setMultipleIds(String.valueOf(uniqueList));
}else {
} else {
stuError.setMultipleIds(String.valueOf(theoryTestDto.getMultipleErrorIds()));
}
if(!stuError.getJudgeIds().isEmpty()){
List<String> stringList = Arrays.asList(stuError.getJudgeIds());
if (!stuError.getJudgeIds().isEmpty()) {
List<String> stringList = Arrays.asList(stuError.getJudgeIds().substring(1, stuError.getJudgeIds().length() - 1).split(", "));
List<String> judgeErrorIds = theoryTestDto.getJudgeErrorIds();
List<String> combinedList = new ArrayList<>(stringList);
combinedList.addAll(judgeErrorIds);
Set<String> uniqueSet = new HashSet<>(combinedList);
List<String> uniqueList = new ArrayList<>(uniqueSet);
stuError.setJudgeIds(String.valueOf(uniqueList));
}else {
} else {
stuError.setJudgeIds(String.valueOf(theoryTestDto.getJudgeErrorIds()));
}
errorMapper.updateByPrimaryKey(stuError);
}
UpdateTheoryRecord(theoryTestDto.getUserId(),theoryTestDto.getScore(),theoryTestDto.getExamDuration());
return i;
}
@ -179,30 +235,30 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
StuErrorExample example = new StuErrorExample();
example.createCriteria().andUserIdEqualTo(userId);
List<StuErrorWithBLOBs> stuErrors = errorMapper.selectByExampleWithBLOBs(example);
if(stuErrors.isEmpty()){
if (stuErrors.isEmpty()) {
return null;
}else {
List<SysObjectiveQuestion> objectiveQuestionList=new ArrayList<>();
} else {
List<SysObjectiveQuestion> objectiveQuestionList = new ArrayList<>();
StuErrorWithBLOBs stuError = stuErrors.get(0);
String singleIds = stuError.getSingleIds();
if(!singleIds.isEmpty()){
List<String> singleIdList = Arrays.asList(singleIds);
if (!singleIds.isEmpty()) {
List<String> singleIdList = Arrays.asList(singleIds.substring(1, singleIds.length() - 1).split(", "));
for (int i = 0; i < singleIdList.size(); i++) {
SysObjectiveQuestion objectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(singleIdList.get(i));
objectiveQuestionList.add(objectiveQuestion);
}
}
String multipleIds = stuError.getMultipleIds();
if(!multipleIds.isEmpty()){
List<String> stringList = Arrays.asList(multipleIds);
if (!multipleIds.isEmpty()) {
List<String> stringList = Arrays.asList(multipleIds.substring(1, multipleIds.length() - 1).split(", "));
for (int i = 0; i < stringList.size(); i++) {
SysObjectiveQuestion objectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(stringList.get(i));
objectiveQuestionList.add(objectiveQuestion);
}
}
String judgeIds = stuError.getJudgeIds();
if(!judgeIds.isEmpty()){
List<String> stringList = Arrays.asList(judgeIds);
if (!judgeIds.isEmpty()) {
List<String> stringList = Arrays.asList(judgeIds.substring(1, judgeIds.length() - 1).split(", "));
for (int i = 0; i < stringList.size(); i++) {
SysObjectiveQuestion objectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(stringList.get(i));
objectiveQuestionList.add(objectiveQuestion);
@ -211,4 +267,106 @@ public class TheoryTestServiceImpl implements ITheoryTestService {
return objectiveQuestionList;
}
}
@Override
public Boolean removeError(String userId, String objectiveQuestionId, String type) {
StuErrorExample stuErrorExample = new StuErrorExample();
stuErrorExample.createCriteria().andUserIdEqualTo(userId);
List<StuErrorWithBLOBs> stuErrors = errorMapper.selectByExampleWithBLOBs(stuErrorExample);
if (stuErrors.isEmpty()) {
return false;
}
StuErrorWithBLOBs error = stuErrors.get(0);
if (Constant.OBJECTIVE_TYPE_SINGLE.equals(type)) {
List<String> stringList = Arrays.asList(error.getSingleIds().substring(1, stuErrors.get(0).getSingleIds().length() - 1).split(", "));
Set<String> set = new LinkedHashSet<>(stringList);
set.remove(objectiveQuestionId);
if(set.isEmpty()){
error.setSingleIds(null);
}else {
List<String> list = new ArrayList<>(set);
error.setSingleIds(String.valueOf(list));
}
}
if (Constant.OBJECTIVE_TYPE_Many.equals(type)) {
Set<String> set = new LinkedHashSet<>(Arrays.asList(error.getMultipleIds().substring(1, error.getMultipleIds().length() - 1).split(", ")));
set.remove(objectiveQuestionId);
if(set.isEmpty()){
error.setMultipleIds(null);
}else {
List<String> list = new ArrayList<>(set);
error.setMultipleIds(String.valueOf(list));
}
}
if(Constant.OBJECTIVE_TYPE_JUDGE.equals(type)){
Set<String> set = new LinkedHashSet<>(Arrays.asList(error.getJudgeIds().substring(1, error.getJudgeIds().length() - 1).split(", ")));
set.remove(objectiveQuestionId);
if(set.isEmpty()){
error.setJudgeIds(null);
}else {
List<String> list = new ArrayList<>(set);
error.setJudgeIds(String.valueOf(list));
}
}
int i = errorMapper.updateByPrimaryKeyWithBLOBs(error);
return i==1;
}
@Override
public PageInfo<StuTheoryExam> getTheoryTestList(String userId, Integer index, Integer size) {
PageHelper.startPage(index, size);
StuTheoryExamExample example = new StuTheoryExamExample();
example.createCriteria().andUserIdEqualTo(userId);
List<StuTheoryExam> stuTheoryExams = theoryExamMapper.selectByExample(example);
PageInfo<StuTheoryExam> pageInfo = new PageInfo<>(stuTheoryExams);
return pageInfo;
}
@Override
public List<StuTheoryExamDetailDto> getTheoryTestDetail(String theoryExamId, Integer index, Integer size) {
StuTheoryExamWithBLOBs theoryExam = theoryExamMapper.selectByPrimaryKey(theoryExamId);
String singleIds = theoryExam.getSingleIds();
ArrayList<String> idsList = new ArrayList<>();
List<String> singleIdList = Arrays.asList(singleIds.substring(1, singleIds.length() - 1).split(", "));
String multipleIds = theoryExam.getMultipleIds();
List<String> multipleIdList = Arrays.asList(multipleIds.substring(1, multipleIds.length() - 1).split(", "));
String judgeIds = theoryExam.getJudgeIds();
List<String> judgeIdList = Arrays.asList(judgeIds.substring(1, judgeIds.length() - 1).split(", "));
idsList.addAll(singleIdList);
idsList.addAll(multipleIdList);
idsList.addAll(judgeIdList);
ArrayList<String> answerList = new ArrayList<>();
List<String> singleStuAnswer =Arrays.asList(theoryExam.getSingleStuAnswer().substring(1, theoryExam.getSingleStuAnswer().length() - 1).split(", "));
List<String> multipleStuAnswer = Arrays.asList(theoryExam.getMultipleStuAnswer().substring(1, theoryExam.getMultipleStuAnswer().length() - 1).split(", "));
List<String> judgeStuAnswer = Arrays.asList(theoryExam.getJudgeStuAnswer().substring(1, theoryExam.getJudgeStuAnswer().length() - 1).split(", "));
answerList.addAll(singleStuAnswer);
answerList.addAll(multipleStuAnswer);
answerList.addAll(judgeStuAnswer);
List<StuTheoryExamDetailDto> detailDtos=new ArrayList<>();
for (Integer i = (index-1)*size; i < (index-1)*size+size; i++) {
StuTheoryExamDetailDto detailDto = new StuTheoryExamDetailDto();
String objectiveQuestionId = idsList.get(i);
String stuAnswer = answerList.get(i);
SysObjectiveQuestion objectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(objectiveQuestionId);
BigDecimal score = objectiveQuestion.getScore();
String content = objectiveQuestion.getContent();
String answer = objectiveQuestion.getAnswer();
if(answer.equals(stuAnswer)){
detailDto.setScore(String.valueOf(score));
detailDto.setStatus("正确");
}else {
detailDto.setScore("0");
detailDto.setStatus("错误");
}
detailDto.setContent(content);
detailDto.setMychoice(stuAnswer);
detailDto.setAnswer(answer);
detailDtos.add(detailDto);
}
return detailDtos;
}
}

@ -7,8 +7,8 @@ import javax.servlet.http.HttpServletResponse;
import java.util.List;
public interface ITeaResourceCenterService {
Boolean uploadResource(MultipartFile file, String schoolId,String chapterId,String type);
Boolean uploadResource(MultipartFile file, String schoolId,String courseId,String type);
List<TeaResourceCenter> selectResource(String schoolId, String chapterId);
List<TeaResourceCenter> selectResource(String schoolId, String courseId);
void downloadResource(String resourceId, HttpServletResponse response);
}

@ -71,11 +71,11 @@ public class TeaObjectiveServiceImpl implements ITeaObjectiveService {
SysObjectiveQuestionExample.Criteria criteria2 = example.createCriteria();
criteria.andSchoolIdEqualTo(schoolId).andCourseIdEqualTo(courseId);
criteria2.andSchoolIdEqualTo(Constant.BUILT_IN_SCHOOL_ID).andCourseIdEqualTo(courseId);
if(!type.isEmpty()){
if(type!=null){
criteria.andTypeEqualTo(type);
criteria2.andTypeEqualTo(type);
}
if(!content.isEmpty()){
if(content!=null){
criteria.andContentLike(content);
criteria2.andContentLike(content);
}
@ -142,7 +142,7 @@ public class TeaObjectiveServiceImpl implements ITeaObjectiveService {
obj.setQuestionC(question_c);
obj.setQuestionD(question_d);
obj.setAnswer(answer);
obj.setAnalyze(analyze);
obj.setAnalysis(analyze);
obj.setSchoolId(schoolId);
objectiveQuestionList.add(obj);
}
@ -187,7 +187,7 @@ public class TeaObjectiveServiceImpl implements ITeaObjectiveService {
obj.setQuestionC(question_c);
obj.setQuestionD(question_d);
obj.setAnswer(answer);
obj.setAnalyze(analyze);
obj.setAnalysis(analyze);
obj.setSchoolId(schoolId);
objectiveQuestionList.add(obj);
}

@ -20,13 +20,13 @@ public class TeaResourceCenterServiceImpl implements ITeaResourceCenterService {
@Autowired
TeaResourceCenterMapper resourceCenterMapper;
@Override
public Boolean uploadResource(MultipartFile file, String schoolId,String chapterId,String type) {
public Boolean uploadResource(MultipartFile file, String schoolId,String courseId,String type) {
String uploadUrl = fileUtil.upload(file);
TeaResourceCenter resourceCenter=new TeaResourceCenter();
resourceCenter.setResourceId(String.valueOf(UUID.randomUUID()));
resourceCenter.setResourceName(file.getOriginalFilename());
resourceCenter.setResourceUrl(uploadUrl);
resourceCenter.setChapterId(chapterId);
resourceCenter.setCourseId(courseId);
resourceCenter.setSchoolId(schoolId);
resourceCenter.setType(type);
resourceCenter.setImageUrl(null);
@ -39,12 +39,12 @@ public class TeaResourceCenterServiceImpl implements ITeaResourceCenterService {
}
@Override
public List<TeaResourceCenter> selectResource(String schoolId, String chapterId) {
public List<TeaResourceCenter> selectResource(String schoolId, String courseId) {
TeaResourceCenterExample example=new TeaResourceCenterExample();
TeaResourceCenterExample.Criteria criteria = example.createCriteria();
TeaResourceCenterExample.Criteria criteria2 = example.createCriteria();
criteria.andChapterIdEqualTo(chapterId).andSchoolIdEqualTo(schoolId);
criteria2.andChapterIdEqualTo(chapterId).andSchoolIdIsNull();
criteria.andCourseIdEqualTo(courseId).andSchoolIdEqualTo(schoolId);
criteria2.andCourseIdEqualTo(courseId).andSchoolIdIsNull();
example.or(criteria2);
List<TeaResourceCenter> teaResourceCenterList = resourceCenterMapper.selectByExample(example);
return teaResourceCenterList;

@ -208,4 +208,17 @@
input_type = #{inputType,jdbcType=VARCHAR}
where course_id = #{courseId,jdbcType=VARCHAR}
</update>
<select id="selectCourse" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
FROM
sys_course
ORDER BY
CASE
WHEN input_type != '0' THEN sequence
END ASC,
CASE
WHEN input_type = '0' AND school_id = '999999999' THEN sequence
END ASC
</select>
</mapper>

@ -17,7 +17,7 @@
<result column="question_d" jdbcType="VARCHAR" property="questionD" />
<result column="question_e" jdbcType="VARCHAR" property="questionE" />
<result column="answer" jdbcType="VARCHAR" property="answer" />
<result column="analyze" jdbcType="VARCHAR" property="analyze" />
<result column="analysis" jdbcType="VARCHAR" property="analysis" />
<result column="school_id" jdbcType="VARCHAR" property="schoolId" />
</resultMap>
<sql id="Example_Where_Clause">
@ -81,7 +81,7 @@
<sql id="Base_Column_List">
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,
analyze, school_id
analysis, school_id
</sql>
<select id="selectByExample" parameterType="com.sztzjy.financial_bigdata.entity.SysObjectiveQuestionExample" resultMap="BaseResultMap">
select
@ -119,13 +119,13 @@
type, score, content,
question_a, question_b, question_c,
question_d, question_e, answer,
analyze, school_id)
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},
#{analyze,jdbcType=VARCHAR}, #{schoolId,jdbcType=VARCHAR})
#{analysis,jdbcType=VARCHAR}, #{schoolId,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.sztzjy.financial_bigdata.entity.SysObjectiveQuestion">
insert into sys_objective_question
@ -175,8 +175,8 @@
<if test="answer != null">
answer,
</if>
<if test="analyze != null">
analyze,
<if test="analysis != null">
analysis,
</if>
<if test="schoolId != null">
school_id,
@ -228,8 +228,8 @@
<if test="answer != null">
#{answer,jdbcType=VARCHAR},
</if>
<if test="analyze != null">
#{analyze,jdbcType=VARCHAR},
<if test="analysis != null">
#{analysis,jdbcType=VARCHAR},
</if>
<if test="schoolId != null">
#{schoolId,jdbcType=VARCHAR},
@ -290,8 +290,8 @@
<if test="record.answer != null">
answer = #{record.answer,jdbcType=VARCHAR},
</if>
<if test="record.analyze != null">
analyze = #{record.analyze,jdbcType=VARCHAR},
<if test="record.analysis != null">
analysis = #{record.analysis,jdbcType=VARCHAR},
</if>
<if test="record.schoolId != null">
school_id = #{record.schoolId,jdbcType=VARCHAR},
@ -318,7 +318,7 @@
question_d = #{record.questionD,jdbcType=VARCHAR},
question_e = #{record.questionE,jdbcType=VARCHAR},
answer = #{record.answer,jdbcType=VARCHAR},
analyze = #{record.analyze,jdbcType=VARCHAR},
analysis = #{record.analysis,jdbcType=VARCHAR},
school_id = #{record.schoolId,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -369,8 +369,8 @@
<if test="answer != null">
answer = #{answer,jdbcType=VARCHAR},
</if>
<if test="analyze != null">
analyze = #{analyze,jdbcType=VARCHAR},
<if test="analysis != null">
analysis = #{analysis,jdbcType=VARCHAR},
</if>
<if test="schoolId != null">
school_id = #{schoolId,jdbcType=VARCHAR},
@ -394,13 +394,17 @@
question_d = #{questionD,jdbcType=VARCHAR},
question_e = #{questionE,jdbcType=VARCHAR},
answer = #{answer,jdbcType=VARCHAR},
analyze = #{analyze,jdbcType=VARCHAR},
analysis = #{analysis,jdbcType=VARCHAR},
school_id = #{schoolId,jdbcType=VARCHAR}
where objective_id = #{objectiveId,jdbcType=VARCHAR}
</update>
<select id="selectRandomObjective" parameterType="map" resultMap="BaseResultMap">
SELECT * FROM sys_objective_question
WHERE chapter_id #{chapterId,jdbcType=VARCHAR}
SELECT
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, school_id
FROM sys_objective_question
WHERE chapter_id = #{chapterId,jdbcType=VARCHAR}
ORDER BY RAND()
LIMIT 10
</select>

@ -3,7 +3,7 @@
<mapper namespace="com.sztzjy.financial_bigdata.mapper.TeaResourceCenterMapper">
<resultMap id="BaseResultMap" type="com.sztzjy.financial_bigdata.entity.TeaResourceCenter">
<id column="resource_id" jdbcType="VARCHAR" property="resourceId" />
<result column="chapter_id" jdbcType="VARCHAR" property="chapterId" />
<result column="course_id" jdbcType="VARCHAR" property="courseId" />
<result column="resource_url" jdbcType="VARCHAR" property="resourceUrl" />
<result column="image_url" jdbcType="VARCHAR" property="imageUrl" />
<result column="resource_name" jdbcType="VARCHAR" property="resourceName" />
@ -69,7 +69,7 @@
</where>
</sql>
<sql id="Base_Column_List">
resource_id, chapter_id, resource_url, image_url, resource_name, school_id, type
resource_id, course_id, resource_url, image_url, resource_name, school_id, type
</sql>
<select id="selectByExample" parameterType="com.sztzjy.financial_bigdata.entity.TeaResourceCenterExample" resultMap="BaseResultMap">
select
@ -102,10 +102,10 @@
</if>
</delete>
<insert id="insert" parameterType="com.sztzjy.financial_bigdata.entity.TeaResourceCenter">
insert into tea_resource_center (resource_id, chapter_id, resource_url,
insert into tea_resource_center (resource_id, course_id, resource_url,
image_url, resource_name, school_id,
type)
values (#{resourceId,jdbcType=VARCHAR}, #{chapterId,jdbcType=VARCHAR}, #{resourceUrl,jdbcType=VARCHAR},
values (#{resourceId,jdbcType=VARCHAR}, #{courseId,jdbcType=VARCHAR}, #{resourceUrl,jdbcType=VARCHAR},
#{imageUrl,jdbcType=VARCHAR}, #{resourceName,jdbcType=VARCHAR}, #{schoolId,jdbcType=VARCHAR},
#{type,jdbcType=VARCHAR})
</insert>
@ -115,8 +115,8 @@
<if test="resourceId != null">
resource_id,
</if>
<if test="chapterId != null">
chapter_id,
<if test="courseId != null">
course_id,
</if>
<if test="resourceUrl != null">
resource_url,
@ -138,8 +138,8 @@
<if test="resourceId != null">
#{resourceId,jdbcType=VARCHAR},
</if>
<if test="chapterId != null">
#{chapterId,jdbcType=VARCHAR},
<if test="courseId != null">
#{courseId,jdbcType=VARCHAR},
</if>
<if test="resourceUrl != null">
#{resourceUrl,jdbcType=VARCHAR},
@ -170,8 +170,8 @@
<if test="record.resourceId != null">
resource_id = #{record.resourceId,jdbcType=VARCHAR},
</if>
<if test="record.chapterId != null">
chapter_id = #{record.chapterId,jdbcType=VARCHAR},
<if test="record.courseId != null">
course_id = #{record.courseId,jdbcType=VARCHAR},
</if>
<if test="record.resourceUrl != null">
resource_url = #{record.resourceUrl,jdbcType=VARCHAR},
@ -196,7 +196,7 @@
<update id="updateByExample" parameterType="map">
update tea_resource_center
set resource_id = #{record.resourceId,jdbcType=VARCHAR},
chapter_id = #{record.chapterId,jdbcType=VARCHAR},
course_id = #{record.courseId,jdbcType=VARCHAR},
resource_url = #{record.resourceUrl,jdbcType=VARCHAR},
image_url = #{record.imageUrl,jdbcType=VARCHAR},
resource_name = #{record.resourceName,jdbcType=VARCHAR},
@ -209,8 +209,8 @@
<update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.financial_bigdata.entity.TeaResourceCenter">
update tea_resource_center
<set>
<if test="chapterId != null">
chapter_id = #{chapterId,jdbcType=VARCHAR},
<if test="courseId != null">
course_id = #{courseId,jdbcType=VARCHAR},
</if>
<if test="resourceUrl != null">
resource_url = #{resourceUrl,jdbcType=VARCHAR},
@ -232,7 +232,7 @@
</update>
<update id="updateByPrimaryKey" parameterType="com.sztzjy.financial_bigdata.entity.TeaResourceCenter">
update tea_resource_center
set chapter_id = #{chapterId,jdbcType=VARCHAR},
set course_id = #{courseId,jdbcType=VARCHAR},
resource_url = #{resourceUrl,jdbcType=VARCHAR},
image_url = #{imageUrl,jdbcType=VARCHAR},
resource_name = #{resourceName,jdbcType=VARCHAR},

Loading…
Cancel
Save