Selaa lähdekoodia

添加接口搜索

kongwz 4 vuotta sitten
vanhempi
commit
6b907f69ca

+ 15 - 0
cdssman-service/src/main/java/com/diagbot/facade/RelationContactFacade.java

@@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Component;
 
+import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
 import java.util.ArrayList;
 import java.util.Date;
@@ -286,4 +287,18 @@ public class RelationContactFacade extends KlRelationServiceImpl {
         List<KlConcept> diseaseAll = klDiseaseFacade.getDiseaseAll(diseaseDeleteVO);
         return diseaseAll;
     }
+
+    public List<String> searchAndPosition(GetAllForRelationVO getAllForRelationVO) {
+        List<String> names = Lists.newArrayList();
+        String name = getAllForRelationVO.getName();
+        Long typeId = getAllForRelationVO.getTypeId();
+        List<KlConcept> klConcepts = klConceptFacade.list(new QueryWrapper<KlConcept>()
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .like("lib_name", name.trim())
+                .eq("lib_type", typeId));
+        names = klConcepts.stream().map(x -> x.getLibName()).collect(Collectors.toList());
+
+        return names;
+
+    }
 }

+ 4 - 0
cdssman-service/src/main/java/com/diagbot/vo/GetAllForRelationVO.java

@@ -6,6 +6,8 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
 
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
 import java.util.List;
 
 /**
@@ -23,12 +25,14 @@ public class GetAllForRelationVO {
      */
 
     @ApiModelProperty(value="名称")
+    @NotBlank(message = "名称不能为空")
     private String name;
     
     /**
      * 词性id
      */
     @ApiModelProperty(value="词性id")
+    @NotNull(message = "词性不能为空")
     private Long typeId;
     
     /**

+ 10 - 0
cdssman-service/src/main/java/com/diagbot/web/TreeContactController.java

@@ -76,4 +76,14 @@ public class TreeContactController {
     }
 
 
+    @ApiOperation(value = "知识库标准化-树形结构维护相关API-搜索定位[by:kongwz]",
+            notes = "name: 要搜索的名字 <br>" +
+                    "typeId: 要搜索的类型")
+    @PostMapping("/searchAndPosition")
+    @SysLogger("searchAndPosition")
+    public RespDTO<List<String>> searchAndPosition(@RequestBody GetAllForRelationVO getAllForRelationVO){
+        return RespDTO.onSuc(relationContactFacade.searchAndPosition(getAllForRelationVO));
+    }
+
+
 }