mirror of https://gitee.com/stylefeng/roses
【db】【timer】更新分页和定时任务
parent
ce0dfd60a6
commit
9c95a9a768
|
@ -5,6 +5,8 @@ import cn.hutool.core.util.PageUtil;
|
||||||
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页的返回结果创建工厂
|
* 分页的返回结果创建工厂
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -28,7 +30,23 @@ public class PageResultFactory {
|
||||||
pageResult.setPageNo(Convert.toInt(page.getCurrent()));
|
pageResult.setPageNo(Convert.toInt(page.getCurrent()));
|
||||||
pageResult.setPageSize(Convert.toInt(page.getSize()));
|
pageResult.setPageSize(Convert.toInt(page.getSize()));
|
||||||
pageResult.setTotalPage(
|
pageResult.setTotalPage(
|
||||||
PageUtil.totalPage(Convert.toInt(page.getTotal()), Convert.toInt(page.getSize())));
|
PageUtil.totalPage(pageResult.getTotalRows(), pageResult.getPageSize()));
|
||||||
|
return pageResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将mybatis-plus的page转成自定义的PageResult,扩展了totalPage总页数
|
||||||
|
*
|
||||||
|
* @author fengshuonan
|
||||||
|
* @date 2020/10/15 15:53
|
||||||
|
*/
|
||||||
|
public static <T> PageResult<T> createPageResult(List<T> rows, Long count, Integer pageSize, Integer pageNo) {
|
||||||
|
PageResult<T> pageResult = new PageResult<>();
|
||||||
|
pageResult.setRows(rows);
|
||||||
|
pageResult.setTotalRows(Convert.toInt(count));
|
||||||
|
pageResult.setPageNo(pageNo);
|
||||||
|
pageResult.setPageSize(pageSize);
|
||||||
|
pageResult.setTotalPage(PageUtil.totalPage(pageResult.getTotalRows(), pageSize));
|
||||||
return pageResult;
|
return pageResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class InitTableListener implements ApplicationListener<ApplicationReadyEv
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getOrder() {
|
public int getOrder() {
|
||||||
return Ordered.LOWEST_PRECEDENCE;
|
return Ordered.LOWEST_PRECEDENCE - 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,6 @@ public class TaskRunListener implements ApplicationListener<ApplicationStartedEv
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getOrder() {
|
public int getOrder() {
|
||||||
return LOWEST_PRECEDENCE;
|
return LOWEST_PRECEDENCE - 300;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue