Bladeren bron

提示信息

Zhaops 6 jaren geleden
bovenliggende
commit
9f6422a50f

+ 15 - 3
icss-service/src/main/java/com/diagbot/facade/IntroduceInfoFacade.java

@@ -30,11 +30,12 @@ public class IntroduceInfoFacade extends IntroduceInfoServiceImpl {
 
     /**
      * 根据标签获取提示信息
+     *
      * @param introduceByQuestionVO
      * @return
      */
     public IntroduceDTO getByQuestion(IntroduceByQuestionVO introduceByQuestionVO) {
-        IntroduceDTO introduceDTO = new IntroduceDTO();
+
         QueryWrapper<IntroduceMap> introduceMapQueryWrapper = new QueryWrapper<>();
         introduceMapQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey()).
                 eq("question_id", introduceByQuestionVO.getQuestionId()).
@@ -44,7 +45,19 @@ public class IntroduceInfoFacade extends IntroduceInfoServiceImpl {
             throw new CommonException(CommonErrorCode.NOT_EXISTS, "提示信息未维护");
         }
 
-        IntroduceInfo introduceInfo = this.getById(introduceMap.getIntroduceId());
+        IntroduceDTO introduceDTO = this.getRecordById(introduceMap.getIntroduceId());
+        return introduceDTO;
+    }
+
+    /**
+     * 根据id获取提示信息
+     *
+     * @param id
+     * @return
+     */
+    public IntroduceDTO getRecordById(Long id) {
+        IntroduceDTO introduceDTO = new IntroduceDTO();
+        IntroduceInfo introduceInfo = this.getById(id);
         if (introduceInfo == null) {
             throw new CommonException(CommonErrorCode.NOT_EXISTS, "提示信息未维护");
         } else if (introduceInfo.getIsDeleted().equals(IsDeleteEnum.Y.getKey())) {
@@ -57,7 +70,6 @@ public class IntroduceInfoFacade extends IntroduceInfoServiceImpl {
                 eq("introduce_id", introduceInfo.getId());
         List<IntroduceDetail> introduceDetailList = introduceDetailFacade.list(introduceDetailQueryWrapper);
         introduceDTO.setIntroduceDetailList(introduceDetailList);
-
         return introduceDTO;
     }
 }

+ 14 - 2
icss-service/src/main/java/com/diagbot/web/IntroduceInfoController.java

@@ -9,9 +9,13 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.validation.Valid;
+
 /**
  * <p>
  * 提示信息 前端控制器
@@ -28,12 +32,20 @@ public class IntroduceInfoController {
     @Autowired
     IntroduceInfoFacade introduceInfoFacade;
 
-    @ApiOperation(value = "根据标签返回提示信息[by:zhaops]",
+    @ApiOperation(value = "根据标签获取提示信息[by:zhaops]",
             notes = "questionId: 标签id,必填<br>" +
                     "type:标签类型,必填")
     @PostMapping("/getByQuestion")
-    public RespDTO<IntroduceDTO> getByQuestion(IntroduceByQuestionVO introduceByQuestionVO) {
+    public RespDTO<IntroduceDTO> getByQuestion(@RequestBody @Valid IntroduceByQuestionVO introduceByQuestionVO) {
         IntroduceDTO introduceDTO = introduceInfoFacade.getByQuestion(introduceByQuestionVO);
         return RespDTO.onSuc(introduceDTO);
     }
+
+    @ApiOperation(value = "根据id获取提示信息[by:zhaops]",
+            notes = "id: 提示信息id,必填<br>")
+    @PostMapping("/getRecordById")
+    public RespDTO<IntroduceDTO> getRecordById(@RequestParam Long id) {
+        IntroduceDTO introduceDTO = introduceInfoFacade.getRecordById(id);
+        return RespDTO.onSuc(introduceDTO);
+    }
 }

+ 51 - 0
icssman-service/src/main/java/com/diagbot/facade/IntroduceInfoFacade.java

@@ -61,4 +61,55 @@ public class IntroduceInfoFacade extends IntroduceInfoServiceImpl {
         this.saveOrUpdate(introduceInfo);
         return true;
     }
+
+    /**
+     * 单条删除提示信息
+     *
+     * @param id
+     * @return
+     */
+    public Boolean deleteRecord(Long id) {
+        //删除明细
+        UpdateWrapper<IntroduceDetail> introduceDetailUpdateWrapper = new UpdateWrapper<>();
+        introduceDetailUpdateWrapper.eq("is_deleted", IsDeleteEnum.N.getKey()).
+                eq("introduce_id", id).
+                set("is_deleted", IsDeleteEnum.Y.getKey()).
+                set("gmt_modified", new Date()).
+                set("modifier", UserUtils.getCurrentPrincipleID());
+        introduceDetailFacade.update(new IntroduceDetail(), introduceDetailUpdateWrapper);
+
+        UpdateWrapper<IntroduceInfo> introduceInfoUpdateWrapper = new UpdateWrapper<>();
+        introduceInfoUpdateWrapper.eq("is_deleted", IsDeleteEnum.N.getKey()).
+                eq("id", id).
+                set("is_deleted", IsDeleteEnum.Y.getKey()).
+                set("gmt_modified", new Date()).
+                set("modifier", UserUtils.getCurrentPrincipleID());
+        this.update(new IntroduceInfo(), introduceInfoUpdateWrapper);
+        return true;
+    }
+
+    /**
+     * 批量删除提示信息
+     *
+     * @param ids
+     * @return
+     */
+    public Boolean deleteRecords(Long[] ids) {
+        //删除明细
+        UpdateWrapper<IntroduceDetail> introduceDetailUpdateWrapper = new UpdateWrapper<>();
+        introduceDetailUpdateWrapper.eq("is_deleted", IsDeleteEnum.N.getKey()).
+                in("introduce_id", ids).
+                set("is_deleted", IsDeleteEnum.Y.getKey()).
+                set("gmt_modified", new Date()).
+                set("modifier", UserUtils.getCurrentPrincipleID());
+        introduceDetailFacade.update(new IntroduceDetail(), introduceDetailUpdateWrapper);
+        UpdateWrapper<IntroduceInfo> introduceInfoUpdateWrapper = new UpdateWrapper<>();
+        introduceInfoUpdateWrapper.eq("is_deleted", IsDeleteEnum.N.getKey()).
+                in("id", ids).
+                set("is_deleted", IsDeleteEnum.Y.getKey()).
+                set("gmt_modified", new Date()).
+                set("modifier", UserUtils.getCurrentPrincipleID());
+        this.update(new IntroduceInfo(), introduceInfoUpdateWrapper);
+        return true;
+    }
 }

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

@@ -8,9 +8,13 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.validation.Valid;
+
 /**
  * <p>
  * 提示信息 前端控制器
@@ -33,8 +37,26 @@ public class IntroduceInfoController {
                     "remark:备注<br>" +
                     "detailList:提示信息明细列表")
     @PostMapping("/saveIntroduce")
-    public RespDTO<Boolean> saveIntroduce(IntroduceVO introduceVO) {
+    public RespDTO<Boolean> saveIntroduce(@RequestBody @Valid IntroduceVO introduceVO) {
         Boolean data = introduceInfoFacade.saveIntroduce(introduceVO);
         return RespDTO.onSuc(data);
     }
+
+    @ApiOperation(value = "单条删除提示信息[by:zhaops]",
+            notes = "id: id,必填")
+    @PostMapping("/deleteRecord")
+    public RespDTO<Boolean> deleteRecord(@RequestParam Long id) {
+        Boolean data = introduceInfoFacade.deleteRecord(id);
+        return RespDTO.onSuc(data);
+    }
+
+    @ApiOperation(value = "批量删除提示信息[by:zhaops]",
+            notes = "ids: ids,必填")
+    @PostMapping("/deleteRecords")
+    public RespDTO<Boolean> deleteRecords(@RequestParam Long[] ids) {
+        Boolean data = introduceInfoFacade.deleteRecords(ids);
+        return RespDTO.onSuc(data);
+    }
+
+
 }