Merge branch 'test-training2' of https://git.code.tencent.com/lian-cbtc/rtss-server into test-training2-xzb1
This commit is contained in:
commit
c90d5d2394
@ -1,14 +1,16 @@
|
|||||||
-- 新题库
|
-- 新题库
|
||||||
DROP TABLE IF EXISTS `race_question2`;
|
DROP TABLE IF EXISTS `paper_question`;
|
||||||
CREATE TABLE `race_question2` (
|
CREATE TABLE `paper_question` (
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||||
`type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '类型 选择题=select,判断题=judge,多选题=multi',
|
`type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '类型 选择题=select,判断题=judge,多选题=multi',
|
||||||
`topic` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci COMMENT '问题内容',
|
`question` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci COMMENT '问题内容',
|
||||||
`create_user_id` bigint DEFAULT NULL COMMENT '创建者id',
|
`create_user_id` bigint DEFAULT NULL COMMENT '创建者id',
|
||||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||||
`project_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '项目code',
|
`project_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '项目code',
|
||||||
`company_id` bigint DEFAULT NULL COMMENT '公司组织id',
|
`company_id` bigint DEFAULT NULL COMMENT '公司组织id',
|
||||||
`race_lable` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '标签',
|
`race_lable` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '标签',
|
||||||
`questions` longtext,
|
`question_option` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci COMMENT '问题选项',
|
||||||
|
`question_answer` varchar(255) DEFAULT NULL COMMENT '答案,号隔开',
|
||||||
|
`is_del` int DEFAULT '0' COMMENT '是否删除0=否,1=是',
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package club.joylink.rtss.controller.competition.question;
|
package club.joylink.rtss.controller.paper;
|
||||||
|
|
||||||
|
|
||||||
import club.joylink.rtss.services.papger.PagerQuestionService;
|
import club.joylink.rtss.services.papger.PagerQuestionService;
|
||||||
@ -120,8 +120,8 @@ public class PagerQuestionBankController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*@PostMapping(path = "answer/{questionId}")
|
/* @PostMapping(path = "answer/{questionId}")
|
||||||
public void answer(@PathVariable Long questionId,@RequestBody List<String> answer){
|
public void answer(@PathVariable Long questionId,@RequestBody List<Integer> answer){
|
||||||
this.questionBankService.answer(questionId,answer);
|
this.questionBankService.answer(questionId,answer);
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
@ -3,6 +3,7 @@ package club.joylink.rtss.dao.paper;
|
|||||||
import club.joylink.rtss.dao.MyBatisBaseDao;
|
import club.joylink.rtss.dao.MyBatisBaseDao;
|
||||||
import club.joylink.rtss.entity.paper.question.PaperQuestion;
|
import club.joylink.rtss.entity.paper.question.PaperQuestion;
|
||||||
import club.joylink.rtss.entity.paper.question.PaperQuestionExample;
|
import club.joylink.rtss.entity.paper.question.PaperQuestionExample;
|
||||||
|
import club.joylink.rtss.entity.project.Project;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
@ -15,7 +16,7 @@ public interface PagerQuestionDAO extends MyBatisBaseDao<PaperQuestion, Long, Pa
|
|||||||
@Select("<script>" +
|
@Select("<script>" +
|
||||||
"select * from paper_question where 1 = 1 " +
|
"select * from paper_question where 1 = 1 " +
|
||||||
"<choose>" +
|
"<choose>" +
|
||||||
"<when test=\"projectCode == 'DEFAULT'\">"+
|
"<when test=\"projectCode == '"+ Project.DEFAULT_PROJECT_CODE +"'\">"+
|
||||||
" and project_code is null" +
|
" and project_code is null" +
|
||||||
"</when>"+
|
"</when>"+
|
||||||
" <otherwise>"+
|
" <otherwise>"+
|
||||||
|
@ -50,8 +50,9 @@ public class PaperQuestion implements Serializable {
|
|||||||
* 是否删除0=否,1=是
|
* 是否删除0=否,1=是
|
||||||
*/
|
*/
|
||||||
private Integer isDel;
|
private Integer isDel;
|
||||||
private String topic;
|
private String question;
|
||||||
|
|
||||||
private String questions;
|
private String questionOption;
|
||||||
|
private String questionAnswer;
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
}
|
}
|
||||||
|
@ -109,29 +109,35 @@ public class PagerQuestionService {
|
|||||||
/**
|
/**
|
||||||
* 检测题目是否正确
|
* 检测题目是否正确
|
||||||
* @param questionId 题目id
|
* @param questionId 题目id
|
||||||
* @param answer 检测的答案
|
* @param answerIds 检测的答案Id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean answer(Long questionId,List<String> answer){
|
public boolean answer(Long questionId,List<Integer> answerIds){
|
||||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(!CollectionUtils.isEmpty(answer),"题目答案不能为空");
|
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(!CollectionUtils.isEmpty(answerIds),"题目答案不能为空");
|
||||||
PaperQuestionVO vo = this.getQuestion(questionId,true);
|
PaperQuestionVO vo = this.getQuestion(questionId,true);
|
||||||
List<String> newAnswerList = answer.stream().filter(Objects::nonNull).map(String::trim).distinct().collect(Collectors.toList());
|
List<Integer> newAnswerList = answerIds.stream().filter(Objects::nonNull)/*.map(String::trim)*/.distinct().collect(Collectors.toList());
|
||||||
List<String> optionList = vo.getOptionList().stream().filter(PaperQuestionOptionVO2::getCorrect).map(d->d.getContent().trim()).collect(Collectors.toList());
|
// List<Integer> optionList = vo.getOptionList().stream().filter(PaperQuestionOptionVO2::getCorrect).map(d->d.getId()).collect(Collectors.toList());
|
||||||
|
|
||||||
if(Objects.equals(BusinessConsts.TheoryType.select.name(),vo.getType())
|
if(Objects.equals(BusinessConsts.TheoryType.select.name(),vo.getType())
|
||||||
|| Objects.equals(BusinessConsts.TheoryType.judge.name(),vo.getType())){
|
|| Objects.equals(BusinessConsts.TheoryType.judge.name(),vo.getType())){
|
||||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(newAnswerList.size() != 1 ,"单选,判断题答案只能有一个!");
|
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(newAnswerList.size() == 1 ,"单选,判断题答案只能有一个!");
|
||||||
}else if(Objects.equals(BusinessConsts.TheoryType.multi.name(),vo.getType())){
|
}else if(Objects.equals(BusinessConsts.TheoryType.multi.name(),vo.getType())){
|
||||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(newAnswerList.size() < 2 ,"多选题答案最少需要2个");
|
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(newAnswerList.size() > 2 ,"多选题答案最少需要2个");
|
||||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(newAnswerList.size() > optionList.size(),"多选题答案与标准答案数量不匹配");
|
// BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(newAnswerList.size() < optionList.size(),"多选题答案与标准答案数量不匹配");
|
||||||
}
|
}
|
||||||
List<String> sourceOptionList = Lists.newArrayList();
|
// List<Integer> sourceOptionList = Lists.newArrayList();
|
||||||
sourceOptionList.addAll(optionList);
|
// sourceOptionList.addAll(optionList);
|
||||||
optionList.removeAll(newAnswerList);
|
// optionList.removeAll(newAnswerList);
|
||||||
if(CollectionUtils.isEmpty(optionList)){
|
// if(CollectionUtils.isEmpty(optionList)){
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
Collections.sort(answerIds);
|
||||||
|
String answerStr = Joiner.on(",").join(answerIds);
|
||||||
|
if(Objects.equals(answerStr,vo.getQuestionAnswer())){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
log.info("检查题目[{}]答案,获取原答案[{}],正确答案[{}] 有[{}]没有答对",questionId, Joiner.on(",").join(answer),Joiner.on(",").join(sourceOptionList),Joiner.on(",").join(optionList));
|
log.info("检查题目[{}]答案,获取原答案[{}],正确答案[{}] ",questionId, answerStr,vo.getQuestionAnswer());
|
||||||
|
// log.info("检查题目[{}]答案,获取原答案[{}],正确答案[{}] 有[{}]没有答对",questionId, Joiner.on(",").join(answerIds),Joiner.on(",").join(sourceOptionList),Joiner.on(",").join(optionList));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,15 +195,6 @@ public class PagerQuestionService {
|
|||||||
}else if(questionVO.isMulti()){
|
}else if(questionVO.isMulti()){
|
||||||
this.checkQuestionTypeForMulti(questionVO,"多选题正确答案必须是2个以上!");
|
this.checkQuestionTypeForMulti(questionVO,"多选题正确答案必须是2个以上!");
|
||||||
}
|
}
|
||||||
/* BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(
|
|
||||||
(Objects.equals(BusinessConsts.TheoryType.select.name(), questionVO.getType()) ||
|
|
||||||
Objects.equals(BusinessConsts.TheoryType.judge.name(), questionVO.getType())) &&
|
|
||||||
questionVO.getOptionList().stream().filter(PaperQuestionOptionVO2::getCorrect).count() == 1,
|
|
||||||
"单选或判断题正确答案有且只有一个!");
|
|
||||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(
|
|
||||||
(Objects.equals(BusinessConsts.TheoryType.multi.name(), questionVO.getType())) &&
|
|
||||||
questionVO.getOptionList().stream().filter(PaperQuestionOptionVO2::getCorrect).count() <= 1,
|
|
||||||
"多选题正确答案必须是2个以上!");*/
|
|
||||||
PaperQuestion question = questionVO.convert2DB();
|
PaperQuestion question = questionVO.convert2DB();
|
||||||
question.setCreateUserId(accountVO.getId());
|
question.setCreateUserId(accountVO.getId());
|
||||||
question.setCreateTime(LocalDateTime.now());
|
question.setCreateTime(LocalDateTime.now());
|
||||||
@ -232,14 +229,14 @@ public class PagerQuestionService {
|
|||||||
|
|
||||||
private void checkQuestionTypeForMulti(PaperQuestionVO vo,String errStr){
|
private void checkQuestionTypeForMulti(PaperQuestionVO vo,String errStr){
|
||||||
long answerCount = vo.getOptionList().stream().filter(PaperQuestionOptionVO2::getCorrect).count();
|
long answerCount = vo.getOptionList().stream().filter(PaperQuestionOptionVO2::getCorrect).count();
|
||||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(answerCount <=1,errStr);
|
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(answerCount > 2,errStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void importProjectQuestion(List<PaperQuestionVO> questions, String projectCode, Long companyId, AccountVO accountVO) {
|
public void importProjectQuestion(List<PaperQuestionVO> questions, String projectCode, Long companyId, AccountVO accountVO) {
|
||||||
|
|
||||||
questions.forEach(questionVO -> {
|
questions.forEach(questionVO -> {
|
||||||
String topic = questionVO.getTopic();
|
String topic = questionVO.getQuestion();
|
||||||
this.checkQuestionType(questionVO,String.format("题库目前只支持单选,多选和判断,题序[%s]",questionVO.getId()));
|
this.checkQuestionType(questionVO,String.format("题库目前只支持单选,多选和判断,题序[%s]",questionVO.getId()));
|
||||||
if (questionVO.isSelect() || questionVO.isJudge()) {
|
if (questionVO.isSelect() || questionVO.isJudge()) {
|
||||||
this.checkQuestionTypeForSelectAndJudge(questionVO,String.format("题序[%s]:单选或判断题[%s]正确答案应当有且只有一个!", questionVO.getId(),topic));
|
this.checkQuestionTypeForSelectAndJudge(questionVO,String.format("题序[%s]:单选或判断题[%s]正确答案应当有且只有一个!", questionVO.getId(),topic));
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package club.joylink.rtss.vo.client.pager.question;
|
package club.joylink.rtss.vo.client.pager.question;
|
||||||
|
|
||||||
import club.joylink.rtss.entity.RaceQuestionOption;
|
import club.joylink.rtss.entity.RaceQuestionOption;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@ -19,8 +20,8 @@ import java.util.List;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class PaperQuestionOptionVO2 implements Cloneable {
|
public class PaperQuestionOptionVO2 implements Cloneable {
|
||||||
|
|
||||||
private Long id;
|
private int id;
|
||||||
private Long questionId;
|
// private Long questionId;
|
||||||
/**
|
/**
|
||||||
* 选项
|
* 选项
|
||||||
*/
|
*/
|
||||||
@ -30,24 +31,25 @@ public class PaperQuestionOptionVO2 implements Cloneable {
|
|||||||
* 正确的
|
* 正确的
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "题目没有设置正确选项")
|
@NotNull(message = "题目没有设置正确选项")
|
||||||
|
// @JsonIgnore
|
||||||
private Boolean correct;
|
private Boolean correct;
|
||||||
|
|
||||||
public PaperQuestionOptionVO2(RaceQuestionOption questionOption) {
|
public PaperQuestionOptionVO2(RaceQuestionOption questionOption) {
|
||||||
this.id = questionOption.getId();
|
this.id = questionOption.getId().intValue();
|
||||||
this.questionId = questionOption.getQuestionId();
|
// this.questionId = questionOption.getQuestionId();
|
||||||
this.content = questionOption.getContent();
|
this.content = questionOption.getContent();
|
||||||
this.correct = questionOption.getCorrect();
|
this.correct = questionOption.getCorrect();
|
||||||
}
|
}
|
||||||
|
|
||||||
public RaceQuestionOption convert2DB() {
|
// public RaceQuestionOption convert2DB() {
|
||||||
RaceQuestionOption questionOption = new RaceQuestionOption();
|
// RaceQuestionOption questionOption = new RaceQuestionOption();
|
||||||
questionOption.setId(id);
|
// questionOption.setId(id);
|
||||||
questionOption.setQuestionId(questionId);
|
//// questionOption.setQuestionId(questionId);
|
||||||
questionOption.setContent(content);
|
// questionOption.setContent(content);
|
||||||
questionOption.setCorrect(correct);
|
// questionOption.setCorrect(correct);
|
||||||
|
//
|
||||||
return questionOption;
|
// return questionOption;
|
||||||
}
|
// }
|
||||||
|
|
||||||
public static List<PaperQuestionOptionVO2> convert2VOList(List<RaceQuestionOption> options){
|
public static List<PaperQuestionOptionVO2> convert2VOList(List<RaceQuestionOption> options){
|
||||||
List<PaperQuestionOptionVO2> voList = new ArrayList<>();
|
List<PaperQuestionOptionVO2> voList = new ArrayList<>();
|
||||||
|
@ -5,14 +5,18 @@ import club.joylink.rtss.constants.Project;
|
|||||||
import club.joylink.rtss.entity.paper.question.PaperQuestion;
|
import club.joylink.rtss.entity.paper.question.PaperQuestion;
|
||||||
import club.joylink.rtss.util.JsonUtils;
|
import club.joylink.rtss.util.JsonUtils;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.JavaType;
|
||||||
|
import com.google.common.base.Joiner;
|
||||||
|
import com.google.common.base.Splitter;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -24,7 +28,6 @@ import java.util.stream.Collectors;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class PaperQuestionVO implements Cloneable {
|
public class PaperQuestionVO implements Cloneable {
|
||||||
|
|
||||||
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,7 +40,7 @@ public class PaperQuestionVO implements Cloneable {
|
|||||||
*题目
|
*题目
|
||||||
*/
|
*/
|
||||||
@NotBlank(message = "题目不能为空")
|
@NotBlank(message = "题目不能为空")
|
||||||
private String topic;
|
private String question;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*选项列表
|
*选项列表
|
||||||
@ -51,6 +54,9 @@ public class PaperQuestionVO implements Cloneable {
|
|||||||
private String projectCode;
|
private String projectCode;
|
||||||
private Long companyId;
|
private Long companyId;
|
||||||
private String raceLable;
|
private String raceLable;
|
||||||
|
private String questionAnswer;
|
||||||
|
private String answer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*分值
|
*分值
|
||||||
*/
|
*/
|
||||||
@ -60,25 +66,54 @@ public class PaperQuestionVO implements Cloneable {
|
|||||||
public PaperQuestionVO(PaperQuestion question) {
|
public PaperQuestionVO(PaperQuestion question) {
|
||||||
this.id = question.getId();
|
this.id = question.getId();
|
||||||
this.type = question.getType();
|
this.type = question.getType();
|
||||||
this.topic = question.getTopic();
|
this.question = question.getQuestion();
|
||||||
this.projectCode = question.getProjectCode();
|
this.projectCode = question.getProjectCode();
|
||||||
this.companyId = question.getCompanyId();
|
this.companyId = question.getCompanyId();
|
||||||
this.raceLable = question.getRaceLable();
|
this.raceLable = question.getRaceLable();
|
||||||
this.optionList = JsonUtils.readCollection(question.getQuestions(),ArrayList.class, PaperQuestionOptionVO2.class);
|
this.optionList = JsonUtils.readCollection(question.getQuestionOption(),ArrayList.class, PaperQuestionOptionVO2.class);
|
||||||
|
String dd = Objects.isNull(question.getQuestionAnswer()) ? "" : question.getQuestionAnswer();
|
||||||
|
this.answer = dd;
|
||||||
|
List<String> answerList = Splitter.on(",").splitToList(dd);
|
||||||
|
for (PaperQuestionOptionVO2 vo : this.optionList) {
|
||||||
|
vo.setCorrect(false);
|
||||||
|
if(answerList.contains(vo.getId() + "")){
|
||||||
|
vo.setCorrect(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PaperQuestion convert2DB() {
|
public PaperQuestion convert2DB() {
|
||||||
PaperQuestion question = new PaperQuestion();
|
PaperQuestion question = new PaperQuestion();
|
||||||
question.setId(this.id);
|
question.setId(this.id);
|
||||||
question.setType(type);
|
question.setType(type);
|
||||||
question.setTopic(topic);
|
question.setQuestion(this.question);
|
||||||
question.setProjectCode(Project.isDefault(Project.valueOf(projectCode)) ? null : projectCode);
|
question.setProjectCode(Project.isDefault(Project.valueOf(projectCode)) ? null : projectCode);
|
||||||
question.setCompanyId(companyId);
|
question.setCompanyId(companyId);
|
||||||
question.setQuestions(JsonUtils.writeValueAsString(this.optionList));
|
this.setOptionId(question);
|
||||||
|
|
||||||
|
String dd = JsonUtils.writeValueAsString(this.optionList);
|
||||||
|
|
||||||
|
List<Map> listMap = JsonUtils.readCollection(dd,List.class,Map.class);
|
||||||
|
listMap.forEach(d->d.remove("correct"));
|
||||||
|
|
||||||
|
question.setQuestionOption(JsonUtils.writeValueAsString(listMap));
|
||||||
question.setRaceLable(this.raceLable);
|
question.setRaceLable(this.raceLable);
|
||||||
question.setIsDel(BusinessConsts.DBLogicDelete.NORMAL.ordinal());
|
question.setIsDel(BusinessConsts.DBLogicDelete.NORMAL.ordinal());
|
||||||
|
// question.setQuestionAnswer(this.answer);
|
||||||
return question;
|
return question;
|
||||||
}
|
}
|
||||||
|
private void setOptionId(PaperQuestion pq){
|
||||||
|
int i = 0;
|
||||||
|
List<String> answerList = Lists.newArrayList();
|
||||||
|
for (PaperQuestionOptionVO2 vo : this.optionList) {
|
||||||
|
vo.setId(i++);
|
||||||
|
if(vo.getCorrect()){
|
||||||
|
answerList.add(vo.getId() + "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pq.setQuestionAnswer(Joiner.on(",").join(answerList));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static List<PaperQuestionVO> convert2VOList(List<PaperQuestion> questions){
|
public static List<PaperQuestionVO> convert2VOList(List<PaperQuestion> questions){
|
||||||
|
@ -10,8 +10,9 @@
|
|||||||
<result column="company_id" jdbcType="BIGINT" property="companyId" />
|
<result column="company_id" jdbcType="BIGINT" property="companyId" />
|
||||||
<result column="race_lable" jdbcType="VARCHAR" property="raceLable" />
|
<result column="race_lable" jdbcType="VARCHAR" property="raceLable" />
|
||||||
<result column="is_del" jdbcType="INTEGER" property="isDel" />
|
<result column="is_del" jdbcType="INTEGER" property="isDel" />
|
||||||
<result column="topic" jdbcType="LONGVARCHAR" property="topic" />
|
<result column="question" jdbcType="LONGVARCHAR" property="question" />
|
||||||
<result column="questions" jdbcType="LONGVARCHAR" property="questions" />
|
<result column="question_option" jdbcType="LONGVARCHAR" property="questionOption" />
|
||||||
|
<result column="question_answer" jdbcType="VARCHAR" property="questionAnswer" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<!-- <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="club.joylink.rtss.entity.race2.PaperQuestionWithBLOBs">
|
<!-- <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="club.joylink.rtss.entity.race2.PaperQuestionWithBLOBs">
|
||||||
<result column="topic" jdbcType="LONGVARCHAR" property="topic" />
|
<result column="topic" jdbcType="LONGVARCHAR" property="topic" />
|
||||||
@ -76,10 +77,10 @@
|
|||||||
</where>
|
</where>
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, `type`, create_user_id, create_time, project_code, company_id, race_lable, is_del
|
id, `type`, create_user_id, create_time, project_code, company_id, race_lable, is_del,question_answer
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Blob_Column_List">
|
<sql id="Blob_Column_List">
|
||||||
topic, questions
|
question, question_option
|
||||||
</sql>
|
</sql>
|
||||||
<!--<select id="selectByExampleWithBLOBs" parameterType="club.joylink.rtss.entity.race2.PaperQuestionExample" resultMap="ResultMapWithBLOBs">
|
<!--<select id="selectByExampleWithBLOBs" parameterType="club.joylink.rtss.entity.race2.PaperQuestionExample" resultMap="ResultMapWithBLOBs">
|
||||||
select
|
select
|
||||||
@ -150,12 +151,13 @@
|
|||||||
<insert id="insert" parameterType="club.joylink.rtss.entity.paper.question.PaperQuestionWithBLOBs">
|
<insert id="insert" parameterType="club.joylink.rtss.entity.paper.question.PaperQuestionWithBLOBs">
|
||||||
insert into paper_question (id, `type`, create_user_id,
|
insert into paper_question (id, `type`, create_user_id,
|
||||||
create_time, project_code, company_id,
|
create_time, project_code, company_id,
|
||||||
race_lable, is_del, topic,
|
race_lable, is_del, question,
|
||||||
questions)
|
question_option,question_answer)
|
||||||
|
|
||||||
values (#{id,jdbcType=BIGINT}, #{type,jdbcType=VARCHAR}, #{createUserId,jdbcType=BIGINT},
|
values (#{id,jdbcType=BIGINT}, #{type,jdbcType=VARCHAR}, #{createUserId,jdbcType=BIGINT},
|
||||||
#{createTime,jdbcType=TIMESTAMP}, #{projectCode,jdbcType=VARCHAR}, #{companyId,jdbcType=BIGINT},
|
#{createTime,jdbcType=TIMESTAMP}, #{projectCode,jdbcType=VARCHAR}, #{companyId,jdbcType=BIGINT},
|
||||||
#{raceLable,jdbcType=VARCHAR}, #{isDel,jdbcType=INTEGER}, #{topic,jdbcType=LONGVARCHAR},
|
#{raceLable,jdbcType=VARCHAR}, #{isDel,jdbcType=INTEGER}, #{question,jdbcType=LONGVARCHAR},
|
||||||
#{questions,jdbcType=LONGVARCHAR})
|
#{questionOption,jdbcType=LONGVARCHAR},#{questionAnswer,jdbcType=VARCHAR})
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.paper.question.PaperQuestionWithBLOBs">
|
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.paper.question.PaperQuestionWithBLOBs">
|
||||||
insert into paper_question
|
insert into paper_question
|
||||||
@ -184,11 +186,14 @@
|
|||||||
<if test="isDel != null">
|
<if test="isDel != null">
|
||||||
is_del,
|
is_del,
|
||||||
</if>
|
</if>
|
||||||
<if test="topic != null">
|
<if test="question != null">
|
||||||
topic,
|
question,
|
||||||
</if>
|
</if>
|
||||||
<if test="questions != null">
|
<if test="questionOption != null">
|
||||||
questions,
|
question_option,
|
||||||
|
</if>
|
||||||
|
<if test="questionAnswer != null">
|
||||||
|
question_answer,
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
@ -216,11 +221,14 @@
|
|||||||
<if test="isDel != null">
|
<if test="isDel != null">
|
||||||
#{isDel,jdbcType=INTEGER},
|
#{isDel,jdbcType=INTEGER},
|
||||||
</if>
|
</if>
|
||||||
<if test="topic != null">
|
<if test="question != null">
|
||||||
#{topic,jdbcType=LONGVARCHAR},
|
#{question,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="questions != null">
|
<if test="questionOption != null">
|
||||||
#{questions,jdbcType=LONGVARCHAR},
|
#{questionOption,jdbcType=LONGVARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="questionAnswer != null">
|
||||||
|
#{questionAnswer,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
@ -257,11 +265,14 @@
|
|||||||
<if test="record.isDel != null">
|
<if test="record.isDel != null">
|
||||||
is_del = #{record.isDel,jdbcType=INTEGER},
|
is_del = #{record.isDel,jdbcType=INTEGER},
|
||||||
</if>
|
</if>
|
||||||
<if test="record.topic != null">
|
<if test="record.question != null">
|
||||||
topic = #{record.topic,jdbcType=LONGVARCHAR},
|
question = #{record.question,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="record.questions != null">
|
<if test="record.questionOption != null">
|
||||||
questions = #{record.questions,jdbcType=LONGVARCHAR},
|
question_option = #{record.questionOption,jdbcType=LONGVARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="record.questionAnswer != null">
|
||||||
|
question_answer = #{record.questionAnswer,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
</set>
|
</set>
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
@ -294,8 +305,9 @@
|
|||||||
company_id = #{record.companyId,jdbcType=BIGINT},
|
company_id = #{record.companyId,jdbcType=BIGINT},
|
||||||
race_lable = #{record.raceLable,jdbcType=VARCHAR},
|
race_lable = #{record.raceLable,jdbcType=VARCHAR},
|
||||||
is_del = #{record.isDel,jdbcType=INTEGER},
|
is_del = #{record.isDel,jdbcType=INTEGER},
|
||||||
topic = #{record.topic,jdbcType=LONGVARCHAR},
|
question = #{record.question,jdbcType=LONGVARCHAR},
|
||||||
questions = #{record.questions,jdbcType=LONGVARCHAR}
|
question_option = #{record.questionOption,jdbcType=LONGVARCHAR},
|
||||||
|
question_answer = #{record.questionAnswer,jdbcType=VARCHAR}
|
||||||
|
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
@ -325,11 +337,14 @@
|
|||||||
<if test="isDel != null">
|
<if test="isDel != null">
|
||||||
is_del = #{isDel,jdbcType=INTEGER},
|
is_del = #{isDel,jdbcType=INTEGER},
|
||||||
</if>
|
</if>
|
||||||
<if test="topic != null">
|
<if test="question != null">
|
||||||
topic = #{topic,jdbcType=LONGVARCHAR},
|
question = #{question,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="questions != null">
|
<if test="questionOption != null">
|
||||||
questions = #{questions,jdbcType=LONGVARCHAR},
|
question_option = #{questionOption,jdbcType=LONGVARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="questionAnswer != null">
|
||||||
|
question_answer = #{questionAnswer,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
</set>
|
</set>
|
||||||
where id = #{id,jdbcType=BIGINT}
|
where id = #{id,jdbcType=BIGINT}
|
||||||
@ -356,8 +371,9 @@
|
|||||||
company_id = #{companyId,jdbcType=BIGINT},
|
company_id = #{companyId,jdbcType=BIGINT},
|
||||||
race_lable = #{raceLable,jdbcType=VARCHAR},
|
race_lable = #{raceLable,jdbcType=VARCHAR},
|
||||||
is_del = #{isDel,jdbcType=INTEGER},
|
is_del = #{isDel,jdbcType=INTEGER},
|
||||||
topic = #{topic,jdbcType=LONGVARCHAR},
|
question = #{question,jdbcType=LONGVARCHAR},
|
||||||
questions = #{questions,jdbcType=LONGVARCHAR}
|
question_option = #{questionOption,jdbcType=LONGVARCHAR},
|
||||||
|
question_answer = #{questionAnswer,jdbcType=VARCHAR}
|
||||||
where id = #{id,jdbcType=BIGINT}
|
where id = #{id,jdbcType=BIGINT}
|
||||||
</update>
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
Loading…
Reference in New Issue
Block a user