he2802 преди 4 години
родител
ревизия
f1284307cf
променени са 1 файла, в които са добавени 26 реда и са изтрити 0 реда
  1. 26 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionChapterServiceImpl.java

+ 26 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionChapterServiceImpl.java

@@ -7,8 +7,10 @@ import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.modules.bank.bo.*;
 import com.zhongzheng.modules.bank.domain.QuestionBusiness;
 import com.zhongzheng.modules.bank.domain.QuestionChapter;
+import com.zhongzheng.modules.bank.domain.QuestionChapterExam;
 import com.zhongzheng.modules.bank.mapper.QuestionChapterMapper;
 import com.zhongzheng.modules.bank.service.IQuestionBusinessService;
+import com.zhongzheng.modules.bank.service.IQuestionChapterExamService;
 import com.zhongzheng.modules.bank.service.IQuestionChapterService;
 import com.zhongzheng.modules.bank.vo.QuestionChapterVo;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -37,6 +39,9 @@ public class QuestionChapterServiceImpl extends ServiceImpl<QuestionChapterMappe
     @Autowired
     private IQuestionBusinessService iQuestionBusinessService;
 
+    @Autowired
+    private IQuestionChapterExamService iQuestionChapterExamService;
+
     @Override
     public QuestionChapterVo queryById(Long chapterExamId){
         QuestionChapter db = this.baseMapper.selectById(chapterExamId);
@@ -95,6 +100,16 @@ public class QuestionChapterServiceImpl extends ServiceImpl<QuestionChapterMappe
             }
             iQuestionBusinessService.saveBatch(coll);
         }
+        if(bo.getExamList()!=null){
+            Collection<QuestionChapterExam> coll = new HashSet<>();
+            for(int i=0;i<bo.getExamList().size();i++){
+                QuestionChapterExamAddBo item = bo.getExamList().get(i);
+                QuestionChapterExam addItem = BeanUtil.toBean(item,  QuestionChapterExam.class);
+                addItem.setChapterExamId(add.getChapterExamId());
+                coll.add(addItem);
+            }
+            iQuestionChapterExamService.saveBatch(coll);
+        }
         return result;
     }
 
@@ -117,6 +132,17 @@ public class QuestionChapterServiceImpl extends ServiceImpl<QuestionChapterMappe
             }
             iQuestionBusinessService.saveBatch(coll);
         }
+        if(bo.getExamList()!=null&&bo.getExamList().size()>0){
+            iQuestionChapterExamService.remove(new LambdaQueryWrapper<QuestionChapterExam>().eq(QuestionChapterExam::getChapterExamId, bo.getChapterExamId()));
+            Collection<QuestionChapterExam> coll = new HashSet<>();
+            for(int i=0;i<bo.getBusinessList().size();i++){
+                QuestionChapterExamEditBo item = bo.getExamList().get(i);
+                QuestionChapterExam addItem = BeanUtil.toBean(item,  QuestionChapterExam.class);
+                addItem.setChapterExamId(update.getChapterExamId());
+                coll.add(addItem);
+            }
+            iQuestionChapterExamService.saveBatch(coll);
+        }
         return this.updateById(update);
     }