소스 검색

代码优化

gaodm 5 년 전
부모
커밋
aaf3273a22
1개의 변경된 파일16개의 추가작업 그리고 12개의 파일을 삭제
  1. 16 12
      icssman-service/src/main/java/com/diagbot/facade/ModuleDetailFacade.java

+ 16 - 12
icssman-service/src/main/java/com/diagbot/facade/ModuleDetailFacade.java

@@ -34,8 +34,6 @@ import java.util.stream.Collectors;
 @Component
 public class ModuleDetailFacade extends ModuleDetailServiceImpl {
 
-    @Autowired
-    private ModuleInfoFacade moduleInfoFacade;
     @Autowired
     @Qualifier("moduleDetailServiceImpl")
     private ModuleDetailService moduleDetailService;
@@ -90,17 +88,23 @@ public class ModuleDetailFacade extends ModuleDetailServiceImpl {
                 textList.add(addModuleDetailVO.getText());
             }
         }
-        QueryWrapper<QuestionInfo> questionInfoQueryWrapper = new QueryWrapper<>();
-        questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
-                .eq("tag_type", TagTypeEnum.T8.getKey())
-                .eq("type", addModuleInfoVO.getTextType())
-                .in("name", textList);
-        List<QuestionInfo> questionInfoList = questionFacade.list(questionInfoQueryWrapper);
+
         //将标签id放入map
         Map<String, Long> questionIdMap = new HashMap<>();
-        for (AddModuleDetailVO addModuleDetailVO : addModuleInfoVO.getModelDetils()) {
-            if (StringUtil.isNotEmpty(addModuleDetailVO.getText())) {
-                questionIdMap = questionInfoList.stream().collect(Collectors.toMap(QuestionInfo::getTagName, questionInfo -> questionInfo.getId()));
+        if (ListUtil.isNotEmpty(textList)){
+            QueryWrapper<QuestionInfo> questionInfoQueryWrapper = new QueryWrapper<>();
+            questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+                    .eq("tag_type", TagTypeEnum.T8.getKey())
+                    .eq("type", addModuleInfoVO.getTextType())
+                    .in("name", textList);
+            List<QuestionInfo> questionInfoList = questionFacade.list(questionInfoQueryWrapper);
+
+            for (AddModuleDetailVO addModuleDetailVO : addModuleInfoVO.getModelDetils()) {
+                if (StringUtil.isNotEmpty(addModuleDetailVO.getText())) {
+                    questionIdMap = questionInfoList.stream()
+                            .collect(Collectors.toMap(QuestionInfo::getTagName,
+                                    questionInfo -> questionInfo.getId()));
+                }
             }
         }
         QuestionInfo addquestionInfo = null;
@@ -132,7 +136,7 @@ public class ModuleDetailFacade extends ModuleDetailServiceImpl {
         questionInfoService.saveBatch(addQuestionInfoList);
         //查询自定义标签的id
         QueryWrapper<QuestionInfo> questionInfoQueryWrapper1 = new QueryWrapper<>();
-        questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
+        questionInfoQueryWrapper1.eq("is_deleted", IsDeleteEnum.N.getKey())
                 .eq("type", addModuleInfoVO.getTextType())
                 .eq("tag_type", TagTypeEnum.T8.getKey());
         List<QuestionInfo> questionInfoList1 = questionFacade.list(questionInfoQueryWrapper1);