com.ruoyi.framework.web.page.TableSupport Java Examples

The following examples show how to use com.ruoyi.framework.web.page.TableSupport. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BaseController.java    From RuoYi-Vue with MIT License 5 votes vote down vote up
/**
 * 设置请求分页数据
 */
protected void startPage()
{
    PageDomain pageDomain = TableSupport.buildPageRequest();
    Integer pageNum = pageDomain.getPageNum();
    Integer pageSize = pageDomain.getPageSize();
    if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize))
    {
        String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
        PageHelper.startPage(pageNum, pageSize, orderBy);
    }
}
 
Example #2
Source File: BaseController.java    From ruoyiplus with MIT License 5 votes vote down vote up
/**
 * 设置请求分页数据
 */
protected void startPage()
{
    PageDomain pageDomain = TableSupport.buildPageRequest();
    Integer pageNum = pageDomain.getPageNum();
    Integer pageSize = pageDomain.getPageSize();
    if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize))
    {
        String orderBy = pageDomain.getOrderBy();
        PageHelper.startPage(pageNum, pageSize, orderBy);
    }
}
 
Example #3
Source File: BaseController.java    From RuoYi with Apache License 2.0 5 votes vote down vote up
/**
 * 设置请求分页数据
 */
protected void startPage() {
    PageDomain pageDomain = TableSupport.buildPageRequest();
    Integer pageNum = pageDomain.getPageNum();
    Integer pageSize = pageDomain.getPageSize();
    if (ObjectUtils.allNotNull(pageNum,pageSize)) {
        String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
        PageHelper.startPage(pageNum, pageSize, orderBy);
    }
}
 
Example #4
Source File: DemoOperateController.java    From RuoYi with Apache License 2.0 5 votes vote down vote up
/**
 * 查询数据
 */
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(UserOperateModel userModel) {
    TableDataInfo rspData = new TableDataInfo();
    List<UserOperateModel> userList = new ArrayList<>(USERS.values());
    // 查询条件过滤
    if (StrUtil.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;
    }
    int pageNum = (pageDomain.getPageNum() - 1) * 10;
    int pageSize = pageDomain.getPageNum() * 10;
    if (pageSize > userList.size()) {
        pageSize = userList.size();
    }
    rspData.setRows(userList.subList(pageNum, pageSize));
    rspData.setTotal(userList.size());
    return rspData;
}
 
Example #5
Source File: DemoTableController.java    From RuoYi with Apache License 2.0 5 votes vote down vote up
/**
 * 查询数据
 */
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(UserTableModel userModel) {
    TableDataInfo rspData = new TableDataInfo();
    List<UserTableModel> userList = new ArrayList<>(Arrays.asList(new UserTableModel[USERS.size()]));
    Collections.copy(userList, USERS);
    // 查询条件过滤
    if (StrUtil.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;
    }
    int pageNum = (pageDomain.getPageNum() - 1) * 10;
    int pageSize = pageDomain.getPageNum() * 10;
    if (pageSize > userList.size()) {
        pageSize = userList.size();
    }
    rspData.setRows(userList.subList(pageNum, pageSize));
    rspData.setTotal(userList.size());
    return rspData;
}