|
@@ -3,11 +3,16 @@ package com.diagbot.facade;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.diagbot.dto.QuestionIndexDTO;
|
|
import com.diagbot.dto.QuestionIndexDTO;
|
|
import com.diagbot.entity.QuestionInfo;
|
|
import com.diagbot.entity.QuestionInfo;
|
|
|
|
+import com.diagbot.entity.wrapper.QuestionWrapper;
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
|
+import com.diagbot.exception.CommonErrorCode;
|
|
|
|
+import com.diagbot.exception.CommonException;
|
|
import com.diagbot.service.impl.QuestionInfoServiceImpl;
|
|
import com.diagbot.service.impl.QuestionInfoServiceImpl;
|
|
|
|
+import com.diagbot.util.BeanUtil;
|
|
import com.diagbot.util.DateUtil;
|
|
import com.diagbot.util.DateUtil;
|
|
import com.diagbot.util.StringUtil;
|
|
import com.diagbot.util.StringUtil;
|
|
import com.diagbot.util.UserUtils;
|
|
import com.diagbot.util.UserUtils;
|
|
|
|
+import com.diagbot.vo.QuestionSaveVO;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
@@ -31,6 +36,62 @@ public class QuestionInfoFacade extends QuestionInfoServiceImpl {
|
|
@Autowired
|
|
@Autowired
|
|
ModuleDetailFacade moduleDetailFacade;
|
|
ModuleDetailFacade moduleDetailFacade;
|
|
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 标签保存
|
|
|
|
+ *
|
|
|
|
+ * @param questionSaveVO
|
|
|
|
+ */
|
|
|
|
+ public void saveOrUpdate(QuestionSaveVO questionSaveVO) {
|
|
|
|
+
|
|
|
|
+// String person = UserUtils.getCurrentPrincipleID(); //TODO person
|
|
|
|
+ String person = "default";
|
|
|
|
+ QuestionWrapper questionWrapper = questionSaveVO.getQuestionWrapper();
|
|
|
|
+ //1、主表信息
|
|
|
|
+ QuestionInfo questionInfo = new QuestionInfo();
|
|
|
|
+ String saveOrUpdate = "save"; //新增或修改的标识
|
|
|
|
+ if(questionWrapper.getId() != null) {
|
|
|
|
+ QueryWrapper queryWrapper = new QueryWrapper();
|
|
|
|
+ queryWrapper.eq("id", questionWrapper.getId());
|
|
|
|
+ queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
|
+ questionInfo = getOne(queryWrapper);
|
|
|
|
+ if(questionInfo == null) {
|
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
|
|
|
|
+ "标签不存在");
|
|
|
|
+ }
|
|
|
|
+ saveOrUpdate = "update";
|
|
|
|
+ }
|
|
|
|
+ BeanUtil.copyProperties(questionWrapper, questionInfo);
|
|
|
|
+ //标签type、tagName唯一
|
|
|
|
+ QueryWrapper queryWrapper = new QueryWrapper();
|
|
|
|
+ queryWrapper.eq("tag_name", questionInfo.getTagName());
|
|
|
|
+ queryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
|
+ queryWrapper.eq("type", questionInfo.getType());
|
|
|
|
+ queryWrapper.ne("id", questionInfo.getId() == null ? 0 : questionInfo.getId());
|
|
|
|
+ List<QuestionInfo> questionInfoList = this.list(queryWrapper);
|
|
|
|
+ if(questionInfoList.size() > 0) {
|
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
|
|
|
|
+ "标签名已存在");
|
|
|
|
+ }
|
|
|
|
+ if("save".equals(saveOrUpdate)) {
|
|
|
|
+ questionInfo.setCreator(person); //创建人
|
|
|
|
+ questionInfo.setGmtCreate(DateUtil.now());//创建时间
|
|
|
|
+ } else {
|
|
|
|
+ questionInfo.setGmtModified(DateUtil.now());//修改时间
|
|
|
|
+ questionInfo.setModifier(person);//修改人
|
|
|
|
+ }
|
|
|
|
+ this.saveOrUpdate(questionInfo);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //明细信息
|
|
|
|
+
|
|
|
|
+ //映射信息
|
|
|
|
+
|
|
|
|
+ //同义词信息
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 根据id删除标签
|
|
* 根据id删除标签
|
|
*
|
|
*
|