修复: 定时任务日志无法显示描述问题

This commit is contained in:
ruying408
2024-11-28 22:02:53 +08:00
parent 7ccdb130c8
commit 355bb5f54b
2 changed files with 8 additions and 9 deletions

View File

@@ -1,23 +1,21 @@
package com.cool.modules.task.controller.admin;
import static com.cool.modules.task.entity.table.TaskInfoEntityTableDef.TASK_INFO_ENTITY;
import cn.hutool.json.JSONObject;
import com.cool.core.annotation.CoolRestController;
import com.cool.core.base.BaseController;
import com.cool.core.request.R;
import com.cool.modules.task.entity.TaskInfoEntity;
import com.cool.modules.task.entity.table.TaskInfoEntityTableDef;
import com.cool.modules.task.service.TaskInfoService;
import com.mybatisflex.core.paginate.Page;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import jakarta.servlet.http.HttpServletRequest;
import static com.cool.modules.task.entity.table.TaskInfoEntityTableDef.TASK_INFO_ENTITY;
/**
* 任务
*/
@@ -56,7 +54,7 @@ public class AdminTaskInfoController extends BaseController<TaskInfoService, Tas
public R log(@RequestAttribute JSONObject requestParams) {
Integer page = requestParams.getInt("page", 0);
Integer size = requestParams.getInt("size", 20);
return R.ok(pageResult((Page<TaskInfoEntity>) service.log(new Page<>(page, size), requestParams.getLong("id"),
return R.ok(pageResult((Page) service.log(new Page<>(page, size), requestParams.getLong("id"),
requestParams.getInt("status"))));
}
}

View File

@@ -68,13 +68,14 @@ public class TaskInfoServiceImpl extends BaseServiceImpl<TaskInfoMapper, TaskInf
@Override
public Object log(Page page, Long taskId, Integer status) {
QueryWrapper queryWrapper = QueryWrapper.create().select(TASK_LOG_ENTITY.ALL_COLUMNS,
TASK_INFO_ENTITY.NAME.as("taskName")).from(TASK_LOG_ENTITY)
QueryWrapper queryWrapper = QueryWrapper.create().select(TASK_LOG_ENTITY.DETAIL,
TASK_LOG_ENTITY.STATUS, TASK_LOG_ENTITY.CREATE_TIME,
TASK_INFO_ENTITY.NAME).from(TASK_LOG_ENTITY)
.leftJoin(TASK_INFO_ENTITY).on(TASK_LOG_ENTITY.TASK_ID.eq(TASK_INFO_ENTITY.ID))
.eq(TaskLogEntity::getTaskId, taskId, taskId != null)
.eq(TaskLogEntity::getStatus, status, status != null)
.orderBy(TaskLogEntity::getCreateTime, false);
return mapper.paginate(page, queryWrapper);
return mapper.paginateAs(page, queryWrapper, TaskLogEntity.class);
}
@Override