Search in sources :

Example 1 with TableDataInfo

use of com.ruoyi.common.core.page.TableDataInfo 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);
}
Also used : java.util(java.util) TableDataInfo(com.ruoyi.common.core.page.TableDataInfo) ProcessDefinition(org.flowable.engine.repository.ProcessDefinition) ServiceException(com.ruoyi.common.exception.ServiceException) WfFormVo(com.ruoyi.workflow.domain.vo.WfFormVo) RequiredArgsConstructor(lombok.RequiredArgsConstructor) DeploymentBuilder(org.flowable.engine.repository.DeploymentBuilder) IWfDeployFormService(com.ruoyi.workflow.service.IWfDeployFormService) ProcessInstance(org.flowable.engine.runtime.ProcessInstance) PageQuery(com.ruoyi.common.core.domain.PageQuery) IWfDefinitionService(com.ruoyi.workflow.service.IWfDefinitionService) ProcessConstants(com.ruoyi.flowable.common.constant.ProcessConstants) Service(org.springframework.stereotype.Service) BpmnModel(org.flowable.bpmn.model.BpmnModel) FlowServiceFactory(com.ruoyi.flowable.factory.FlowServiceFactory) DefaultProcessDiagramGenerator(org.flowable.image.impl.DefaultProcessDiagramGenerator) ProcessDefinitionQuery(org.flowable.engine.repository.ProcessDefinitionQuery) WfDefinitionVo(com.ruoyi.workflow.domain.vo.WfDefinitionVo) FlowComment(com.ruoyi.flowable.common.enums.FlowComment) IOException(java.io.IOException) Deployment(org.flowable.engine.repository.Deployment) Task(org.flowable.task.api.Task) LoginHelper(com.ruoyi.common.helper.LoginHelper) Collectors(java.util.stream.Collectors) StandardCharsets(java.nio.charset.StandardCharsets) Page(com.baomidou.mybatisplus.extension.plugins.pagination.Page) IOUtils(org.apache.commons.io.IOUtils) StrUtil(cn.hutool.core.util.StrUtil) Slf4j(lombok.extern.slf4j.Slf4j) Transactional(org.springframework.transaction.annotation.Transactional) InputStream(java.io.InputStream) Page(com.baomidou.mybatisplus.extension.plugins.pagination.Page) ProcessDefinitionQuery(org.flowable.engine.repository.ProcessDefinitionQuery) ProcessDefinition(org.flowable.engine.repository.ProcessDefinition) WfDefinitionVo(com.ruoyi.workflow.domain.vo.WfDefinitionVo)

Example 2 with TableDataInfo

use of com.ruoyi.common.core.page.TableDataInfo in project Rental-Information-Platform by who1sBruce.

the class DemoOperateController method list.

/**
 * 查询数据
 */
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(UserOperateModel userModel) {
    TableDataInfo rspData = new TableDataInfo();
    List<UserOperateModel> userList = new ArrayList<UserOperateModel>(users.values());
    // 查询条件过滤
    if (StringUtils.isNotEmpty(userModel.getSearchValue())) {
        userList.clear();
        for (Map.Entry<Integer, UserOperateModel> entry : users.entrySet()) {
            if (entry.getValue().getUserName().equals(userModel.getSearchValue())) {
                userList.add(entry.getValue());
            }
        }
    }
    PageDomain pageDomain = TableSupport.buildPageRequest();
    if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize()) {
        rspData.setRows(userList);
        rspData.setTotal(userList.size());
        return rspData;
    }
    Integer pageNum = (pageDomain.getPageNum() - 1) * 10;
    Integer pageSize = pageDomain.getPageNum() * 10;
    if (pageSize > userList.size()) {
        pageSize = userList.size();
    }
    rspData.setRows(userList.subList(pageNum, pageSize));
    rspData.setTotal(userList.size());
    return rspData;
}
Also used : TableDataInfo(com.ruoyi.common.core.page.TableDataInfo) ArrayList(java.util.ArrayList) UserOperateModel(com.ruoyi.web.controller.demo.domain.UserOperateModel) PageDomain(com.ruoyi.common.core.page.PageDomain) ModelMap(org.springframework.ui.ModelMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) PostMapping(org.springframework.web.bind.annotation.PostMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 3 with TableDataInfo

use of com.ruoyi.common.core.page.TableDataInfo in project Rental-Information-Platform by who1sBruce.

the class UserTableModel method list.

/**
 * 查询数据
 */
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(UserTableModel userModel) {
    TableDataInfo rspData = new TableDataInfo();
    List<UserTableModel> userList = new ArrayList<UserTableModel>(Arrays.asList(new UserTableModel[users.size()]));
    Collections.copy(userList, users);
    // 查询条件过滤
    if (StringUtils.isNotEmpty(userModel.getUserName())) {
        userList.clear();
        for (UserTableModel user : users) {
            if (user.getUserName().equals(userModel.getUserName())) {
                userList.add(user);
            }
        }
    }
    PageDomain pageDomain = TableSupport.buildPageRequest();
    if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize()) {
        rspData.setRows(userList);
        rspData.setTotal(userList.size());
        return rspData;
    }
    Integer pageNum = (pageDomain.getPageNum() - 1) * 10;
    Integer pageSize = pageDomain.getPageNum() * 10;
    if (pageSize > userList.size()) {
        pageSize = userList.size();
    }
    rspData.setRows(userList.subList(pageNum, pageSize));
    rspData.setTotal(userList.size());
    return rspData;
}
Also used : TableDataInfo(com.ruoyi.common.core.page.TableDataInfo) ArrayList(java.util.ArrayList) PageDomain(com.ruoyi.common.core.page.PageDomain) PostMapping(org.springframework.web.bind.annotation.PostMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 4 with TableDataInfo

use of com.ruoyi.common.core.page.TableDataInfo in project wumei-smart by kerwincui.

the class BaseController method getDataTable.

/**
 * 响应请求分页数据
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
protected TableDataInfo getDataTable(List<?> list) {
    TableDataInfo rspData = new TableDataInfo();
    rspData.setCode(HttpStatus.SUCCESS);
    rspData.setMsg("查询成功");
    rspData.setRows(list);
    rspData.setTotal(new PageInfo(list).getTotal());
    return rspData;
}
Also used : PageInfo(com.github.pagehelper.PageInfo) TableDataInfo(com.ruoyi.common.core.page.TableDataInfo)

Example 5 with TableDataInfo

use of com.ruoyi.common.core.page.TableDataInfo in project hocassian-media-matrix by hokaso.

the class GenController method columnList.

/**
 * 查询数据表字段列表
 */
@PreAuthorize("@ss.hasPermi('tool:gen:list')")
@GetMapping(value = "/column/{talbleId}")
public TableDataInfo columnList(Long tableId) {
    TableDataInfo dataInfo = new TableDataInfo();
    List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(tableId);
    dataInfo.setRows(list);
    dataInfo.setTotal(list.size());
    return dataInfo;
}
Also used : GenTableColumn(com.ruoyi.generator.domain.GenTableColumn) TableDataInfo(com.ruoyi.common.core.page.TableDataInfo) GetMapping(org.springframework.web.bind.annotation.GetMapping) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Aggregations

TableDataInfo (com.ruoyi.common.core.page.TableDataInfo)9 PageInfo (com.github.pagehelper.PageInfo)3 GenTableColumn (com.ruoyi.generator.domain.GenTableColumn)3 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)3 PageDomain (com.ruoyi.common.core.page.PageDomain)2 ArrayList (java.util.ArrayList)2 GetMapping (org.springframework.web.bind.annotation.GetMapping)2 PostMapping (org.springframework.web.bind.annotation.PostMapping)2 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)2 StrUtil (cn.hutool.core.util.StrUtil)1 Page (com.baomidou.mybatisplus.extension.plugins.pagination.Page)1 PageQuery (com.ruoyi.common.core.domain.PageQuery)1 ServiceException (com.ruoyi.common.exception.ServiceException)1 LoginHelper (com.ruoyi.common.helper.LoginHelper)1 ProcessConstants (com.ruoyi.flowable.common.constant.ProcessConstants)1 FlowComment (com.ruoyi.flowable.common.enums.FlowComment)1 FlowServiceFactory (com.ruoyi.flowable.factory.FlowServiceFactory)1 UserOperateModel (com.ruoyi.web.controller.demo.domain.UserOperateModel)1 WfDefinitionVo (com.ruoyi.workflow.domain.vo.WfDefinitionVo)1 WfFormVo (com.ruoyi.workflow.domain.vo.WfFormVo)1