use of com.ruoyi.common.core.domain.PageQuery in project RuoYi-Flowable-Plus by KonBAI-Q.
the class WfDefinitionServiceImpl method publishList.
@Override
public TableDataInfo<WfDefinitionVo> publishList(String processKey, PageQuery pageQuery) {
Page<WfDefinitionVo> page = new Page<>();
// 创建查询条件
ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery().processDefinitionKey(processKey).orderByProcessDefinitionVersion().asc();
long pageTotal = processDefinitionQuery.count();
if (pageTotal <= 0) {
return TableDataInfo.build();
}
// 根据查询条件,查询所有版本
int offset = pageQuery.getPageSize() * (pageQuery.getPageNum() - 1);
List<ProcessDefinition> processDefinitionList = processDefinitionQuery.listPage(offset, pageQuery.getPageSize());
List<WfDefinitionVo> definitionVoList = processDefinitionList.stream().map(item -> {
WfDefinitionVo vo = new WfDefinitionVo();
vo.setDefinitionId(item.getId());
vo.setProcessKey(item.getKey());
vo.setProcessName(item.getName());
vo.setVersion(item.getVersion());
vo.setCategory(item.getCategory());
vo.setDeploymentId(item.getDeploymentId());
vo.setSuspended(item.isSuspended());
// BeanUtil.copyProperties(item, vo);
return vo;
}).collect(Collectors.toList());
page.setRecords(definitionVoList);
page.setTotal(pageTotal);
return TableDataInfo.build(page);
}
Aggregations