feat(sj_1.0.0): 修复sqlserver数据库MP分页查询是没有带order by 导致的查询报错
This commit is contained in:
parent
71a03b083e
commit
67a714fb36
@ -19,6 +19,14 @@ public class PartitionTaskUtils {
|
||||
private PartitionTaskUtils() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用此方法必须order id asc
|
||||
*
|
||||
* @param dataSource 数据来源
|
||||
* @param task 执行任务
|
||||
* @param startId 初始id
|
||||
* @return 总任务数
|
||||
*/
|
||||
public static long process(LongFunction<List<? extends PartitionTask>> dataSource,
|
||||
Consumer<List<? extends PartitionTask>> task,
|
||||
long startId) {
|
||||
|
@ -102,8 +102,11 @@ public class JobClearLogSchedule extends AbstractSchedule implements Lifecycle {
|
||||
|
||||
List<JobTaskBatch> jobTaskBatchList = jobTaskBatchMapper.selectPage(
|
||||
new Page<>(0, 1000),
|
||||
new LambdaUpdateWrapper<JobTaskBatch>().ge(JobTaskBatch::getId, startId)
|
||||
.le(JobTaskBatch::getCreateDt, endTime)).getRecords();
|
||||
new LambdaUpdateWrapper<JobTaskBatch>()
|
||||
.ge(JobTaskBatch::getId, startId)
|
||||
.le(JobTaskBatch::getCreateDt, endTime)
|
||||
.orderByAsc(JobTaskBatch::getId)
|
||||
).getRecords();
|
||||
return JobTaskConverter.INSTANCE.toJobTaskBatchPartitionTasks(jobTaskBatchList);
|
||||
}
|
||||
|
||||
|
@ -104,9 +104,12 @@ public class JobLogMergeSchedule extends AbstractSchedule implements Lifecycle {
|
||||
|
||||
List<JobTaskBatch> jobTaskBatchList = jobTaskBatchMapper.selectPage(
|
||||
new Page<>(0, 1000),
|
||||
new LambdaUpdateWrapper<JobTaskBatch>().ge(JobTaskBatch::getId, startId)
|
||||
new LambdaUpdateWrapper<JobTaskBatch>()
|
||||
.ge(JobTaskBatch::getId, startId)
|
||||
.in(JobTaskBatch::getTaskBatchStatus, JobTaskBatchStatusEnum.COMPLETED)
|
||||
.le(JobTaskBatch::getCreateDt, endTime)).getRecords();
|
||||
.le(JobTaskBatch::getCreateDt, endTime)
|
||||
.orderByAsc(JobTaskBatch::getId)
|
||||
).getRecords();
|
||||
return JobTaskConverter.INSTANCE.toJobTaskBatchPartitionTasks(jobTaskBatchList);
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,11 @@ public class ClearLogSchedule extends AbstractSchedule implements Lifecycle {
|
||||
|
||||
List<RetryTaskLog> retryTaskLogList = retryTaskLogMapper.selectPage(
|
||||
new Page<>(0, 1000),
|
||||
new LambdaUpdateWrapper<RetryTaskLog>().ge(RetryTaskLog::getId, startId).le(RetryTaskLog::getCreateDt, endTime)).getRecords();
|
||||
new LambdaUpdateWrapper<RetryTaskLog>()
|
||||
.ge(RetryTaskLog::getId, startId)
|
||||
.le(RetryTaskLog::getCreateDt, endTime)
|
||||
.orderByAsc(RetryTaskLog::getId)
|
||||
).getRecords();
|
||||
return RetryTaskConverter.INSTANCE.toRetryTaskLogPartitionTasks(retryTaskLogList);
|
||||
}
|
||||
|
||||
|
@ -123,10 +123,12 @@ public class RetryErrorMoreThresholdAlarmSchedule extends AbstractSchedule imple
|
||||
private List<NotifyConfigPartitionTask> getNotifyConfigPartitions(Long startId) {
|
||||
|
||||
List<NotifyConfig> notifyConfigs = accessTemplate.getNotifyConfigAccess()
|
||||
.listPage(new PageDTO<>(startId, 1000), new LambdaQueryWrapper<NotifyConfig>()
|
||||
.listPage(new PageDTO<>(0, 1000), new LambdaQueryWrapper<NotifyConfig>()
|
||||
.gt(NotifyConfig::getId, startId)
|
||||
.eq(NotifyConfig::getNotifyStatus, StatusEnum.YES.getStatus())
|
||||
.eq(NotifyConfig::getNotifyScene, RetryNotifySceneEnum.MAX_RETRY_ERROR.getNotifyScene()))
|
||||
.getRecords();
|
||||
.eq(NotifyConfig::getNotifyScene, RetryNotifySceneEnum.MAX_RETRY_ERROR.getNotifyScene())
|
||||
.orderByAsc(NotifyConfig::getId)
|
||||
).getRecords();
|
||||
|
||||
if (CollUtil.isEmpty(notifyConfigs)) {
|
||||
return Lists.newArrayList();
|
||||
|
@ -109,7 +109,9 @@ public class RetryLogMergeSchedule extends AbstractSchedule implements Lifecycle
|
||||
.in(RetryTaskLog::getRetryStatus, Lists.newArrayList(
|
||||
RetryStatusEnum.FINISH.getStatus(),
|
||||
RetryStatusEnum.MAX_COUNT.getStatus()))
|
||||
.le(RetryTaskLog::getCreateDt, endTime)).getRecords();
|
||||
.le(RetryTaskLog::getCreateDt, endTime)
|
||||
.orderByAsc(RetryTaskLog::getId)
|
||||
).getRecords();
|
||||
return RetryTaskLogConverter.INSTANCE.toRetryMergePartitionTaskDTOs(jobTaskBatchList);
|
||||
}
|
||||
|
||||
|
@ -116,11 +116,11 @@ public class RetryTaskMoreThresholdAlarmSchedule extends AbstractSchedule implem
|
||||
private List<NotifyConfigPartitionTask> getNotifyConfigPartitions(Long startId) {
|
||||
|
||||
List<NotifyConfig> notifyConfigs = accessTemplate.getNotifyConfigAccess()
|
||||
.listPage(new PageDTO<>(startId, 1000), new LambdaQueryWrapper<NotifyConfig>()
|
||||
.listPage(new PageDTO<>(0, 1000), new LambdaQueryWrapper<NotifyConfig>()
|
||||
.eq(NotifyConfig::getNotifyStatus, StatusEnum.YES.getStatus())
|
||||
.eq(NotifyConfig::getSystemTaskType, SyetemTaskTypeEnum.RETRY.getType())
|
||||
.eq(NotifyConfig::getNotifyScene, RetryNotifySceneEnum.MAX_RETRY.getNotifyScene())
|
||||
.orderByDesc(NotifyConfig::getId)) // SQLServer 分页必须 ORDER BY
|
||||
.orderByAsc(NotifyConfig::getId)) // SQLServer 分页必须 ORDER BY
|
||||
.getRecords();
|
||||
|
||||
Set<Long> recipientIds = notifyConfigs.stream()
|
||||
|
Loading…
Reference in New Issue
Block a user