Commit 6ba8ad14 authored by chenyan's avatar chenyan

2024/05/04_API文档接口修改

parent 094b61fe
...@@ -26,12 +26,13 @@ import javax.annotation.Resource; ...@@ -26,12 +26,13 @@ import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.stream.Collectors;
/** /**
* *
*/ */
@Service @Service
public class ApiDocBiz extends BaseBiz<ApiDocMapper, ApiDoc>{ public class ApiDocBiz extends BaseBiz<ApiDocMapper, ApiDoc> {
@Resource @Resource
...@@ -47,35 +48,35 @@ public class ApiDocBiz extends BaseBiz<ApiDocMapper, ApiDoc>{ ...@@ -47,35 +48,35 @@ public class ApiDocBiz extends BaseBiz<ApiDocMapper, ApiDoc>{
Example exampleParams = new Example(ApiCustomParams.class); Example exampleParams = new Example(ApiCustomParams.class);
List<ApiDocTreeVo> docTreeVoList = mapper.selectList(query.getSuper()); List<ApiDocTreeVo> docTreeVoList = mapper.selectList(query.getSuper());
for (ApiDocTreeVo apiDocTreeVo : docTreeVoList) { for (ApiDocTreeVo apiDocTreeVo : docTreeVoList) {
if (StringUtils.isNotBlank(apiDocDTO.getKeyWord())){ exampleNode.clear();
if (StringUtils.isNotBlank(apiDocDTO.getKeyWord())) {
exampleNode.createCriteria() exampleNode.createCriteria()
.andEqualTo("isDel",0) .andEqualTo("isDel", 0)
.andLike("nodeName",'%'+apiDocDTO.getKeyWord()+'%') .andLike("nodeName", '%' + apiDocDTO.getKeyWord() + '%')
.andEqualTo("docId",apiDocTreeVo.getId()); .andEqualTo("docId", apiDocTreeVo.getId());
}else { } else {
exampleNode.createCriteria() exampleNode.createCriteria()
.andEqualTo("isDel",0) .andEqualTo("isDel", 0)
.andEqualTo("docId",apiDocTreeVo.getId()); .andEqualTo("docId", apiDocTreeVo.getId());
} }
exampleNode.excludeProperties("respondJson"); exampleNode.excludeProperties("respondJson");
List<ApiCustomNodeVo> nodeVos = new ArrayList<>(); List<ApiCustomNodeVo> nodeVos = nodeMapper.selectByExample(exampleNode).stream().map(apiCustomNode -> {
for (ApiCustomNode node : nodeMapper.selectByExample(exampleNode)) { ApiCustomNodeVo nodeVoss = new ApiCustomNodeVo();
BeanUtils.copyProperties(apiCustomNode, nodeVoss);
exampleParams.clear();
exampleParams.createCriteria() exampleParams.createCriteria()
.andEqualTo("nodeId",node.getId()) .andEqualTo("nodeId", apiCustomNode.getId())
.andEqualTo("isDel",0) .andEqualTo("isDel", 0)
.andEqualTo("docId",apiDocTreeVo.getId()); .andEqualTo("docId", apiDocTreeVo.getId());
ApiCustomParams params = paramsMapper.selectOneByExample(exampleParams); ApiCustomParams params = paramsMapper.selectOneByExample(exampleParams);
if (Objects.isNull(params)){ if (Objects.isNull(params)) {
continue; return nodeVoss;
} }
ApiCustomNodeVo vo = new ApiCustomNodeVo(); nodeVoss.setMethod(params.getMethod());
BeanUtils.copyProperties(node,vo); return nodeVoss;
vo.setMethod(params.getMethod()); }).collect(Collectors.toList());
nodeVos.add(vo); apiDocTreeVo.setApiCount(nodeVos.size());
exampleParams.clear();
}
apiDocTreeVo.setNodeVoList(nodeVos); apiDocTreeVo.setNodeVoList(nodeVos);
exampleNode.clear();
} }
return ObjectRestResponse.succ(docTreeVoList); return ObjectRestResponse.succ(docTreeVoList);
} }
......
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