【新增】mysql、浏览器、win文件判分,试卷任务学生端接口,监控管理后端接口

This commit is contained in:
YOHO\20373
2025-05-07 09:49:46 +08:00
parent d2c9c399d7
commit cdb75a5b44
28 changed files with 362 additions and 85 deletions

View File

@@ -99,7 +99,7 @@ public void exportMonitorExcel(@Valid MonitorPageReqVO pageReqVO, HttpServletRes
@PostMapping("/stuMonitorQu")
@Operation(summary = "学生端考试过程传试题")
public CommonResult<String> updateStuMonitor(@Valid @RequestBody StuMonitorQuVo stuMonitorQuVo) {
Boolean stuMonitor= monitorService.updateStuMonitor(stuMonitorQuVo);
Boolean stuMonitor = monitorService.updateStuMonitor(stuMonitorQuVo);
if (!stuMonitor)
{
return error(DEMO03_MONITOR_SESSION_EXISTS);

View File

@@ -12,13 +12,5 @@ public class StuMonitorQuVo {
private String stuId;
private String paperId;
private String taskId;
private List<EducationPaperSchemeMap> paperSchemeMaps; // 使用自定义类
private String score;
@Data
public static class EducationPaperSchemeMap {
private EducationPaperScheme educationPaperScheme;
private Map<String, Boolean> questionResultMap;
}
private Map<String, String> questionResultMap;
}

View File

@@ -3,6 +3,7 @@ package pc.exam.pp.module.exam.controller.admin.paper;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.java.Log;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
@@ -15,7 +16,9 @@ import pc.exam.pp.module.exam.controller.admin.paper.dto.StatusDto;
import pc.exam.pp.module.exam.controller.admin.paper.vo.PaperPageVo;
import pc.exam.pp.module.exam.dal.dataobject.EducationPaper;
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperTask;
import pc.exam.pp.module.exam.service.paper.IEducationPaperPersonService;
import pc.exam.pp.module.exam.service.paper.IEducationPaperService;
import pc.exam.pp.module.exam.service.paper.IEducationPaperTaskService;
import java.util.List;
@@ -35,6 +38,12 @@ public class EducationPaperController
@Autowired
private IEducationPaperService educationPaperService;
@Autowired
private IEducationPaperPersonService educationPaperPersonService;
@Autowired
private IEducationPaperTaskService educationPaperTaskService;
/**
* 查询试卷列表
*/
@@ -75,6 +84,26 @@ public class EducationPaperController
return CommonResult.success(educationPaperService.addPaperList(num,taskid,taskSpecialty));
}
/**
* 学生端返回一张试卷
*/
@GetMapping("/stuInfoPaper")
public CommonResult stuInfoPaper(@RequestParam("taskid") String taskid)
{
List<String> stuIds=educationPaperPersonService.selectStuIdByTaskId(taskid);
Long loginUserId = getLoginUserId();
// 判断试卷任务是否包含此学生
if (stuIds.contains(String.valueOf(loginUserId))) {
return CommonResult.success(educationPaperService.stuInfoPaper(taskid));
}
else {
return CommonResult.error(100_200_300,"您未分配此试卷任务,请联系老师!");
}
}
/**
* 修改试卷
*/
@@ -102,12 +131,23 @@ public class EducationPaperController
return CommonResult.success(educationPaperService.selectPaperByTaskId(taskId));
}
@PostMapping("/update")
public CommonResult update(@RequestBody EducationPaper educationPaper)
{
//根据方案id查找所属试卷 ,把随机的清空掉
String taskId = educationPaper.getTaskId();
String rollUp = educationPaper.getRollUp();
EducationPaperTask educationPaperTask = educationPaperTaskService.selectEducationPaperTaskByTaskId(taskId);
if ("3".equals(rollUp)){
educationPaperTask.setIsOne("0");
}else {
educationPaperTask.setIsOne("1");
}
educationPaperTaskService.updateEducationPaperTask(educationPaperTask);
if ("0".equals(rollUp)||"1".equals(rollUp )){
//先清空 改试卷 的抽卷方式
String paperId = educationPaper.getPaperId();
@@ -158,6 +198,7 @@ public class EducationPaperController
}
@PutMapping("/updatePaperStatus") // 更符合RESTful规范
public CommonResult updateTaskStatus(@RequestBody StatusDto statusDto) { // 改为Integer类型
return CommonResult.success(

View File

@@ -172,6 +172,10 @@ public class EducationPaperTaskController
}
@GetMapping(value = "/getPaperBytaskId")
public CommonResult getPaperBytaskId(@RequestParam(value = "taskId") String taskId)
{
return CommonResult.success(educationPaperTaskService.selectPaperQuByPaperId(taskId));
}
}

View File

@@ -32,7 +32,7 @@ public class EducationPaperStuDto {
EducationPaperParam educationPaperParam;

View File

@@ -31,7 +31,7 @@ public class EducationPaperQu
/** 试题版本 */
// @Excel(name = "试题版本")
private String quVersion;
private String sort;
}

View File

@@ -54,5 +54,7 @@ public class EducationPaperTask extends TenantBaseDO
@TableField(exist = false)
private String count;
@TableField(exist = false)
EducationPaperParam educationPaperParam;
}

View File

@@ -110,4 +110,7 @@ public interface EducationPaperTaskMapper extends BaseMapperX<EducationPaperTask
String selectStuClassNameByClassId(Long classId);
List<EducationPaperTask> selectEducationPaperTaskByTaskType(String id);
String selectPaperQuByPaperId(String taskId);
}

View File

@@ -10,6 +10,8 @@ import org.springframework.stereotype.Service;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.io.FileWriter;
import java.io.IOException;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
@@ -105,7 +107,10 @@ public class MonitorServiceImpl implements MonitorService {
@Override
public Boolean getStuMonitor(StuMonitorPaperVo stuMonitorPaperVo) {
String key = "userCache:"+stuMonitorPaperVo.getTaskId()+":" + stuMonitorPaperVo.getStuId();
MonitorDO info = JsonUtils.parseObject(stringRedisTemplate.opsForValue().get(key),MonitorDO.class);
// MonitorDO info = JsonUtils.parseObject(stringRedisTemplate.opsForValue().get(key),MonitorDO.class);
MonitorDO info=new MonitorDO();
String uuid = IdUtils.simpleUUID();
info.setMonitorId(uuid);
if (StringUtils.isNotBlank(stuMonitorPaperVo.getPaperId())){
EducationPaper educationPaper = educationPaperMapper.selectEducationPaperByPaperId(stuMonitorPaperVo.getPaperId());
String counts = educationPaper.getCounts();
@@ -181,34 +186,18 @@ public class MonitorServiceImpl implements MonitorService {
@Override
public Boolean updateStuMonitor(StuMonitorQuVo stuMonitorQuVo) {
String key = "userCache:"+stuMonitorQuVo.getTaskId()+":" + stuMonitorQuVo.getStuId();
String keychoice = "keychoice:"+stuMonitorQuVo.getTaskId()+":" + stuMonitorQuVo.getStuId();
MonitorDO info = JsonUtils.parseObject(stringRedisTemplate.opsForValue().get(key),MonitorDO.class);
if (info != null) {
if (!("1".equals(info.getExamStatus()))){
return false;
}
AtomicInteger totalScore = new AtomicInteger(); // 用于累加总分
// 记录答题结果
List<StuMonitorQuVo.EducationPaperSchemeMap> paperSchemeMaps = stuMonitorQuVo.getPaperSchemeMaps();
for (StuMonitorQuVo.EducationPaperSchemeMap paperSchemeMap : paperSchemeMaps) {
EducationPaperScheme educationPaperScheme = paperSchemeMap.getEducationPaperScheme();
Map<String, Boolean> questionResultMap = paperSchemeMap.getQuestionResultMap();
questionResultMap.forEach((quId, value) -> {
if (value) {
System.out.println("QuestionId: " + quId + ", boolean: " + value);
String quScores = educationPaperScheme.getQuScores();
int score = Integer.parseInt(quScores); // 转换为 int 类型的分数
totalScore.addAndGet(score); // 累加到总分
}
});
}
// 更新成绩这里假设一题10分
info.setScore(String.valueOf(totalScore));
stringRedisTemplate.opsForValue().set(keychoice, JsonUtils.toJsonString(stuMonitorQuVo));
// 更新缓存
redisTemplate.opsForValue().set(key, info);
// redisTemplate.opsForValue().set(key, info);
// monitorMapper.updateById(info);
}
return true;
@@ -218,6 +207,22 @@ public class MonitorServiceImpl implements MonitorService {
@Override
public void endStuMonitor(StuMonitorPaperEndVo stuMonitorPaperEndVo) {
String key = "userCache:" + stuMonitorPaperEndVo.getTaskId()+":" +stuMonitorPaperEndVo.getStuId();
String keychoice = "keychoice:"+stuMonitorPaperEndVo.getTaskId()+":" + stuMonitorPaperEndVo.getStuId();
StuMonitorQuVo stuMonitorQuVo = JsonUtils.parseObject(stringRedisTemplate.opsForValue().get(keychoice),StuMonitorQuVo.class);
try {
String fileName = "StuMonitorQu.txt";
FileWriter writer = new FileWriter(fileName);
writer.write(JsonUtils.toJsonString(stuMonitorQuVo));
writer.close();
//上传至
} catch (IOException e) {
System.out.println(e);
}
MonitorDO info = JsonUtils.parseObject(stringRedisTemplate.opsForValue().get(key),MonitorDO.class);
EducationPaperParam educationPaperParam = educationPaperParamMapper.selectEducationPaperParamByTaskId(stuMonitorPaperEndVo.getTaskId());
EducationPaperTask educationPaperTask = educationPaperTaskMapper.selectEducationPaperTaskByTaskId(stuMonitorPaperEndVo.getTaskId());
@@ -225,10 +230,14 @@ public class MonitorServiceImpl implements MonitorService {
info.setScore(stuMonitorPaperEndVo.getScore());
}else {
MonitorDO monitorDO = monitorMapper.selectById(info.getMonitorId());
if (Integer.parseInt(monitorDO.getScore()) <Integer.parseInt(stuMonitorPaperEndVo.getScore())){
info.setScore(stuMonitorPaperEndVo.getScore());
info.setScore(stuMonitorPaperEndVo.getScore());
if (StringUtils.isNotBlank(monitorDO.getScore())) {
if (Integer.parseInt(monitorDO.getScore()) <Integer.parseInt(stuMonitorPaperEndVo.getScore())){
info.setScore(stuMonitorPaperEndVo.getScore());
}
}
}
//练习下的任务 结束改为 代考
if ("0".equals(educationPaperTask.getStatus())){
@@ -236,7 +245,9 @@ public class MonitorServiceImpl implements MonitorService {
}else {
info.setExamStatus("2");
}
//todo 这些都写成方法
redisTemplate.delete(key);
redisTemplate.delete(keychoice);
monitorMapper.updateById(info);
}

View File

@@ -264,6 +264,11 @@ public class EducationPaperPersonServiceImpl implements IEducationPaperPersonSer
return educationPaperPersonMapper.removeTaskStu(deleteRequestVo);
}
@Override
public List<String> selectStuIdByTaskId(String taskid) {
return educationPaperPersonMapper.selectStuIdByTaskId(taskid);
}
/**
* 查询试卷人员分配列表

View File

@@ -8,9 +8,12 @@ import pc.exam.pp.framework.common.pojo.PageResult;
import pc.exam.pp.framework.tenant.core.aop.TenantIgnore;
import pc.exam.pp.framework.tenant.core.context.TenantContextHolder;
import pc.exam.pp.module.exam.controller.admin.paper.dto.EducationPaperStuDto;
import pc.exam.pp.module.exam.controller.admin.paper.vo.ExamPaperVo;
import pc.exam.pp.module.exam.controller.admin.paper.vo.PaperPageVo;
import pc.exam.pp.module.exam.dal.dataobject.*;
import pc.exam.pp.module.exam.dal.mysql.paper.*;
import pc.exam.pp.module.exam.dal.mysql.question.ExamQuestionMapper;
import pc.exam.pp.module.exam.dal.mysql.question.SysFileMapper;
import pc.exam.pp.module.exam.utils.uuid.IdUtils;
import java.util.*;
@@ -40,6 +43,11 @@ public class EducationPaperServiceImpl implements IEducationPaperService
@Autowired
private EducationPaperPersonMapper educationPaperPersonMapper;
@Autowired
private ExamQuestionMapper examQuestionMapper;
@Autowired
private SysFileMapper sysFileMapper;
/**
* 查询试卷
*
@@ -172,10 +180,12 @@ public class EducationPaperServiceImpl implements IEducationPaperService
//构建试卷试题对象
List<EducationPaperQu> educationPaperQus=new ArrayList<>();
if (examQuestionIds!=null&& examQuestionIds.size()>0){
int sort = 1; // 从1开始
for (String examQuestionId : examQuestionIds) {
EducationPaperQu educationPaperQu=new EducationPaperQu();
educationPaperQu.setPaperId(uuid);
educationPaperQu.setQuId(examQuestionId);
educationPaperQu.setSort(String.valueOf(sort++));
educationPaperQus.add(educationPaperQu);
}
educationPaperQuMapper.insertEducationPaperQuList(educationPaperQus);
@@ -275,14 +285,14 @@ public class EducationPaperServiceImpl implements IEducationPaperService
for (EducationPaper educationPaper : list) {
EducationPaperStuDto educationPaperStuDto=new EducationPaperStuDto();
EducationPaperParam educationPaperParam = educationPaperParamMapper.selectEducationPaperParamByTaskId(educationPaper.getTaskId());
// EducationPaperParam educationPaperParam = educationPaperParamMapper.selectEducationPaperParamByTaskId(educationPaper.getTaskId());
educationPaperStuDto.setPaperId(educationPaper.getPaperId());
educationPaperStuDto.setNum(educationPaper.getNum());
educationPaperStuDto.setTaskId(educationPaper.getTaskId());
educationPaperStuDto.setCounts(educationPaper.getCounts());
educationPaperStuDto.setRollUp(educationPaper.getRollUp());
educationPaperStuDto.setIsAb(educationPaper.getIsAb());
educationPaperStuDto.setEducationPaperParam(educationPaperParam);
// educationPaperStuDto.setEducationPaperParam(educationPaperParam);
educationPaperStuDtos.add(educationPaperStuDto);
}
}
@@ -300,6 +310,96 @@ public class EducationPaperServiceImpl implements IEducationPaperService
}
@Override
public ExamPaperVo stuInfoPaper(String taskid) {
EducationPaperTask educationPaperTask = educationPaperTaskMapper.selectEducationPaperTaskByTaskId(taskid);
String taskSpecialty = educationPaperTask.getTaskSpecialty();
//根据试卷任务id查找方案集合
List<EducationPaperScheme> educationPaperSchemeList= educationPaperSchemeMapper.selectEducationPaperTaskByTaskId(taskid);
List<String> examQuestionIds = new ArrayList<>();
for (EducationPaperScheme educationPaperScheme : educationPaperSchemeList) {
//获取试卷方案对象
String pointNames = educationPaperScheme.getPointNames();
//知识点id
List<String> pointList ;
//知识点名称
List<String> pointName =new ArrayList<>();
if (pointNames!=null){
pointList = Arrays.asList(pointNames.split(","));
if (pointList!=null){
pointName= educationPaperTaskMapper.selectPointByid(pointList);
}
}
String keywords = educationPaperScheme.getKeywords();
List<String> keywordList =new ArrayList<>();
if (keywords != null && !keywords.trim().isEmpty()) {
keywordList = Arrays.asList(keywords.split(","));
}
if ("3".equals(educationPaperScheme.getQuLevel())){
educationPaperScheme.setQuLevel("");
}
//根据方案,去查找 试题表,返回试题id
Long requiredTenantId = TenantContextHolder.getRequiredTenantId();
List<String> quId = educationPaperMapper.selectQuByPaperScheme(pointName,keywordList,educationPaperScheme,taskSpecialty,requiredTenantId);
//把第i张卷子方案的试题全加一起
examQuestionIds.addAll(quId);
}
int number=educationPaperMapper.selectCountPaperList();
// 格式化为8位不足前面补0
String formattedNumber = String.format("%08d", number);
//构建试卷
EducationPaper educationPaper =new EducationPaper();
String uuid = IdUtils.simpleUUID();
educationPaper.setPaperId(uuid);
educationPaper.setTaskId(taskid);
educationPaper.setNum(formattedNumber);
educationPaper.setTenantId(TenantContextHolder.getRequiredTenantId());
educationPaperMapper.insertEducationPaper(educationPaper);
System.out.println(examQuestionIds+"examQuestionIdsexamQuestionIds");
//构建试卷试题对象
List<EducationPaperQu> educationPaperQus=new ArrayList<>();
if (examQuestionIds!=null&& examQuestionIds.size()>0){
for (String examQuestionId : examQuestionIds) {
EducationPaperQu educationPaperQu=new EducationPaperQu();
educationPaperQu.setPaperId(uuid);
educationPaperQu.setQuId(examQuestionId);
educationPaperQus.add(educationPaperQu);
}
educationPaperQuMapper.insertEducationPaperQuList(educationPaperQus);
}
List<String> quIds =educationPaperQuMapper.selectPaperQuByPaperId(uuid);
List<ExamQuestion> examQuestionList=examQuestionMapper.selectExamQuestionListByQuIds(quIds);
if (examQuestionList!=null&&examQuestionList.size()>0){
for (ExamQuestion examQuestion : examQuestionList) {
//查找原始和素材试题文件
List<SysFileUpload> sysFileUploads =sysFileMapper.selectSysFileByQuidIN(examQuestion.getQuId());
examQuestion.setFileUploads(sysFileUploads);
}
}
ExamPaperVo examPaperVo=new ExamPaperVo();
examPaperVo.setExamQuestionList(examQuestionList);
examPaperVo.setEducationPaperSchemeList(educationPaperSchemeList);
return examPaperVo;
}
}

View File

@@ -1,6 +1,7 @@
package pc.exam.pp.module.exam.service.paper;
import com.alibaba.excel.util.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -9,9 +10,12 @@ import pc.exam.pp.framework.tenant.core.aop.TenantIgnore;
import pc.exam.pp.framework.tenant.core.context.TenantContextHolder;
import pc.exam.pp.module.exam.controller.admin.paper.dto.SchemeParam;
import pc.exam.pp.module.exam.controller.admin.paper.dto.TempDto;
import pc.exam.pp.module.exam.controller.admin.paper.vo.ExamPaperVo;
import pc.exam.pp.module.exam.controller.admin.paper.vo.PaperTaskPageVo;
import pc.exam.pp.module.exam.dal.dataobject.*;
import pc.exam.pp.module.exam.dal.mysql.paper.*;
import pc.exam.pp.module.exam.dal.mysql.question.ExamQuestionMapper;
import pc.exam.pp.module.exam.dal.mysql.question.SysFileMapper;
import pc.exam.pp.module.exam.utils.date.DateUtils;
import pc.exam.pp.module.exam.utils.uuid.IdUtils;
@@ -46,7 +50,13 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
@Autowired
private EducationPaperTaskMapper educationPaperTaskMapper;
@Autowired
private SysFileMapper sysFileMapper;
//@Autowired
//private ExamQuestionMapper
@Autowired
private ExamQuestionMapper examQuestionMapper;
/**
* 查询试卷任务
@@ -86,6 +96,9 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
}
paperTask.setCount(String.valueOf(count));
EducationPaperParam educationPaperParam = educationPaperParamMapper.selectEducationPaperParamByTaskId(paperTask.getTaskId());
paperTask.setEducationPaperParam(educationPaperParam);
}
}
@@ -129,7 +142,11 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
educationPaperParam.setIsAnswer("0");
educationPaperParam.setIsLook("0");
}
if ("0".equals(educationPaperTask.getTaskType())||"1".equals(educationPaperTask.getTaskType())||"3".equals(educationPaperTask.getTaskType())){
educationPaperTask.setIsOne("0");
}else{
educationPaperTask.setIsOne("1");
}
educationPaperParamMapper.insertEducationPaperParam(educationPaperParam);
@@ -362,4 +379,30 @@ public class EducationPaperTaskServiceImpl implements IEducationPaperTaskService
public boolean changeStatus(String taskId, String status) {
return educationPaperTaskMapper.changeStatus(taskId,status);
}
@Override
public ExamPaperVo selectPaperQuByPaperId(String taskId) {
String paperId= educationPaperTaskMapper.selectPaperQuByPaperId(taskId);
List<ExamQuestion> examQuestionList=new ArrayList<>();
List<EducationPaperScheme> educationPaperSchemeList=new ArrayList<>();
if (StringUtils.isNotBlank(paperId)){
List<String> quIds =educationPaperQuMapper.selectPaperQuByPaperId(paperId);
examQuestionList=examQuestionMapper.selectExamQuestionListByQuIds(quIds);
if (examQuestionList!=null&&examQuestionList.size()>0){
for (ExamQuestion examQuestion : examQuestionList) {
//查找原始和素材试题文件
List<SysFileUpload> sysFileUploads =sysFileMapper.selectSysFileByQuidIN(examQuestion.getQuId());
examQuestion.setFileUploads(sysFileUploads);
}
}
educationPaperSchemeList= educationPaperSchemeMapper.selectEducationPaperTaskByTaskId(taskId);
}
ExamPaperVo examPaperVo=new ExamPaperVo();
examPaperVo.setExamQuestionList(examQuestionList);
examPaperVo.setEducationPaperSchemeList(educationPaperSchemeList);
return examPaperVo;
}
}

View File

@@ -77,6 +77,8 @@ public interface IEducationPaperPersonService
int removeTaskStu(DeleteRequestVo deleteRequestVo);
List<String> selectStuIdByTaskId(String taskid);
// PageResult<PersonRepDto> selectExamStuList(StudentPageReqVO examStu);

View File

@@ -3,6 +3,7 @@ package pc.exam.pp.module.exam.service.paper;
import pc.exam.pp.framework.common.pojo.PageResult;
import pc.exam.pp.module.exam.controller.admin.paper.dto.EducationPaperStuDto;
import pc.exam.pp.module.exam.controller.admin.paper.vo.ExamPaperVo;
import pc.exam.pp.module.exam.controller.admin.paper.vo.PaperPageVo;
import pc.exam.pp.module.exam.dal.dataobject.PaperListResponseVo;
import pc.exam.pp.module.exam.dal.dataobject.EducationPaper;
@@ -90,5 +91,6 @@ public interface IEducationPaperService
PageResult<EducationPaperStuDto> selectStuEducationPaperList(PaperPageVo paperPageVo);
ExamPaperVo stuInfoPaper(String taskid);
}

View File

@@ -4,6 +4,7 @@ package pc.exam.pp.module.exam.service.paper;
import pc.exam.pp.framework.common.pojo.PageResult;
import pc.exam.pp.module.exam.controller.admin.paper.dto.SchemeParam;
import pc.exam.pp.module.exam.controller.admin.paper.dto.TempDto;
import pc.exam.pp.module.exam.controller.admin.paper.vo.ExamPaperVo;
import pc.exam.pp.module.exam.controller.admin.paper.vo.PaperTaskPageVo;
import pc.exam.pp.module.exam.dal.dataobject.ExamPaperKnowledgePoints;
import pc.exam.pp.module.exam.dal.dataobject.EducationPaperTask;
@@ -82,5 +83,6 @@ public interface IEducationPaperTaskService
boolean changeStatus(String taskId, String status);
ExamPaperVo selectPaperQuByPaperId(String taskId);
}

View File

@@ -7,11 +7,11 @@
<resultMap type="EducationPaperQu" id="EducationPaperQuResult">
<result property="paperId" column="paper_id" />
<result property="quId" column="qu_id" />
<result property="quVersion" column="qu_version" />
<result property="sort" column="sort" />
</resultMap>
<sql id="selectEducationPaperQuVo">
select paper_id, qu_id, qu_version from education_paper_qu
select paper_id, qu_id, sort from education_paper_qu
</sql>
<select id="selectEducationPaperQuList" parameterType="EducationPaperQu" resultMap="EducationPaperQuResult">
@@ -19,7 +19,7 @@
<where>
<if test="paperId != null and paperId != ''"> and paper_id = #{paperId}</if>
<if test="quId != null and quId != ''"> and qu_id = #{quId}</if>
<if test="quVersion != null and quVersion != ''"> and qu_version = #{quVersion}</if>
<if test="sort != null and sort != ''"> and qu_version = #{quVersion}</if>
</where>
</select>
@@ -28,7 +28,7 @@
where paper_id = #{paperId}
</select>
<select id="selectPaperQuByPaperId" resultType="java.lang.String">
select qu_id from education_paper_qu where paper_id =#{paperId}
select qu_id from education_paper_qu where paper_id =#{paperId} order by sort asc
</select>
<select id="selectPaperQuListByPaperId" resultMap="EducationPaperQuResult">
<include refid="selectEducationPaperQuVo"/>
@@ -41,12 +41,12 @@
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="paperId != null">paper_id,</if>
<if test="quId != null">qu_id,</if>
<if test="quVersion != null">qu_version,</if>
<if test="sort != null">sort,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="paperId != null">#{paperId},</if>
<if test="quId != null">#{quId},</if>
<if test="quVersion != null">#{quVersion},</if>
<if test="sort != null">#{sort},</if>
</trim>
</insert>
<insert id="insertEducationPaperQuList">

View File

@@ -9,6 +9,7 @@
<result property="taskName" column="task_name" />
<result property="taskSpecialty" column="task_specialty" />
<result property="taskType" column="task_type" />
<result property="isOne" column="is_one" />
<result property="isTemplate" column="is_template" />
<result property="status" column="status" />
<result property="createTime" column="create_time" />
@@ -29,7 +30,7 @@
<result property="treeNum" column="tree_num" />
</resultMap>
<sql id="selectEducationPaperTaskVo">
select task_id, task_name, task_specialty, task_type, is_template, status, create_time, update_time, creator, updater, deleted,tenant_id from education_paper_task
select task_id, task_name, task_specialty, task_type,is_one, is_template, status, create_time, update_time, creator, updater, deleted,tenant_id from education_paper_task
</sql>
@@ -119,6 +120,15 @@
where task_type = #{id}
and deleted='0'
</select>
<select id="selectPaperQuByPaperId" resultType="java.lang.String">
SELECT paper_id
FROM education_paper
WHERE task_id =#{taskId}
and roll_up is not NULL
and deleted ='0'
ORDER BY RAND()
LIMIT 1;
</select>
<insert id="insertEducationPaperTask" parameterType="EducationPaperTask">
@@ -160,6 +170,7 @@
<if test="taskName != null">task_name = #{taskName},</if>
<if test="taskSpecialty != null">task_specialty = #{taskSpecialty},</if>
<if test="taskType != null">task_type = #{taskType},</if>
<if test="isOne != null">is_one = #{isOne},</if>
<if test="isTemplate != null">is_template = #{isTemplate},</if>
<if test="status != null">status = #{status},</if>
<if test="createTime != null">create_time = #{createTime},</if>