Commit 662961d7 by liuyu

Merge branch 'feature' into 'release'

2023年06/12 模板搜索 分页bug修复

See merge request !78
parents 5001581e e2038c0a
...@@ -54,10 +54,9 @@ public class TemplateTitleServiceImpl implements TemplateTitleService { ...@@ -54,10 +54,9 @@ public class TemplateTitleServiceImpl implements TemplateTitleService {
List<Map<String, Object>> res = new ArrayList<>(); List<Map<String, Object>> res = new ArrayList<>();
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
// 分页起始节点大于总模板数 // 分页起始节点大于总模板数
if (limit > templateTitleVoMap.size()) { // if (limit > templateTitleVoMap.size()) {
return resultMap; // return resultMap;
} // }
int i = 0;
for (String key : templateTitleVoMap.keySet()) { for (String key : templateTitleVoMap.keySet()) {
TemplateTitleVo templateTitleVo = templateTitleVoMap.get(key); TemplateTitleVo templateTitleVo = templateTitleVoMap.get(key);
long createTime = templateTitleVo.getCreateTime().getTime(); long createTime = templateTitleVo.getCreateTime().getTime();
...@@ -75,11 +74,6 @@ public class TemplateTitleServiceImpl implements TemplateTitleService { ...@@ -75,11 +74,6 @@ public class TemplateTitleServiceImpl implements TemplateTitleService {
if (!StringUtils.isEmpty(searchInfo) && !key.contains(searchInfo)) { if (!StringUtils.isEmpty(searchInfo) && !key.contains(searchInfo)) {
continue; continue;
} }
i++;
// // 分页过滤
// if (limit >= i) {
// continue;
// }
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("templateTitle", key); map.put("templateTitle", key);
map.put("project", project); map.put("project", project);
...@@ -95,6 +89,8 @@ public class TemplateTitleServiceImpl implements TemplateTitleService { ...@@ -95,6 +89,8 @@ public class TemplateTitleServiceImpl implements TemplateTitleService {
} }
Tools.sortByField(res, orderField, isAsc); Tools.sortByField(res, orderField, isAsc);
resultMap.put("count", templateTitleVoMap.size()); resultMap.put("count", templateTitleVoMap.size());
// 分页判断
limit = limit > res.size() ? 0 : limit;
resultMap.put("list", res.subList(limit, Math.min((limit + size), res.size()))); resultMap.put("list", res.subList(limit, Math.min((limit + size), res.size())));
return resultMap; return resultMap;
} }
......
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