定时任务显示分页问题解决

This commit is contained in:
XinWei 2024-07-17 16:30:19 +08:00
parent 309d583e99
commit 4cea2e37d4
3 changed files with 7 additions and 11 deletions

View File

@ -56,19 +56,13 @@ public class JobLogApiImpl implements JobLogApi {
Date beginTime,
Date endTime,
Integer status) {
JobLogPageReqDTO jobLogPageReqDTO = new JobLogPageReqDTO();
jobLogPageReqDTO.setPageNo(pageNo);
jobLogPageReqDTO.setPageSize(pageSize);
jobLogPageReqDTO.setJobId(jobId);
jobLogPageReqDTO.setHandlerName(handlerName);
jobLogPageReqDTO.setBeginTime(beginTime);
jobLogPageReqDTO.setEndTime(endTime);
jobLogPageReqDTO.setStatus(status);
// 设置默认组为3
int jobGroup = 3;
// 计算起始页数
pageNo = (pageNo - 1) * pageSize;
// page query
List<JobLogRespDTO> list = xxlJobLogDao.apiPageList(jobLogPageReqDTO.getPageNo(), jobLogPageReqDTO.getPageSize(), jobGroup, jobLogPageReqDTO.getJobId(), jobLogPageReqDTO.getBeginTime(), jobLogPageReqDTO.getEndTime(), status, jobLogPageReqDTO.getHandlerName());
int list_count = xxlJobLogDao.apiPageListCount(jobLogPageReqDTO.getPageNo(), jobLogPageReqDTO.getPageSize(), jobGroup, jobLogPageReqDTO.getJobId(), jobLogPageReqDTO.getBeginTime(), jobLogPageReqDTO.getEndTime(), status, jobLogPageReqDTO.getHandlerName());
List<JobLogRespDTO> list = xxlJobLogDao.apiPageList(pageNo, pageSize, jobGroup, jobId, beginTime, endTime, status, handlerName);
int list_count = xxlJobLogDao.apiPageListCount(pageNo, pageSize, jobGroup, jobId, beginTime, endTime, status, handlerName);
// package result
PageResult<JobLogRespDTO> pageResult = new PageResult<>();
pageResult.setTotal((long) list_count);

View File

@ -482,6 +482,8 @@ public class XxlJobServiceImpl implements XxlJobService {
public PageResult<JobInfoRespDTO> apiPage(Integer pageNo, Integer pageSize, String name, Integer status, String handlerName) {
PageResult<JobInfoRespDTO> pageResult = new PageResult<>();
if (status != null && status == 2) status = 0;
// 计算起始页数
pageNo = (pageNo - 1) * pageSize;
pageResult.setList(xxlJobInfoDao.apiPage(pageNo, pageSize, name, status, handlerName));
pageResult.setTotal(xxlJobInfoDao.apiPageCount(name, status, handlerName));
return pageResult;

View File

@ -273,7 +273,7 @@
</if>
</where>
<if test="pageSize > 0">
LIMIT #{pageSize} OFFSET ${(pageNo - 1) * pageSize}
LIMIT #{pageNo}, #{pageSize}
</if>
</select>