|
@@ -1,21 +1,22 @@
|
|
|
package com.diagbot.facade;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.diagbot.entity.IntroduceDetail;
|
|
|
import com.diagbot.entity.IntroduceInfo;
|
|
|
-import com.diagbot.enums.IsDeleteEnum;
|
|
|
import com.diagbot.service.impl.IntroduceDetailServiceImpl;
|
|
|
import com.diagbot.service.impl.IntroduceInfoServiceImpl;
|
|
|
import com.diagbot.util.UserUtils;
|
|
|
+import com.diagbot.vo.IntroduceDetailVO;
|
|
|
import com.diagbot.vo.IntroducePageVO;
|
|
|
import com.diagbot.vo.IntroduceVO;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
@@ -42,15 +43,18 @@ public class IntroduceInfoFacade extends IntroduceInfoServiceImpl {
|
|
|
IntroduceInfo introduceInfo = new IntroduceInfo();
|
|
|
if (!(introduceVO.getId() == null)) {
|
|
|
introduceInfo = this.getById(introduceVO.getId());
|
|
|
- introduceInfo.setModifier(UserUtils.getCurrentPrincipleID());
|
|
|
+ //introduceInfo.setModifier(UserUtils.getCurrentPrincipleID());
|
|
|
introduceInfo.setGmtModified(new Date());
|
|
|
} else {
|
|
|
- introduceInfo.setCreator(UserUtils.getCurrentPrincipleID());
|
|
|
+ //introduceInfo.setCreator(UserUtils.getCurrentPrincipleID());
|
|
|
introduceInfo.setGmtCreate(new Date());
|
|
|
}
|
|
|
introduceInfo.setName(introduceVO.getName());
|
|
|
introduceInfo.setRemark(introduceVO.getRemark());
|
|
|
|
|
|
+ //更新提示信息
|
|
|
+ this.saveOrUpdate(introduceInfo);
|
|
|
+
|
|
|
//明细信息不更新,每次都删除重新插入
|
|
|
//删除已有明细,物理删除
|
|
|
if (!(introduceInfo.getId() == null)) {
|
|
@@ -58,15 +62,21 @@ public class IntroduceInfoFacade extends IntroduceInfoServiceImpl {
|
|
|
detailQueryWrapper.eq("introduce_id", introduceInfo.getId());
|
|
|
introduceDetailFacade.remove(detailQueryWrapper);
|
|
|
}
|
|
|
- //新增明细,清空id
|
|
|
- for (IntroduceDetail detail : introduceVO.getDetailList()) {
|
|
|
- detail.setId(null);
|
|
|
+ List<IntroduceDetail> introduceDetailList = Lists.newArrayList();
|
|
|
+ for (IntroduceDetailVO detailVO : introduceVO.getDetailVOList()) {
|
|
|
+ IntroduceDetail detail = new IntroduceDetail();
|
|
|
+ detail.setIntroduceId(introduceInfo.getId());
|
|
|
+ //detail.setCreator(UserUtils.getCurrentPrincipleID());
|
|
|
+ detail.setGmtCreate(new Date());
|
|
|
+ detail.setContent(detailVO.getContent());
|
|
|
+ detail.setText(detailVO.getText());
|
|
|
+ detail.setTitle(detailVO.getTitle());
|
|
|
+ detail.setOrderNo(detailVO.getOrderNo());
|
|
|
+ detail.setPosition(detailVO.getPosition());
|
|
|
+ introduceDetailList.add(detail);
|
|
|
}
|
|
|
//插入新的明细记录
|
|
|
- introduceDetailServiceImpl.saveOrUpdateBatch(introduceVO.getDetailList());
|
|
|
-
|
|
|
- //更新提示信息
|
|
|
- this.saveOrUpdate(introduceInfo);
|
|
|
+ introduceDetailServiceImpl.saveOrUpdateBatch(introduceDetailList);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -114,4 +124,4 @@ public class IntroduceInfoFacade extends IntroduceInfoServiceImpl {
|
|
|
IPage<IntroduceInfo> introduceInfoIPage = this.page(introducePageVO, introduceInfoQueryWrapper);
|
|
|
return introduceInfoIPage;
|
|
|
}
|
|
|
-}
|
|
|
+}
|