Commit cd3386a0 authored by alex yao's avatar alex yao

feat:【根据知识库ID】获取知识库列表

parent ab109164
...@@ -96,6 +96,13 @@ public interface KnowledgeRest extends BaseRest { ...@@ -96,6 +96,13 @@ public interface KnowledgeRest extends BaseRest {
*/ */
List<QueryKnowledgeDocumentDto> getKnowledgeList(@RequestParam(required = false) String search, @RequestParam(required = false) String trainStatus, PagingInfo pagingInfo) throws Exception; List<QueryKnowledgeDocumentDto> getKnowledgeList(@RequestParam(required = false) String search, @RequestParam(required = false) String trainStatus, PagingInfo pagingInfo) throws Exception;
/**
* 获取用户知识库列表
*
* @param knowledgeInfoIds 知识库ID
*/
List<QueryKnowledgeDocumentDto> getKnowledgeListByKnowledgeInfoIds(@RequestBody List<Integer> knowledgeInfoIds) throws Exception;
/** /**
* 创建知识库 * 创建知识库
*/ */
......
...@@ -214,6 +214,27 @@ public class KnowledgeRestImpl implements KnowledgeRest { ...@@ -214,6 +214,27 @@ public class KnowledgeRestImpl implements KnowledgeRest {
return result; return result;
} }
@Override
public List<QueryKnowledgeDocumentDto> getKnowledgeListByKnowledgeInfoIds(List<Integer> knowledgeInfoIds) throws Exception {
Assert.notEmpty(knowledgeInfoIds);
List<QueryKnowledgeDocumentDto> result = new ArrayList<>();
for (Integer knowledgeInfoId : knowledgeInfoIds) {
BizKnowledgeInfoEntity bizKnowledgeInfoEntity = bizKnowledgeInfoService.get(knowledgeInfoId);
QueryKnowledgeDocumentDto dto = new QueryKnowledgeDocumentDto();
BeanUtil.copyProperties(bizKnowledgeInfoEntity, dto);
List<Integer> kdIdList = JsonUtils.deSerialize(bizKnowledgeInfoEntity.getKdIds(), new TypeReference<List<Integer>>() {
}.getType());
if (CollectionUtils.isNotEmpty(kdIdList)) {
List<BizKnowledgeDocumentEntity> entities = knowledgeService.getListByKdIds(kdIdList);
if (CollectionUtils.isNotEmpty(entities)) {
dto.setDocumentInfos(entities.stream().map(KnowledgeDocumentConvert::entityToDto).collect(Collectors.toList()));
}
}
result.add(dto);
}
return result;
}
@Override @Override
public BizKnowledgeInfoDto createKnowledge(BizKnowledgeInfoDto dto) throws Exception { public BizKnowledgeInfoDto createKnowledge(BizKnowledgeInfoDto dto) throws Exception {
Assert.notNull(dto.getKnowledgeName(), "知识库名称不能为空"); Assert.notNull(dto.getKnowledgeName(), "知识库名称不能为空");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment