Zhaops 6 سال پیش
والد
کامیت
48a26e02ea

+ 22 - 12
icssman-service/src/main/java/com/diagbot/facade/IntroduceInfoFacade.java

@@ -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;
     }
-}
+}

+ 34 - 0
icssman-service/src/main/java/com/diagbot/vo/IntroduceDetailVO.java

@@ -0,0 +1,34 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author:zhaops
+ * @time: 2018/11/26 16:47
+ */
+@Getter
+@Setter
+public class IntroduceDetailVO {
+    /**
+     * 提示信息
+     */
+    private String content;
+    /**
+     * 提示信息-纯文本
+     */
+    private String text;
+    /**
+     * 标题
+     */
+    private String title;
+    /**
+     * 排序号
+     */
+    private Integer orderNo;
+    /**
+     * 显示位置:1-右侧显示,0-都显示
+     */
+    private Integer position;
+}

+ 1 - 1
icssman-service/src/main/java/com/diagbot/vo/IntroduceVO.java

@@ -19,5 +19,5 @@ public class IntroduceVO {
     @NotBlank(message = "请输入名称")
     private String name;
     private String remark;
-    private List<IntroduceDetail> detailList;
+    private List<IntroduceDetailVO> detailVOList;
 }

+ 6 - 1
icssman-service/src/main/java/com/diagbot/web/IntroduceInfoController.java

@@ -39,7 +39,12 @@ public class IntroduceInfoController {
             notes = "id: 修改时带id,新增时为空<br>" +
                     "name: 名称,必填<br>" +
                     "remark:备注<br>" +
-                    "detailList:提示信息明细列表")
+                    "detailVOList:提示信息明细列表" +
+                    "title:提示信息标题<br>" +
+                    "content:提示信息<br>" +
+                    "text:提示信息-纯文本<br>" +
+                    "orderNo:排序号<br>" +
+                    "position:显示位置<br>")
     @PostMapping("/saveIntroduce")
     @SysLogger("saveIntroduce")
     public RespDTO<Boolean> saveIntroduce(@RequestBody @Valid IntroduceVO introduceVO) {