Commit c7837787 authored by chenyan's avatar chenyan

2024/05/09_API文档后台管理开发

parent 1ae0694d
......@@ -13,10 +13,14 @@ public class ApiCustomNodeVo {
private String method;
/**
* 主键自增ID
* 请求参数id
*/
@Id
private Integer id;
private Integer paramId;
/**
* 接口id
*/
private Integer nodeId;
/**
* api_doc主键ID
......
......@@ -68,16 +68,14 @@ public class ApiCustomParamsBiz extends BaseBiz<ApiCustomParamsMapper, ApiCustom
return ObjectRestResponse.createFailedResult(ResultCode.EXIST_CODE, "API节点下已存在自定义参数");
}
}
Example exampleParams = new Example(ApiCustomParams.class);
exampleParams.createCriteria()
.andEqualTo("docId", apiCustomParams.getDocId())
.andEqualTo("nodeId", apiCustomParams.getNodeId())
.andEqualTo("isDel",0);
ApiCustomParams old = mapper.selectOneByExample(exampleParams);
if (old != null) {
if (apiCustomParams.getId() != null) {
ApiCustomParams old = selectById(apiCustomParams.getId());
if (old == null || old.getIsDel() == 1) {
return ObjectRestResponse.createFailedResult(ResultCode.NOTEXIST_CODE, ResultCode.getMsg(ResultCode.NOTEXIST_CODE));
}
BeanUtil.copyProperties(apiCustomParams, old, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
updateSelectiveByIdRe(old);
}else {
} else {
insertSelectiveRe(apiCustomParams);
}
return ObjectRestResponse.succ();
......@@ -89,13 +87,6 @@ public class ApiCustomParamsBiz extends BaseBiz<ApiCustomParamsMapper, ApiCustom
return ObjectRestResponse.succ(pageDataVO);
}
public ObjectRestResponse getByNodeId(Integer id) {
Example exampleParams = new Example(ApiCustomParams.class);
exampleParams.createCriteria()
.andEqualTo("isDel",0)
.andEqualTo("nodeId", id);
return ObjectRestResponse.succ(mapper.selectOneByExample(exampleParams));
}
}
......
......@@ -62,6 +62,7 @@ public class ApiDocBiz extends BaseBiz<ApiDocMapper, ApiDoc> {
List<ApiCustomNodeVo> nodeVos = nodeMapper.selectByExample(exampleNode).stream().map(apiCustomNode -> {
ApiCustomNodeVo nodeVoss = new ApiCustomNodeVo();
BeanUtils.copyProperties(apiCustomNode, nodeVoss);
nodeVoss.setNodeId(apiCustomNode.getId());
exampleParams.clear();
exampleParams.createCriteria()
.andEqualTo("nodeId", apiCustomNode.getId())
......@@ -71,6 +72,7 @@ public class ApiDocBiz extends BaseBiz<ApiDocMapper, ApiDoc> {
if (Objects.isNull(params)) {
return nodeVoss;
}
nodeVoss.setParamId(params.getId());
nodeVoss.setMethod(params.getMethod());
return nodeVoss;
}).collect(Collectors.toList());
......
......@@ -14,7 +14,6 @@ import com.upyuns.platform.rs.website.entity.ApiCustomParams;
import com.upyuns.platform.rs.website.mapper.ApiCustomParamsMapper;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;
import tk.mybatis.mapper.entity.Example;
/**
*
......@@ -39,7 +38,7 @@ public class ApiCustomParamsController extends BaseController<ApiCustomParamsBiz
@GetMapping(value = "/detail")
public ObjectRestResponse detail(Integer id) {
return baseBiz.getByNodeId(id);
return ObjectRestResponse.succ(baseBiz.selectById(id));
}
......
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