Zhaops %!s(int64=6) %!d(string=hai) anos
pai
achega
d977ea48e0

+ 20 - 4
icss-service/src/main/java/com/diagbot/facade/IntroduceInfoFacade.java

@@ -52,7 +52,7 @@ public class IntroduceInfoFacade extends IntroduceInfoServiceImpl {
             throw new CommonException(CommonErrorCode.NOT_EXISTS, "提示信息未维护");
         }
 
-        IntroduceDTO introduceDTO = this.getRecordById(introduceMap.getIntroduceId());
+        IntroduceDTO introduceDTO = this.getRecordByIdAndPosition(introduceMap.getIntroduceId(), introduceByQuestionVO.getPosition());
         return introduceDTO;
     }
 
@@ -84,17 +84,18 @@ public class IntroduceInfoFacade extends IntroduceInfoServiceImpl {
             throw new CommonException(CommonErrorCode.NOT_EXISTS, "提示信息未维护");
         }
 
-        IntroduceDTO introduceDTO = this.getRecordById(introduceMap.getIntroduceId());
+        IntroduceDTO introduceDTO = this.getRecordByIdAndPosition(introduceMap.getIntroduceId(), introduceByQuestionVO.getPosition());
         return introduceDTO;
     }
 
     /**
-     * 根据id获取提示信息
+     * 获取指定位置提示信息
      *
      * @param id
+     * @param position
      * @return
      */
-    public IntroduceDTO getRecordById(Long id) {
+    public IntroduceDTO getRecordByIdAndPosition(Long id, Integer position) {
         IntroduceDTO introduceDTO = new IntroduceDTO();
         IntroduceInfo introduceInfo = this.getById(id);
         if (introduceInfo == null) {
@@ -104,7 +105,12 @@ public class IntroduceInfoFacade extends IntroduceInfoServiceImpl {
         }
         BeanUtil.copyProperties(introduceInfo, introduceDTO);
 
+
         QueryWrapper<IntroduceDetail> introduceDetailQueryWrapper = new QueryWrapper<>();
+        //展示位置
+        if (position != null) {
+            introduceDetailQueryWrapper.apply("find_in_set({0},position)", position);
+        }
         introduceDetailQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey()).
                 eq("introduce_id", introduceInfo.getId()).
                 orderByAsc("order_no");
@@ -112,4 +118,14 @@ public class IntroduceInfoFacade extends IntroduceInfoServiceImpl {
         introduceDTO.setIntroduceDetailList(introduceDetailList);
         return introduceDTO;
     }
+
+    /**
+     * 根据id获取提示信息
+     *
+     * @param id
+     * @return
+     */
+    public IntroduceDTO getRecordById(Long id) {
+        return getRecordByIdAndPosition(id, null);
+    }
 }

+ 3 - 1
icss-service/src/main/java/com/diagbot/vo/IntroduceByQuestionVO.java

@@ -3,6 +3,7 @@ package com.diagbot.vo;
 import lombok.Getter;
 import lombok.Setter;
 
+import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
 
 /**
@@ -17,5 +18,6 @@ public class IntroduceByQuestionVO {
     private String tagName;
     @NotNull(message = "请输入标签类型")
     private Integer type;
-
+    @NotNull(message = "请输入展示位置")
+    private Integer position;
 }

+ 5 - 3
icss-service/src/main/java/com/diagbot/web/IntroduceInfoController.java

@@ -35,7 +35,8 @@ public class IntroduceInfoController {
 
     @ApiOperation(value = "根据标签id获取提示信息[by:zhaops]",
             notes = "questionId: 标签id,必填<br>" +
-                    "type:标签类型,必填")
+                    "type:标签类型,必填" +
+                    "position:展示位置(1-推送展示,2-更多展示,3-一般治疗展示,4-手术治疗展示),必填")
     @PostMapping("/getByQuestionId")
     public RespDTO<IntroduceDTO> getByQuestionId(@RequestBody @Valid IntroduceByQuestionVO introduceByQuestionVO) {
         IntroduceDTO introduceDTO = introduceInfoFacade.getByQuestionId(introduceByQuestionVO);
@@ -44,7 +45,8 @@ public class IntroduceInfoController {
 
     @ApiOperation(value = "根据标签名称获取提示信息[by:zhaops]",
             notes = "tagName: 标签名称,必填<br>" +
-                    "type:标签类型,必填")
+                    "type:标签类型,必填" +
+                    "position:展示位置(1-推送展示,2-更多展示,3-一般治疗展示,4-手术治疗展示),必填")
     @PostMapping("/getByQuestionName")
     public RespDTO<IntroduceDTO> getByQuestionName(@RequestBody @Valid IntroduceByQuestionVO introduceByQuestionVO) {
         IntroduceDTO introduceDTO = introduceInfoFacade.getByQuestionName(introduceByQuestionVO);
@@ -58,4 +60,4 @@ public class IntroduceInfoController {
         IntroduceDTO introduceDTO = introduceInfoFacade.getRecordById(id);
         return RespDTO.onSuc(introduceDTO);
     }
-}
+}