Compare commits
2 Commits
e716f414a8
...
ed07f80946
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ed07f80946 | ||
e0d469bda4 |
@@ -202,4 +202,10 @@ public class ExamQuestion extends TenantBaseDO {
|
|||||||
*/
|
*/
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String questionType;
|
private String questionType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ps考点
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<ExamPsKeyword> psKeywords;
|
||||||
}
|
}
|
||||||
|
@@ -8,6 +8,7 @@ import pc.exam.pp.framework.mybatis.core.query.LambdaQueryWrapperX;
|
|||||||
import pc.exam.pp.module.exam.controller.admin.question.dto.TenantDto;
|
import pc.exam.pp.module.exam.controller.admin.question.dto.TenantDto;
|
||||||
import pc.exam.pp.module.exam.controller.admin.question.vo.QuestionVo;
|
import pc.exam.pp.module.exam.controller.admin.question.vo.QuestionVo;
|
||||||
import pc.exam.pp.module.exam.controller.admin.question.vo.TenantVo;
|
import pc.exam.pp.module.exam.controller.admin.question.vo.TenantVo;
|
||||||
|
import pc.exam.pp.module.exam.dal.dataobject.ExamPsKeyword;
|
||||||
import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion;
|
import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -234,4 +235,7 @@ public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion> {
|
|||||||
*/
|
*/
|
||||||
List<String> selectQuNumBuIds(List<String> cannotDeleteIds);
|
List<String> selectQuNumBuIds(List<String> cannotDeleteIds);
|
||||||
|
|
||||||
|
List<ExamPsKeyword> selectExamQuestionPsKeywordByQuId(String quId);
|
||||||
|
|
||||||
|
void insertExamPsKeywordList(List<ExamPsKeyword> psKeywords);
|
||||||
}
|
}
|
||||||
|
@@ -641,6 +641,7 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
|
|||||||
List<ExamQuestionFile> fileUploads = examQuestion.getFileUploads();
|
List<ExamQuestionFile> fileUploads = examQuestion.getFileUploads();
|
||||||
ExamQuestionScore questionScores = examQuestion.getQuestionScores();
|
ExamQuestionScore questionScores = examQuestion.getQuestionScores();
|
||||||
List<ExamQuestionKeyword> questionKeywords = examQuestion.getQuestionKeywords();
|
List<ExamQuestionKeyword> questionKeywords = examQuestion.getQuestionKeywords();
|
||||||
|
List<ExamPsKeyword> psKeywords = examQuestion.getPsKeywords();
|
||||||
if (answerList != null && answerList.size() > 0) {
|
if (answerList != null && answerList.size() > 0) {
|
||||||
answerList.replaceAll(answer -> {
|
answerList.replaceAll(answer -> {
|
||||||
answer.setAnswerId(IdUtils.simpleUUID());
|
answer.setAnswerId(IdUtils.simpleUUID());
|
||||||
@@ -649,6 +650,20 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
|
|||||||
});
|
});
|
||||||
//examQuestionAnswerMapper.insert(answerList);
|
//examQuestionAnswerMapper.insert(answerList);
|
||||||
examQuestionAnswerMapper.insertExamQuestionAnswerList(answerList);
|
examQuestionAnswerMapper.insertExamQuestionAnswerList(answerList);
|
||||||
|
List<ExamMysqlKeyword> newKeywordList = new ArrayList<>();
|
||||||
|
for (ExamQuestionAnswer examQuestionAnswer : answerList) {
|
||||||
|
if (examQuestionAnswer.getExamMysqlKeywordList()!=null&& examQuestionAnswer.getExamMysqlKeywordList().size()>0){
|
||||||
|
List<ExamMysqlKeyword> examMysqlKeywordList = examQuestionAnswer.getExamMysqlKeywordList();
|
||||||
|
for (ExamMysqlKeyword keyword : examMysqlKeywordList) {
|
||||||
|
keyword.setAnswerId(examQuestionAnswer.getAnswerId());
|
||||||
|
keyword.setKeywordId(IdUtils.simpleUUID());
|
||||||
|
}
|
||||||
|
newKeywordList.addAll(examMysqlKeywordList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!CollectionUtils.isEmpty(newKeywordList)) {
|
||||||
|
mysqlKeywordMapper.insert(newKeywordList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (fileUploads != null && fileUploads.size() > 0) {
|
if (fileUploads != null && fileUploads.size() > 0) {
|
||||||
fileUploads.replaceAll(fileUpload -> {
|
fileUploads.replaceAll(fileUpload -> {
|
||||||
@@ -673,6 +688,32 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
|
|||||||
});
|
});
|
||||||
examQuestionKeywordMapper.insertExamQuestionKeywordList(questionKeywords);
|
examQuestionKeywordMapper.insertExamQuestionKeywordList(questionKeywords);
|
||||||
}
|
}
|
||||||
|
if (psKeywords != null && psKeywords.size() > 0) {
|
||||||
|
// 保存旧ID -> 新ID 的映射
|
||||||
|
Map<String, String> idMap = new HashMap<>();
|
||||||
|
|
||||||
|
// 第一次遍历,生成新ID,记录映射
|
||||||
|
for (ExamPsKeyword psKeyword : psKeywords) {
|
||||||
|
String newId = IdUtils.simpleUUID();
|
||||||
|
idMap.put(psKeyword.getId(), newId); // 保存旧ID到新ID的映射
|
||||||
|
psKeyword.setId(newId); // 替换为新ID
|
||||||
|
psKeyword.setQuId(quId); // 替换为当前试题ID
|
||||||
|
}
|
||||||
|
|
||||||
|
// 第二次遍历,处理 parentId
|
||||||
|
for (ExamPsKeyword psKeyword : psKeywords) {
|
||||||
|
String parentId = psKeyword.getParentId();
|
||||||
|
if (!"0".equals(parentId)) {
|
||||||
|
// 替换成新生成的父ID
|
||||||
|
String newParentId = idMap.get(parentId);
|
||||||
|
psKeyword.setParentId(newParentId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 批量插入
|
||||||
|
examQuestionMapper.insertExamPsKeywordList(psKeywords);
|
||||||
|
}
|
||||||
|
|
||||||
examQuestionMapper.insert(examQuestion);
|
examQuestionMapper.insert(examQuestion);
|
||||||
}
|
}
|
||||||
//有就是覆盖
|
//有就是覆盖
|
||||||
@@ -694,7 +735,7 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
|
|||||||
List<ExamQuestionFile> fileUploads = examQuestion.getFileUploads();
|
List<ExamQuestionFile> fileUploads = examQuestion.getFileUploads();
|
||||||
ExamQuestionScore questionScores = examQuestion.getQuestionScores();
|
ExamQuestionScore questionScores = examQuestion.getQuestionScores();
|
||||||
List<ExamQuestionKeyword> questionKeywords = examQuestion.getQuestionKeywords();
|
List<ExamQuestionKeyword> questionKeywords = examQuestion.getQuestionKeywords();
|
||||||
|
List<ExamPsKeyword> psKeywords = examQuestion.getPsKeywords();
|
||||||
if (answerList != null && answerList.size() > 0) {
|
if (answerList != null && answerList.size() > 0) {
|
||||||
answerList.replaceAll(answer -> {
|
answerList.replaceAll(answer -> {
|
||||||
answer.setAnswerId(IdUtils.simpleUUID());
|
answer.setAnswerId(IdUtils.simpleUUID());
|
||||||
@@ -703,6 +744,20 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
|
|||||||
});
|
});
|
||||||
//examQuestionAnswerMapper.insert(answerList);
|
//examQuestionAnswerMapper.insert(answerList);
|
||||||
examQuestionAnswerMapper.insertExamQuestionAnswerList(answerList);
|
examQuestionAnswerMapper.insertExamQuestionAnswerList(answerList);
|
||||||
|
List<ExamMysqlKeyword> newKeywordList = new ArrayList<>();
|
||||||
|
for (ExamQuestionAnswer examQuestionAnswer : answerList) {
|
||||||
|
if (examQuestionAnswer.getExamMysqlKeywordList()!=null&& examQuestionAnswer.getExamMysqlKeywordList().size()>0){
|
||||||
|
List<ExamMysqlKeyword> examMysqlKeywordList = examQuestionAnswer.getExamMysqlKeywordList();
|
||||||
|
for (ExamMysqlKeyword keyword : examMysqlKeywordList) {
|
||||||
|
keyword.setAnswerId(examQuestionAnswer.getAnswerId());
|
||||||
|
keyword.setKeywordId(IdUtils.simpleUUID());
|
||||||
|
}
|
||||||
|
newKeywordList.addAll(examMysqlKeywordList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!CollectionUtils.isEmpty(newKeywordList)) {
|
||||||
|
mysqlKeywordMapper.insert(newKeywordList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileUploads != null && fileUploads.size() > 0) {
|
if (fileUploads != null && fileUploads.size() > 0) {
|
||||||
@@ -730,6 +785,31 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
|
|||||||
});
|
});
|
||||||
examQuestionKeywordMapper.insertExamQuestionKeywordList(questionKeywords);
|
examQuestionKeywordMapper.insertExamQuestionKeywordList(questionKeywords);
|
||||||
}
|
}
|
||||||
|
if (psKeywords != null && psKeywords.size() > 0) {
|
||||||
|
// 保存旧ID -> 新ID 的映射
|
||||||
|
Map<String, String> idMap = new HashMap<>();
|
||||||
|
|
||||||
|
// 第一次遍历,生成新ID,记录映射
|
||||||
|
for (ExamPsKeyword psKeyword : psKeywords) {
|
||||||
|
String newId = IdUtils.simpleUUID();
|
||||||
|
idMap.put(psKeyword.getId(), newId); // 保存旧ID到新ID的映射
|
||||||
|
psKeyword.setId(newId); // 替换为新ID
|
||||||
|
psKeyword.setQuId(quId); // 替换为当前试题ID
|
||||||
|
}
|
||||||
|
|
||||||
|
// 第二次遍历,处理 parentId
|
||||||
|
for (ExamPsKeyword psKeyword : psKeywords) {
|
||||||
|
String parentId = psKeyword.getParentId();
|
||||||
|
if (!"0".equals(parentId)) {
|
||||||
|
// 替换成新生成的父ID
|
||||||
|
String newParentId = idMap.get(parentId);
|
||||||
|
psKeyword.setParentId(newParentId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 批量插入
|
||||||
|
examQuestionMapper.insertExamPsKeywordList(psKeywords);
|
||||||
|
}
|
||||||
examQuestionMapper.updateBatch(examQuestion);
|
examQuestionMapper.updateBatch(examQuestion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -758,8 +838,17 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
|
|||||||
//获取试题关键字
|
//获取试题关键字
|
||||||
List<ExamQuestionKeyword> examQuestionKeywords = examQuestionKeywordMapper.selectExamQuestionKeywordByQuId(quId);
|
List<ExamQuestionKeyword> examQuestionKeywords = examQuestionKeywordMapper.selectExamQuestionKeywordByQuId(quId);
|
||||||
|
|
||||||
|
List<ExamPsKeyword> examPsKeywords=examQuestionMapper.selectExamQuestionPsKeywordByQuId(quId);
|
||||||
if (examQuestion_obj != null) {
|
if (examQuestion_obj != null) {
|
||||||
if (examQuestionAnswers != null && examQuestionAnswers.size() > 0) {
|
if (examQuestionAnswers != null && examQuestionAnswers.size() > 0) {
|
||||||
|
//获取mysql关键字
|
||||||
|
for (ExamQuestionAnswer examQuestionAnswer : examQuestionAnswers) {
|
||||||
|
String answerId = examQuestionAnswer.getAnswerId();
|
||||||
|
List<ExamMysqlKeyword> newKeywordList = mysqlKeywordMapper.selectList(
|
||||||
|
new QueryWrapper<ExamMysqlKeyword>().eq("answer_id", answerId)
|
||||||
|
);
|
||||||
|
examQuestionAnswer.setExamMysqlKeywordList(newKeywordList);
|
||||||
|
}
|
||||||
examQuestion_obj.setAnswerList(examQuestionAnswers);
|
examQuestion_obj.setAnswerList(examQuestionAnswers);
|
||||||
}
|
}
|
||||||
if (sysFileUploads != null && sysFileUploads.size() > 0) {
|
if (sysFileUploads != null && sysFileUploads.size() > 0) {
|
||||||
@@ -771,6 +860,9 @@ public class ExamQuestionServiceImpl implements IExamQuestionService {
|
|||||||
if (examQuestionKeywords != null && examQuestionKeywords.size() > 0) {
|
if (examQuestionKeywords != null && examQuestionKeywords.size() > 0) {
|
||||||
examQuestion_obj.setQuestionKeywords(examQuestionKeywords);
|
examQuestion_obj.setQuestionKeywords(examQuestionKeywords);
|
||||||
}
|
}
|
||||||
|
if (examPsKeywords!=null&& examPsKeywords.size()>0){
|
||||||
|
examQuestion_obj.setPsKeywords(examPsKeywords);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// examQuestion_obj.setType(rabbitMQSendInfoVO.getType());
|
// examQuestion_obj.setType(rabbitMQSendInfoVO.getType());
|
||||||
// examQuestion_obj.setSource(SecurityFrameworkUtils.getLoginTenantId());
|
// examQuestion_obj.setSource(SecurityFrameworkUtils.getLoginTenantId());
|
||||||
|
@@ -51,6 +51,18 @@
|
|||||||
<result property="name" column="name"/>
|
<result property="name" column="name"/>
|
||||||
<result property="ququeName" column="queue_name"/>
|
<result property="ququeName" column="queue_name"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap type="ExamPsKeyword" id="ExamPsKeywordsResult">
|
||||||
|
<id property="id" column="id" jdbcType="VARCHAR"/>
|
||||||
|
<result property="quId" column="qu_id" jdbcType="VARCHAR"/>
|
||||||
|
<result property="parentId" column="parent_id" jdbcType="VARCHAR"/>
|
||||||
|
<result property="key" column="key_name" jdbcType="VARCHAR"/>
|
||||||
|
<result property="value" column="key_value" jdbcType="VARCHAR"/>
|
||||||
|
<result property="rate" column="rate" jdbcType="VARCHAR"/>
|
||||||
|
<result property="type" column="type" jdbcType="VARCHAR"/>
|
||||||
|
<result property="sort" column="sort" jdbcType="VARCHAR"/>
|
||||||
|
|
||||||
|
</resultMap>
|
||||||
<sql id="selectExamQuestionVo">
|
<sql id="selectExamQuestionVo">
|
||||||
select qu_id,
|
select qu_id,
|
||||||
qu_bank_id,
|
qu_bank_id,
|
||||||
@@ -181,6 +193,12 @@
|
|||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectExamQuestionPsKeywordByQuId"
|
||||||
|
resultMap="ExamPsKeywordsResult">
|
||||||
|
select id,qu_id,parent_id,key_name,key_value,rate,type,sort
|
||||||
|
from exam_ps_keyword
|
||||||
|
where qu_id=#{quId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<insert id="insertExamQuestion" parameterType="ExamQuestion">
|
<insert id="insertExamQuestion" parameterType="ExamQuestion">
|
||||||
@@ -278,6 +296,30 @@
|
|||||||
update_time = VALUES(update_time),
|
update_time = VALUES(update_time),
|
||||||
updater = VALUES(updater)
|
updater = VALUES(updater)
|
||||||
</insert>
|
</insert>
|
||||||
|
<insert id="insertExamPsKeywordList">
|
||||||
|
INSERT INTO exam_ps_keyword (
|
||||||
|
id,
|
||||||
|
qu_id,
|
||||||
|
parent_id,
|
||||||
|
key_name,
|
||||||
|
key_value,
|
||||||
|
rate,
|
||||||
|
type,
|
||||||
|
sort
|
||||||
|
) VALUES
|
||||||
|
<foreach collection="list" item="item" separator=",">
|
||||||
|
(
|
||||||
|
#{item.id},
|
||||||
|
#{item.quId},
|
||||||
|
#{item.parentId},
|
||||||
|
#{item.key},
|
||||||
|
#{item.value},
|
||||||
|
#{item.rate},
|
||||||
|
#{item.type},
|
||||||
|
#{item.sort}
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
<update id="updateExamQuestion" parameterType="ExamQuestion">
|
<update id="updateExamQuestion" parameterType="ExamQuestion">
|
||||||
update exam_question
|
update exam_question
|
||||||
|
@@ -3,7 +3,12 @@
|
|||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="pc.exam.pp.module.exam.dal.mysql.mysqlkeyword.MysqlKeywordMapper">
|
<mapper namespace="pc.exam.pp.module.exam.dal.mysql.mysqlkeyword.MysqlKeywordMapper">
|
||||||
|
<resultMap type="ExamMysqlKeyword" id="MysqlKeywordResult">
|
||||||
|
<result property="keywordId" column="keyword_id"/>
|
||||||
|
<result property="answerId" column="answer_id"/>
|
||||||
|
<result property="keyword" column="keyword"/>
|
||||||
|
<result property="scoreRate" column="score_rate"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
<delete id="deleteByAnswerId">
|
<delete id="deleteByAnswerId">
|
||||||
delete from exam_mysql_keyword where answer_id=#{answerId}
|
delete from exam_mysql_keyword where answer_id=#{answerId}
|
||||||
|
Reference in New Issue
Block a user