Search in sources :

Example 1 with PageDomain

use of com.ruoyi.common.core.page.PageDomain 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 2 with PageDomain

use of com.ruoyi.common.core.page.PageDomain 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 3 with PageDomain

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

the class BaseController method startOrderBy.

/**
 * 设置请求排序数据
 */
protected void startOrderBy() {
    PageDomain pageDomain = TableSupport.buildPageRequest();
    if (StringUtils.isNotEmpty(pageDomain.getOrderBy())) {
        String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
        PageHelper.orderBy(orderBy);
    }
}
Also used : PageDomain(com.ruoyi.common.core.page.PageDomain)

Example 4 with PageDomain

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

the class BaseController method startPage.

/**
 * 设置请求分页数据
 */
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());
        Boolean reasonable = pageDomain.getReasonable();
        PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable);
    }
}
Also used : PageDomain(com.ruoyi.common.core.page.PageDomain)

Example 5 with PageDomain

use of com.ruoyi.common.core.page.PageDomain in project RuoYi-Vue by yangzongzhuan.

the class PageUtils method startPage.

/**
 * 设置请求分页数据
 */
public static void startPage() {
    PageDomain pageDomain = TableSupport.buildPageRequest();
    Integer pageNum = pageDomain.getPageNum();
    Integer pageSize = pageDomain.getPageSize();
    String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
    Boolean reasonable = pageDomain.getReasonable();
    PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable);
}
Also used : PageDomain(com.ruoyi.common.core.page.PageDomain)

Aggregations

PageDomain (com.ruoyi.common.core.page.PageDomain)7 TableDataInfo (com.ruoyi.common.core.page.TableDataInfo)2 ArrayList (java.util.ArrayList)2 PostMapping (org.springframework.web.bind.annotation.PostMapping)2 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)2 UserOperateModel (com.ruoyi.web.controller.demo.domain.UserOperateModel)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 ModelMap (org.springframework.ui.ModelMap)1