本文整理汇总了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>();
}
示例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>>();
}
示例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>();
}
示例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;
}
示例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>();
}
示例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>>();
}
示例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>>();
}
示例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;
}
示例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>();
}
示例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>>();
}