|
@@ -38,6 +38,7 @@ import com.diagbot.vo.QuestionIndexVO;
|
|
|
import com.diagbot.vo.QuestionPageVO;
|
|
|
import com.diagbot.vo.QuestionSaveVO;
|
|
|
import com.diagbot.vo.QuestionVO;
|
|
|
+import com.diagbot.vo.SubQuestionVO;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
import org.springframework.stereotype.Component;
|
|
@@ -329,6 +330,21 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
|
|
|
throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
|
|
|
finalMsg.toString());
|
|
|
}
|
|
|
+
|
|
|
+ // 判断是否在明细中有关联
|
|
|
+ SubQuestionVO subQuestionVO = new SubQuestionVO();
|
|
|
+ subQuestionVO.setId(Long.parseLong(id));
|
|
|
+ List<QuestionInfo> list = getBySubQuestionId(subQuestionVO);
|
|
|
+ if (ListUtil.isNotEmpty(list)) {
|
|
|
+ StringBuffer errMsg = new StringBuffer();
|
|
|
+ errMsg.append("请先删除在上级明细中的关联:");
|
|
|
+ for (QuestionInfo questionInfo : list) {
|
|
|
+ errMsg.append("【" + questionInfo.getTagName() + "】");
|
|
|
+ }
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
|
|
|
+ errMsg.toString());
|
|
|
+ }
|
|
|
+
|
|
|
//删除自身
|
|
|
this.deleteByIds(paramMap);
|
|
|
//删除明细
|
|
@@ -490,6 +506,30 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
|
|
|
return data;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据id返回被引用的父标签
|
|
|
+ *
|
|
|
+ * @param subQuestionVO 获取父标签内容参数
|
|
|
+ * @return 标签内容
|
|
|
+ */
|
|
|
+ public List<QuestionInfo> getBySubQuestionId(SubQuestionVO subQuestionVO) {
|
|
|
+ List<QuestionDetail> list = questionDetailFacade.list(new QueryWrapper<QuestionDetail>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .apply("find_in_set({0}, sub_question)", subQuestionVO.getId())
|
|
|
+ );
|
|
|
+ if (ListUtil.isNotEmpty(list)) {
|
|
|
+ List<Long> ids = list.stream().map(r -> r.getQuestionId()).distinct().collect(Collectors.toList());
|
|
|
+ return this.list(new QueryWrapper<QuestionInfo>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .in("id", ids)
|
|
|
+ );
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 获取所有需要删除的缓存id列表
|
|
|
*
|