分页的处理

This commit is contained in:
wangliwen 2022-05-26 19:26:44 +08:00
parent ecd78da476
commit 7ba6af7f05
1 changed files with 7 additions and 6 deletions

View File

@ -210,9 +210,9 @@ public class ActHistoryService {
query.startedBy((String) params.get("startBy")); query.startedBy((String) params.get("startBy"));
} }
query.orderByProcessInstanceStartTime().desc(); query.orderByProcessInstanceStartTime().desc();
if (params.containsKey("name")) { // if (params.containsKey("name")) {
query = query.variableValueLike("name", params.get("name").toString()); // query = query.variableValueLike("name", params.get("name").toString());
} // }
List<HistoricProcessInstance> list = query.listPage((curPage - 1) * limit, limit); List<HistoricProcessInstance> list = query.listPage((curPage - 1) * limit, limit);
List<ProcessInstanceDTO> listInstance = new ArrayList<>(); List<ProcessInstanceDTO> listInstance = new ArrayList<>();
if (!list.isEmpty()) { if (!list.isEmpty()) {
@ -254,8 +254,9 @@ public class ActHistoryService {
public PageData<ProcessInstanceDTO> getMyProcessInstancePage(Map<String, Object> params) { public PageData<ProcessInstanceDTO> getMyProcessInstancePage(Map<String, Object> params) {
params.put("startBy", SecurityUser.getUserId().toString()); params.put("startBy", SecurityUser.getUserId().toString());
PageData<ProcessInstanceDTO> pageData = this.getHistoryProcessInstancePage(params); PageData<ProcessInstanceDTO> pageData = this.getHistoryProcessInstancePage(params);
String limit = params.get("limit").toString();
if (params.containsKey("name") && StringUtils.isNotBlank(params.get("name").toString())) { if (params.containsKey("name") && StringUtils.isNotBlank(params.get("name").toString())) {
// params.put("limit", String.valueOf(pageData.getTotal())); params.put("limit", String.valueOf(pageData.getTotal()));
pageData = this.getHistoryProcessInstancePage(params); pageData = this.getHistoryProcessInstancePage(params);
} }
List<ProcessInstanceDTO> list = pageData.getList(); List<ProcessInstanceDTO> list = pageData.getList();
@ -322,8 +323,8 @@ public class ActHistoryService {
.filter(index -> null != index.getName() && index.getName().contains(params.get("name").toString())) .filter(index -> null != index.getName() && index.getName().contains(params.get("name").toString()))
.forEach(list1::add); .forEach(list1::add);
ArrayList<ProcessInstanceDTO> list2 = new ArrayList<>(); ArrayList<ProcessInstanceDTO> list2 = new ArrayList<>();
int j = Math.min(Integer.parseInt(params.get("page").toString()) * Integer.parseInt(params.get("limit").toString()), list1.size()); int j = Math.min(Integer.parseInt(params.get("page").toString()) * Integer.parseInt(limit), list1.size());
for (int i = (Integer.parseInt(params.get("page").toString()) - 1) * Integer.parseInt(params.get("limit").toString()); i < j; i++) { for (int i = (Integer.parseInt(params.get("page").toString()) - 1) * Integer.parseInt(limit); i < j; i++) {
list2.add(list1.get(i)); list2.add(list1.get(i));
} }
pageData.setTotal(list1.size()); pageData.setTotal(list1.size());