From 4d0f03606aa9030e70ced69fb0f5bdfea7196395 Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期三, 29 五月 2024 11:20:52 +0800
Subject: [PATCH] fix:统计部门加上删除标识
---
src/main/java/com/mindskip/xzs/service/impl/QuestionServiceImpl.java | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/main/java/com/mindskip/xzs/service/impl/QuestionServiceImpl.java b/src/main/java/com/mindskip/xzs/service/impl/QuestionServiceImpl.java
index 3c152c9..3e5ce6b 100644
--- a/src/main/java/com/mindskip/xzs/service/impl/QuestionServiceImpl.java
+++ b/src/main/java/com/mindskip/xzs/service/impl/QuestionServiceImpl.java
@@ -39,6 +39,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.Arrays;
@@ -108,7 +109,9 @@
deptQuestion.setDeptId(deptId);
return deptQuestion;
}).collect(Collectors.toList());
- deptQuestionMapper.add(deptQuestions);
+ if (! CollectionUtils.isEmpty(model.getDeptIds())) {
+ deptQuestionMapper.add(deptQuestions);
+ }
//鎵归噺娣诲姞
List<QuestionSubject> list = Arrays.asList(model.getSubjectIds()).stream().map(e -> {
@@ -136,14 +139,16 @@
questionMapper.updateByPrimaryKeySelective(question);
// 澶勭悊棰樼洰鎵�灞為儴闂�
- deptQuestionMapper.remove(question.getId(), model.getDeptIds());
+ deptQuestionMapper.remove(question.getId());
List<DeptQuestion> deptQuestions = model.getDeptIds().stream().map(deptId -> {
DeptQuestion deptQuestion = new DeptQuestion();
deptQuestion.setQuestionId(question.getId());
deptQuestion.setDeptId(deptId);
return deptQuestion;
}).collect(Collectors.toList());
- deptQuestionMapper.add(deptQuestions);
+ if (! CollectionUtils.isEmpty(model.getDeptIds())) {
+ deptQuestionMapper.add(deptQuestions);
+ }
//棰樺共銆佽В鏋愩�侀�夐」绛� 鏇存柊
TextContent infoTextContent = textContentService.selectById(question.getInfoTextContentId());
--
Gitblit v1.8.0