zhoutg 6 rokov pred
rodič
commit
0eac18ecb3

+ 25 - 0
icssman-service/src/main/java/com/diagbot/facade/QuestionFacade.java

@@ -466,6 +466,31 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
             paramMap.put("ids", Arrays.asList(ids.split(",")));
             paramMap.put("gmtModified", now);
             paramMap.put("modifier", person);
+
+            // 映射关系删除校验,如果有父项关联,不能删除
+            List<QuestionInfo> questionInfoList = getParentQuestion(Long.parseLong(id));
+            for (QuestionInfo questionInfo : questionInfoList) {
+                if (questionInfo.getTagType().equals(TagTypeEnum.T10.getKey())) {
+
+                }
+            }
+            if (ListUtil.isNotEmpty(questionInfoList)) {
+                StringBuffer sb = new StringBuffer();
+                sb.append("请先删除上级关联:");
+                for (QuestionInfo ques : questionInfoList) {
+                    if (ques.getTagType().equals(TagTypeEnum.T10.getKey())) {  // 既往史下特殊类型
+                        List<QuestionInfo> question2 = getParentQuestion(ques.getId());
+                        if (ListUtil.isNotEmpty(question2)) {
+                            sb.append("【" + question2.get(0).getTagName() + "】"); // 有且只有一个
+                        }
+                    } else {
+                        sb.append("【" + ques.getTagName() + "】");
+                    }
+                }
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                        sb.toString());
+            }
+
             //删除自身
             this.deleteByIds(paramMap);
             //删除明细