針對list分頁並返回給qiand

分頁處理

            int size = list.size();
            int pageCount=size/listRoleDTO.getRows();
            int fromIndex = listRoleDTO.getRows() * (listRoleDTO.getPosition() - 1);
            int toIndex = fromIndex + listRoleDTO.getRows();
            if (toIndex >= size) {
                toIndex = size;
            }
            if(listRoleDTO.getPosition()>pageCount+1){
                fromIndex=0;
                toIndex=0;
            }
            List<OrderScheVO> lastList = list.subList(fromIndex, toIndex);
            result.put("total", list.size());
            result.put("lists", lastList);

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章