提交 09e61aa0 authored 作者: mry's avatar mry

fix(web): 修改了swaggerController

上级 a528ed8b
......@@ -45,10 +45,10 @@ public class SwaggerController {
}
/**
* 读取url地址里的信息
* 读取swagger地址里的JSON信息
*
* @param url url地址
* @return url地址中的JSON数据
* @param url swagger地址
* @return swagger中的JSON数据
*/
public String loadJson(String url) {
BufferedReader reader;
......@@ -76,13 +76,14 @@ public class SwaggerController {
* @param list 查询的集合
* @return 模糊查询的结果
*/
public List search(String name, List list) {
List results = new ArrayList();
public List<InterfaceInformation> search(String name, List<InterfaceInformation> list) {
@SuppressWarnings(value = "all")
List<InterfaceInformation> results = new ArrayList();
Pattern pattern = Pattern.compile(name, Pattern.CASE_INSENSITIVE);
for (int i = 0; i < list.size(); i++) {
Matcher matcher = pattern.matcher(((InterfaceInformation) list.get(i)).getTags());
for (InterfaceInformation o : list) {
Matcher matcher = pattern.matcher(o.getTags());
if (matcher.find()) {
results.add(list.get(i));
results.add(o);
}
}
return results;
......@@ -100,7 +101,7 @@ public class SwaggerController {
@PostMapping
@Transactional(rollbackFor = Exception.class)
@ApiOperation(value = "快速添加接口")
public List parameter(Long projectId, Long id, int pageSize, int pageNum, String name) {
public List<InterfaceInformation> parameter(Long projectId, Long id, int pageSize, int pageNum, String name) {
//将所有的默认选项置为false
environmentService.setIsDefaultByWrapper(false,
Wrappers.lambdaQuery(Environment.class).eq(Environment::getProjectId, projectId));
......@@ -169,7 +170,12 @@ public class SwaggerController {
}
}
}
List search = search(name, list);
List<InterfaceInformation> search;
if (name != null) {
search = search(name, list);
} else {
search = list;
}
int total = search.size();
return search.subList(pageSize * (pageNum - 1), (Math.min((pageNum * pageSize), total)));
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论