|
@@ -35,6 +35,7 @@ import vip.xiaonuo.exam.domain.exam.TExamEditParam;
|
|
|
import vip.xiaonuo.exam.domain.exam.TExamIdParam;
|
|
import vip.xiaonuo.exam.domain.exam.TExamIdParam;
|
|
|
import vip.xiaonuo.exam.domain.exam.TExamPageParam;
|
|
import vip.xiaonuo.exam.domain.exam.TExamPageParam;
|
|
|
import vip.xiaonuo.exam.mapper.CourseChapterPaperMapper;
|
|
import vip.xiaonuo.exam.mapper.CourseChapterPaperMapper;
|
|
|
|
|
+import vip.xiaonuo.exam.mapper.ExamPaperMapper;
|
|
|
import vip.xiaonuo.exam.mapper.TExamMapper;
|
|
import vip.xiaonuo.exam.mapper.TExamMapper;
|
|
|
import vip.xiaonuo.exam.service.ExamPaperService;
|
|
import vip.xiaonuo.exam.service.ExamPaperService;
|
|
|
import vip.xiaonuo.exam.service.TExamService;
|
|
import vip.xiaonuo.exam.service.TExamService;
|
|
@@ -71,7 +72,8 @@ public class TExamServiceImpl extends ServiceImpl<TExamMapper, TExam> implements
|
|
|
@Resource
|
|
@Resource
|
|
|
private TExamMapper tExamMapper;
|
|
private TExamMapper tExamMapper;
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private ExamPaperMapper examPaperMapper;
|
|
|
@Override
|
|
@Override
|
|
|
public Page<TExamVo> page(TExamPageParam tExamPageParam) {
|
|
public Page<TExamVo> page(TExamPageParam tExamPageParam) {
|
|
|
Page<TExamVo> page = tExamMapper.queryList(CommonPageRequest.defaultPage(), tExamPageParam);
|
|
Page<TExamVo> page = tExamMapper.queryList(CommonPageRequest.defaultPage(), tExamPageParam);
|
|
@@ -82,6 +84,12 @@ public class TExamServiceImpl extends ServiceImpl<TExamMapper, TExam> implements
|
|
|
@Override
|
|
@Override
|
|
|
public void add(TExamAddParam tExamAddParam) {
|
|
public void add(TExamAddParam tExamAddParam) {
|
|
|
ExamPaper examPaper = examPaperService.selectById(Integer.parseInt(tExamAddParam.getPaperId()));
|
|
ExamPaper examPaper = examPaperService.selectById(Integer.parseInt(tExamAddParam.getPaperId()));
|
|
|
|
|
+
|
|
|
|
|
+ ExamPaper newExamPaper=new ExamPaper();
|
|
|
|
|
+ newExamPaper.setId(Integer.valueOf(tExamAddParam.getPaperId()));
|
|
|
|
|
+ newExamPaper.setIsSelect(1);
|
|
|
|
|
+ examPaperMapper.updateByPrimaryKeySelective(newExamPaper);
|
|
|
|
|
+
|
|
|
if(ExamPaperTypeEnum.TimeLimit.getCode() == examPaper.getPaperType()){
|
|
if(ExamPaperTypeEnum.TimeLimit.getCode() == examPaper.getPaperType()){
|
|
|
tExamAddParam.setStartTime(examPaper.getLimitStartTime());
|
|
tExamAddParam.setStartTime(examPaper.getLimitStartTime());
|
|
|
tExamAddParam.setEndTime(examPaper.getLimitEndTime());
|
|
tExamAddParam.setEndTime(examPaper.getLimitEndTime());
|
|
@@ -146,6 +154,21 @@ public class TExamServiceImpl extends ServiceImpl<TExamMapper, TExam> implements
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
TExam tExam = this.queryEntity(tExamEditParam.getId().toString());
|
|
TExam tExam = this.queryEntity(tExamEditParam.getId().toString());
|
|
|
|
|
+ //新选的卷子id,和旧卷子id不相等的时候,将旧卷子id的is_select字段置为0,将新卷子id的is_select字段置为1 is_select 0 未选中 1已选中
|
|
|
|
|
+ if(!ObjectUtil.equals(tExam.getPaperId(), tExamEditParam.getPaperId())){
|
|
|
|
|
+ //将旧卷子id的is_select字段置为0
|
|
|
|
|
+ ExamPaper newExamPaper=new ExamPaper();
|
|
|
|
|
+ newExamPaper.setId(Integer.valueOf(tExam.getPaperId()));
|
|
|
|
|
+ newExamPaper.setIsSelect(0);
|
|
|
|
|
+ examPaperMapper.updateByPrimaryKeySelective(newExamPaper);
|
|
|
|
|
+ //将新卷子id的is_select字段置为1
|
|
|
|
|
+ newExamPaper=new ExamPaper();
|
|
|
|
|
+ newExamPaper.setId(Integer.valueOf(tExamEditParam.getPaperId()));
|
|
|
|
|
+ newExamPaper.setIsSelect(1);
|
|
|
|
|
+ examPaperMapper.updateByPrimaryKeySelective(newExamPaper);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
if(tExamEditParam.getPaperId() != null && !tExamEditParam.getPaperId().isEmpty()){
|
|
if(tExamEditParam.getPaperId() != null && !tExamEditParam.getPaperId().isEmpty()){
|
|
|
ExamPaper examPaper = examPaperService.selectById(Integer.parseInt(tExamEditParam.getPaperId()));
|
|
ExamPaper examPaper = examPaperService.selectById(Integer.parseInt(tExamEditParam.getPaperId()));
|
|
|
if(ExamPaperTypeEnum.TimeLimit.getCode() == examPaper.getPaperType()){
|
|
if(ExamPaperTypeEnum.TimeLimit.getCode() == examPaper.getPaperType()){
|