Browse Source

代码整理

gaodm 5 years ago
parent
commit
c19d09ba4c

+ 16 - 10
precman-service/src/main/java/com/diagbot/facade/ModuleDetailFacade.java

@@ -90,19 +90,25 @@ 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.getModuleDetail()) {
-            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.getModuleDetail()) {
+                if (StringUtil.isNotEmpty(addModuleDetailVO.getText())) {
+                    questionIdMap = questionInfoList.stream()
+                            .collect(Collectors.toMap(QuestionInfo::getTagName, questionInfo -> questionInfo.getId()));
+                }
             }
         }
+
         QuestionInfo addquestionInfo = null;
         List<QuestionInfo> addQuestionInfoList = new ArrayList<>();
         List<String> textExistList = new ArrayList<>();
@@ -131,7 +137,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);