Java Code Examples for com.github.pagehelper.Page#getPageNum()

The following examples show how to use com.github.pagehelper.Page#getPageNum() . 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: LogService.java    From frostmourne with MIT License 5 votes vote down vote up
public PagerContract<AlertLog> findAlertLog(int pageIndex, int pageSize, Date startTime, Date endTime,
                                            Long executeId, Long alarmId, String recipient, String way,
                                            String sendStatus, String inSilence, String alertType) {
    Page page = PageHelper.startPage(pageIndex, pageSize);
    List<AlertLog> list = alertLogMapper.find(startTime, endTime, executeId, alarmId, recipient, way, sendStatus, inSilence, alertType);
    return new PagerContract<>(list, page.getPageSize(), page.getPageNum(), (int) page.getTotal());
}
 
Example 2
Source File: PagedModel.java    From jvue-admin with MIT License 5 votes vote down vote up
/**
 * @param list
 * @return
 * @since  1.0
 */
public static <T> PagedModel<T> from(Page<T> list) {
    PagedModel<T> pageList = new PagedModel<>();
    pageList.pageNum = list.getPageNum();
    pageList.pageSize = list.getPageSize();
    pageList.setTotal(list.getTotal());
    pageList.setData(list.getResult());
    return pageList;
}
 
Example 3
Source File: PageUtis.java    From spring-boot-starter-dao with Apache License 2.0 5 votes vote down vote up
public static <T, TO> PageInfo<TO> outPage(Page<T> page, List<TO> tos) {
	if (page == null)
		return new PageInfo<TO>();
	int pageSize = page.getPageSize();
	int pageNo = page.getPageNum();
	long total = page.getTotal();
	return new PageInfo<TO>(pageNo, pageSize, total, tos);
}
 
Example 4
Source File: AbstractHelperDialect.java    From Mybatis-PageHelper with MIT License 5 votes vote down vote up
@Override
public boolean afterCount(long count, Object parameterObject, RowBounds rowBounds) {
    Page page = getLocalPage();
    page.setTotal(count);
    if (rowBounds instanceof PageRowBounds) {
        ((PageRowBounds) rowBounds).setTotal(count);
    }
    //pageSize < 0 的时候,不执行分页查询
    //pageSize = 0 的时候,还需要执行后续查询,但是不会分页
    if (page.getPageSize() < 0) {
        return false;
    }
    return count > ((page.getPageNum() - 1) * page.getPageSize());
}
 
Example 5
Source File: AlarmAdminService.java    From frostmourne with MIT License 4 votes vote down vote up
public PagerContract<Alarm> find(int pageIndex, int pageSize, Long alarmId, String name,
                                 String teamName, String status) {
    Page page = PageHelper.startPage(pageIndex, pageSize);
    List<Alarm> list = this.alarmMapper.find(alarmId, name, teamName, status);
    return new PagerContract<>(list, page.getPageSize(), page.getPageNum(), (int) page.getTotal());
}
 
Example 6
Source File: LogService.java    From frostmourne with MIT License 4 votes vote down vote up
public PagerContract<AlarmLog> findAlarmLog(int pageIndex, int pageSize, Date startTime,
                                    Date endTime, Long alarmId, String verifyResult, String executeResult) {
    Page page = PageHelper.startPage(pageIndex, pageSize);
    List<AlarmLog> list = alarmLogMapper.find(startTime, endTime, alarmId, verifyResult, executeResult);
    return new PagerContract<>(list, page.getPageSize(), page.getPageNum(), (int) page.getTotal());
}
 
Example 7
Source File: DataAdminService.java    From frostmourne with MIT License 4 votes vote down vote up
public PagerContract<DataSourceContract> findDatasource(int pageIndex, int pageSize, String datasourceType) {
    Page page = PageHelper.startPage(pageIndex, pageSize);
    List<DataSource> list = this.dataSourceMapper.find(datasourceType);
    return new PagerContract<>(list.stream().map(DataSourceTransformer::model2Contract).collect(Collectors.toList()),
            page.getPageSize(), page.getPageNum(), (int) page.getTotal());
}
 
Example 8
Source File: DataAdminService.java    From frostmourne with MIT License 4 votes vote down vote up
public PagerContract<DataNameContract> findDataName(int pageIndex, int pageSize, String datasourceType, Long datasourceId) {
    Page page = PageHelper.startPage(pageIndex, pageSize);
    List<DataName> list = this.dataNameMapper.find(datasourceType, datasourceId);
    return new PagerContract<>(list.stream().map(DataAdminService::toDataNameContract).collect(Collectors.toList()),
            page.getPageSize(), page.getPageNum(), (int) page.getTotal());
}
 
Example 9
Source File: PageResultWrapper.java    From magic-starter with GNU Lesser General Public License v3.0 2 votes vote down vote up
/**
 * 构造分页对象
 *
 * @param pageData 当前页数据
 * @param <T>泛型
 * @return 分页对象
 */
public static <T> PageResult<T> wrapper(Page<T> pageData) {
	return new PageResult<>(pageData.getPageNum(), pageData.getPageSize(), pageData.getPages(), pageData.getTotal(), pageData.getResult());
}