当前位置: 首页>>代码示例>>Java>>正文


Java Page.setTotal方法代码示例

本文整理汇总了Java中com.baomidou.mybatisplus.plugins.Page.setTotal方法的典型用法代码示例。如果您正苦于以下问题:Java Page.setTotal方法的具体用法?Java Page.setTotal怎么用?Java Page.setTotal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.baomidou.mybatisplus.plugins.Page的用法示例。


在下文中一共展示了Page.setTotal方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPage

import com.baomidou.mybatisplus.plugins.Page; //导入方法依赖的package包/类
/** 根据Id查询(cls返回类型Class) */
public <K> Page<K> getPage(Page<Long> ids, Class<K> cls) {
	if (ids != null) {
		Page<K> page = new Page<K>(ids.getCurrent(), ids.getSize());
		page.setTotal(ids.getTotal());
		List<K> records = InstanceUtil.newArrayList();
		for (Long id : ids.getRecords()) {
			T t = this.queryById(id);
			K k = InstanceUtil.to(t, cls);
			records.add(k);
		}
		page.setRecords(records);
		return page;
	}
	return new Page<K>();
}
 
开发者ID:tb544731152,项目名称:iBase4J,代码行数:17,代码来源:BaseService.java

示例2: getPageMap

import com.baomidou.mybatisplus.plugins.Page; //导入方法依赖的package包/类
/**
 * 根据Id查询(默认类型T)
 * @param ids
 * @return
 */
public Page<Map<String, Object>> getPageMap(final Page<Long> ids) {
    if (ids != null) {
        Page<Map<String, Object>> page = new Page<Map<String, Object>>(ids.getCurrent(), ids.getSize());
        page.setTotal(ids.getTotal());
        final List<Map<String, Object>> records = InstanceUtil.newArrayList();
        for (int i = 0; i < ids.getRecords().size(); i++) {
            records.add(null);
        }
        final Map<Integer, Object> thread = InstanceUtil.newConcurrentHashMap();
        for (int i = 0; i < ids.getRecords().size(); i++) {
            final int index = i;
            executorService.execute(new Runnable() {
                public void run() {
                    try {
                        records.set(index, InstanceUtil.transBean2Map(queryById(ids.getRecords().get(index))));
                    } finally {
                        thread.put(index, 0);
                    }
                }
            });
        }
        while (thread.size() < records.size()) {
            try {
                Thread.sleep(threadSleep);
            } catch (InterruptedException e) {
                logger.error("", e);
            }
        }
        page.setRecords(records);
        return page;
    }
    return new Page<Map<String, Object>>();
}
 
开发者ID:iBase4J,项目名称:iBase4J-Common,代码行数:39,代码来源:BaseService.java

示例3: getPage

import com.baomidou.mybatisplus.plugins.Page; //导入方法依赖的package包/类
/** 根据Id查询(默认类型T) */
private Page<T> getPage(final Page<Long> ids) {
    if (ids != null) {
        Page<T> page = new Page<T>(ids.getCurrent(), ids.getSize());
        page.setTotal(ids.getTotal());
        final List<T> records = InstanceUtil.newArrayList();
        for (int i = 0; i < ids.getRecords().size(); i++) {
            records.add(null);
        }
        final Map<Integer, Object> thread = InstanceUtil.newConcurrentHashMap();
        for (int i = 0; i < ids.getRecords().size(); i++) {
            final int index = i;
            executorService.execute(new Runnable() {
                public void run() {
                    try {
                        records.set(index, queryById(ids.getRecords().get(index)));
                    } finally {
                        thread.put(index, 0);
                    }
                }
            });
        }
        while (thread.size() < records.size()) {
            try {
                Thread.sleep(threadSleep);
            } catch (InterruptedException e) {
                logger.error("", e);
            }
        }
        page.setRecords(records);
        return page;
    }
    return new Page<T>();
}
 
开发者ID:iBase4J,项目名称:iBase4J-Common,代码行数:35,代码来源:BaseService.java

示例4: queryLog

import com.baomidou.mybatisplus.plugins.Page; //导入方法依赖的package包/类
public Page<TaskFireLog> queryLog(Map<String, Object> params) {
	Page<Long> ids = BaseService.getPage(params);
	ids.setRecords(logMapper.selectIdByMap(ids, params));
	Page<TaskFireLog> page = new Page<TaskFireLog>(ids.getCurrent(), ids.getSize());
	page.setTotal(ids.getTotal());
	if (ids != null) {
		List<TaskFireLog> records = InstanceUtil.newArrayList();
		for (Long id : ids.getRecords()) {
			records.add(applicationContext.getBean(getClass()).getFireLogById(id));
		}
		page.setRecords(records);
	}
	return page;
}
 
开发者ID:iBase4J,项目名称:iBase4J-Common,代码行数:15,代码来源:SchedulerService.java

示例5: getPage

import com.baomidou.mybatisplus.plugins.Page; //导入方法依赖的package包/类
/** 根据Id查询(默认类型T) */
public Page<T> getPage(Page<Long> ids) {
	if (ids != null) {
		Page<T> page = new Page<T>(ids.getCurrent(), ids.getSize());
		page.setTotal(ids.getTotal());
		List<T> records = InstanceUtil.newArrayList();
		for (int i = 0; i < ids.getRecords().size(); i++) {
			records.add(null);
		}
		ExecutorService executorService = Executors.newFixedThreadPool(5);
		for (int i = 0; i < ids.getRecords().size(); i++) {
			final int index = i;
			executorService.execute(new Runnable() {
				public void run() {
					records.set(index, queryById(ids.getRecords().get(index)));
				}
			});
		}
		executorService.shutdown();
		try {
			executorService.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);
		} catch (InterruptedException e) {
			logger.error("awaitTermination", "", e);
		}
		page.setRecords(records);
		return page;
	}
	return new Page<T>();
}
 
开发者ID:guokezheng,项目名称:automat,代码行数:30,代码来源:BaseService.java

示例6: getPageMap

import com.baomidou.mybatisplus.plugins.Page; //导入方法依赖的package包/类
/** 根据Id查询(默认类型T) */
public Page<Map<String, Object>> getPageMap(Page<Long> ids) {
	if (ids != null) {
		Page<Map<String, Object>> page = new Page<Map<String, Object>>(ids.getCurrent(), ids.getSize());
		page.setTotal(ids.getTotal());
		List<Map<String, Object>> records = InstanceUtil.newArrayList();
		for (int i = 0; i < ids.getRecords().size(); i++) {
			records.add(null);
		}
		ExecutorService executorService = Executors.newFixedThreadPool(5);
		for (int i = 0; i < ids.getRecords().size(); i++) {
			final int index = i;
			executorService.execute(new Runnable() {
				public void run() {
					records.set(index, InstanceUtil.transBean2Map(queryById(ids.getRecords().get(index))));
				}
			});
		}
		executorService.shutdown();
		try {
			executorService.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);
		} catch (InterruptedException e) {
			logger.error("awaitTermination", "", e);
		}
		page.setRecords(records);
		return page;
	}
	return new Page<Map<String, Object>>();
}
 
开发者ID:guokezheng,项目名称:automat,代码行数:30,代码来源:BaseService.java

示例7: getPageMap

import com.baomidou.mybatisplus.plugins.Page; //导入方法依赖的package包/类
/** 根据Id查询(默认类型T) */
public Page<Map<String, Object>> getPageMap(Page<Long> ids) {
	if (ids != null) {
		Page<Map<String, Object>> page = new Page<Map<String, Object>>(ids.getCurrent(), ids.getSize());
		page.setTotal(ids.getTotal());
		List<Map<String, Object>> records = InstanceUtil.newArrayList();
		for (Long id : ids.getRecords()) {
			records.add(InstanceUtil.transBean2Map(this.queryById(id)));
		}
		page.setRecords(records);
		return page;
	}
	return new Page<Map<String, Object>>();
}
 
开发者ID:tb544731152,项目名称:iBase4J,代码行数:15,代码来源:BaseService.java

示例8: queryLog

import com.baomidou.mybatisplus.plugins.Page; //导入方法依赖的package包/类
public Page<TaskFireLog> queryLog(Map<String, Object> params) {
	Page<Long> ids = BaseService.getPage(params);
	ids.setRecords(logMapper.selectIdByMap(ids, params));
	Page<TaskFireLog> page = new Page<TaskFireLog>(ids.getCurrent(), ids.getSize());
	page.setTotal(ids.getTotal());
	if (ids != null) {
		List<TaskFireLog> records = InstanceUtil.newArrayList();
		for (Long id : ids.getRecords()) {
			records.add(InstanceUtil.getBean(getClass()).getFireLogById(id));
		}
		page.setRecords(records);
	}
	return page;
}
 
开发者ID:tb544731152,项目名称:iBase4J,代码行数:15,代码来源:SchedulerService.java

示例9: getPage

import com.baomidou.mybatisplus.plugins.Page; //导入方法依赖的package包/类
/** 根据Id查询(默认类型T) */
public Page<T> getPage(final Page<Long> ids) {
	if (ids != null) {
		Page<T> page = new Page<T>(ids.getCurrent(), ids.getSize());
		page.setTotal(ids.getTotal());
		final List<T> records = InstanceUtil.newArrayList();
		for (int i = 0; i < ids.getRecords().size(); i++) {
			records.add(null);
		}
		int thread = Math.min(maxThread, Math.max(1, records.size() / 2));
		ExecutorService executorService = Executors.newFixedThreadPool(thread);
		for (int i = 0; i < ids.getRecords().size(); i++) {
			final int index = i;
			executorService.execute(new Runnable() {
				public void run() {
					records.set(index, queryById(ids.getRecords().get(index)));
				}
			});
		}
		executorService.shutdown();
		try {
			executorService.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);
		} catch (InterruptedException e) {
			logger.error("awaitTermination", "", e);
		}
		page.setRecords(records);
		return page;
	}
	return new Page<T>();
}
 
开发者ID:youngMen1,项目名称:JAVA-,代码行数:31,代码来源:BaseService.java

示例10: getPageMap

import com.baomidou.mybatisplus.plugins.Page; //导入方法依赖的package包/类
/** 根据Id查询(默认类型T) */
public Page<Map<String, Object>> getPageMap(final Page<Long> ids) {
	if (ids != null) {
		Page<Map<String, Object>> page = new Page<Map<String, Object>>(ids.getCurrent(), ids.getSize());
		page.setTotal(ids.getTotal());
		final List<Map<String, Object>> records = InstanceUtil.newArrayList();
		for (int i = 0; i < ids.getRecords().size(); i++) {
			records.add(null);
		}
		int thread = Math.min(maxThread, Math.max(1, records.size() / 2));
		ExecutorService executorService = Executors.newFixedThreadPool(thread);
		for (int i = 0; i < ids.getRecords().size(); i++) {
			final int index = i;
			executorService.execute(new Runnable() {
				public void run() {
					records.set(index, InstanceUtil.transBean2Map(queryById(ids.getRecords().get(index))));
				}
			});
		}
		executorService.shutdown();
		try {
			executorService.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);
		} catch (InterruptedException e) {
			logger.error("awaitTermination", "", e);
		}
		page.setRecords(records);
		return page;
	}
	return new Page<Map<String, Object>>();
}
 
开发者ID:youngMen1,项目名称:JAVA-,代码行数:31,代码来源:BaseService.java


注:本文中的com.baomidou.mybatisplus.plugins.Page.setTotal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。