|
@@ -4,15 +4,14 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.common.utils.ServletUtils;
|
|
|
-import com.zhongzheng.modules.bank.bo.ExamAddBo;
|
|
|
-import com.zhongzheng.modules.bank.bo.ExamEditBo;
|
|
|
-import com.zhongzheng.modules.bank.bo.ExamQueryBo;
|
|
|
-import com.zhongzheng.modules.bank.bo.ExamQuestionAddBo;
|
|
|
+import com.zhongzheng.modules.bank.bo.*;
|
|
|
import com.zhongzheng.modules.bank.domain.Exam;
|
|
|
import com.zhongzheng.modules.bank.domain.ExamQuestion;
|
|
|
+import com.zhongzheng.modules.bank.domain.QuestionBusiness;
|
|
|
import com.zhongzheng.modules.bank.mapper.ExamMapper;
|
|
|
import com.zhongzheng.modules.bank.service.IExamQuestionService;
|
|
|
import com.zhongzheng.modules.bank.service.IExamService;
|
|
|
+import com.zhongzheng.modules.bank.service.IQuestionBusinessService;
|
|
|
import com.zhongzheng.modules.bank.vo.ExamVo;
|
|
|
import com.zhongzheng.modules.course.bo.CourseChapterSectionListAddBo;
|
|
|
import com.zhongzheng.modules.course.domain.CourseChapterSection;
|
|
@@ -43,6 +42,9 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
|
|
|
@Autowired
|
|
|
private IExamQuestionService iExamQuestionService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IQuestionBusinessService iQuestionBusinessService;
|
|
|
+
|
|
|
@Override
|
|
|
public ExamVo queryById(Long examId){
|
|
|
Exam db = this.baseMapper.selectById(examId);
|
|
@@ -53,11 +55,7 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
|
|
|
public List<ExamVo> queryList(ExamQueryBo bo) {
|
|
|
LambdaQueryWrapper<Exam> lqw = Wrappers.lambdaQuery();
|
|
|
lqw.in(bo.getStatus() != null, Exam::getStatus, bo.getStatus());
|
|
|
- lqw.eq(bo.getEducationTypeId() != null, Exam::getEducationTypeId, bo.getEducationTypeId());
|
|
|
- lqw.eq(bo.getBusinessId() != null, Exam::getBusinessId, bo.getBusinessId());
|
|
|
- lqw.eq(bo.getSubjectId() != null, Exam::getSubjectId, bo.getSubjectId());
|
|
|
lqw.like(StrUtil.isNotBlank(bo.getPrefixName()), Exam::getPrefixName, bo.getPrefixName());
|
|
|
- lqw.eq(bo.getProjectId() != null, Exam::getProjectId, bo.getProjectId());
|
|
|
lqw.eq(StrUtil.isNotBlank(bo.getCode()), Exam::getCode, bo.getCode());
|
|
|
lqw.like(StrUtil.isNotBlank(bo.getExamName()), Exam::getExamName, bo.getExamName());
|
|
|
lqw.eq(bo.getPublishStatus() != null, Exam::getPublishStatus, bo.getPublishStatus());
|
|
@@ -110,6 +108,17 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
|
|
|
}
|
|
|
iExamQuestionService.saveBatch(coll);
|
|
|
}
|
|
|
+ if(bo.getBusinessList()!=null){
|
|
|
+ Collection<QuestionBusiness> coll = new HashSet<>();
|
|
|
+ for(int i=0;i<bo.getBusinessList().size();i++){
|
|
|
+ QuestionBusinessAddBo item = bo.getBusinessList().get(i);
|
|
|
+ QuestionBusiness addItem = BeanUtil.toBean(item, QuestionBusiness.class);
|
|
|
+ addItem.setMajorId(add.getExamId());
|
|
|
+ addItem.setType(QuestionBusiness.TYPE_EXAM);
|
|
|
+ coll.add(addItem);
|
|
|
+ }
|
|
|
+ iQuestionBusinessService.saveBatch(coll);
|
|
|
+ }
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -132,6 +141,20 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
|
|
|
}
|
|
|
iExamQuestionService.saveBatch(coll);
|
|
|
}
|
|
|
+ if(bo.getBusinessList()!=null){
|
|
|
+ iQuestionBusinessService.remove(new LambdaQueryWrapper<QuestionBusiness>()
|
|
|
+ .eq(QuestionBusiness::getMajorId, bo.getExamId())
|
|
|
+ .eq(QuestionBusiness::getType,QuestionBusiness.TYPE_EXAM));
|
|
|
+ Collection<QuestionBusiness> coll = new HashSet<>();
|
|
|
+ for(int i=0;i<bo.getBusinessList().size();i++){
|
|
|
+ QuestionBusinessEditBo item = bo.getBusinessList().get(i);
|
|
|
+ QuestionBusiness addItem = BeanUtil.toBean(item, QuestionBusiness.class);
|
|
|
+ addItem.setMajorId(bo.getExamId());
|
|
|
+ addItem.setType(QuestionBusiness.TYPE_EXAM);
|
|
|
+ coll.add(addItem);
|
|
|
+ }
|
|
|
+ iQuestionBusinessService.saveBatch(coll);
|
|
|
+ }
|
|
|
return this.updateById(update);
|
|
|
}
|
|
|
|