|
@@ -3,12 +3,19 @@ package com.diagbot.facade;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.diagbot.entity.IntroduceDetail;
|
|
|
+import com.diagbot.entity.IntroduceInfo;
|
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
|
+import com.diagbot.exception.CommonErrorCode;
|
|
|
+import com.diagbot.exception.CommonException;
|
|
|
import com.diagbot.service.impl.IntroduceDetailServiceImpl;
|
|
|
import com.diagbot.util.DateUtil;
|
|
|
import com.diagbot.util.UserUtils;
|
|
|
+import com.diagbot.vo.IntroduceDetailSingleVO;
|
|
|
+import com.diagbot.vo.IntroduceDetailVO;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
@@ -18,6 +25,8 @@ import java.util.List;
|
|
|
*/
|
|
|
@Component
|
|
|
public class IntroduceDetailFacade extends IntroduceDetailServiceImpl {
|
|
|
+ @Autowired
|
|
|
+ private IntroduceInfoFacade introduceInfoFacade;
|
|
|
|
|
|
/**
|
|
|
* 获取提示信息明细
|
|
@@ -32,6 +41,66 @@ public class IntroduceDetailFacade extends IntroduceDetailServiceImpl {
|
|
|
return this.list(introduceDetailQueryWrapper);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取单条提示信息明细
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public IntroduceDetail getRecordById(Long id) {
|
|
|
+ IntroduceDetail detail = super.getById(id);
|
|
|
+ if (detail == null) {
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS, "提示信息明细不存在");
|
|
|
+ } else if (detail.getIsDeleted().equals(IsDeleteEnum.Y.getKey())) {
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS, "提示信息明细已删除");
|
|
|
+ }
|
|
|
+ return detail;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 单条明细保存
|
|
|
+ *
|
|
|
+ * @param detailSingleVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Boolean saveRecord(IntroduceDetailSingleVO detailSingleVO) {
|
|
|
+ if (detailSingleVO.getIntroduceId() == null || detailSingleVO.getIntroduceId().equals(0L)) {
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_ERROR, "请输入提示信息id");
|
|
|
+ }
|
|
|
+ IntroduceInfo introduceInfo = introduceInfoFacade.getById(detailSingleVO.getIntroduceId());
|
|
|
+ if (introduceInfo == null) {
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS, "提示信息不存在");
|
|
|
+ } else if (introduceInfo.getIsDeleted().equals(IsDeleteEnum.Y.getKey())) {
|
|
|
+ throw new CommonException(CommonErrorCode.NOT_EXISTS, "提示信息已删除");
|
|
|
+ }
|
|
|
+
|
|
|
+ String userId = UserUtils.getCurrentPrincipleID();
|
|
|
+ Date now = DateUtil.now();
|
|
|
+ IntroduceDetail detail = super.getById(detailSingleVO.getId());
|
|
|
+ if (!(detail == null || detail.getIsDeleted().equals(IsDeleteEnum.Y.getKey()))) {
|
|
|
+ detail.setIsDeleted(IsDeleteEnum.Y.getKey());
|
|
|
+ detail.setModifier(userId);
|
|
|
+ detail.setGmtModified(now);
|
|
|
+ this.updateById(detail);
|
|
|
+ }
|
|
|
+ detail = new IntroduceDetail();
|
|
|
+ detail.setIsReason(detailSingleVO.getIsReason());
|
|
|
+ detail.setTitle(detailSingleVO.getTitle());
|
|
|
+ detail.setOrderNo(detailSingleVO.getOrderNo());
|
|
|
+ detail.setText(detailSingleVO.getText());
|
|
|
+ detail.setContent(detailSingleVO.getContent());
|
|
|
+ detail.setIntroduceId(detailSingleVO.getIntroduceId());
|
|
|
+ detail.setPosition(detailSingleVO.getPosition());
|
|
|
+ detail.setCreator(userId);
|
|
|
+ detail.setGmtCreate(now);
|
|
|
+ detail.setModifier(userId);
|
|
|
+ detail.setGmtModified(now);
|
|
|
+
|
|
|
+ this.saveOrUpdate(detail);
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 单条删除提示信息明细 逻辑删除
|
|
|
*
|