Commit 0e816633 authored by 黎博's avatar 黎博

优化定时任务列表接口

parent b5d90b65
...@@ -37,13 +37,21 @@ public class MonitorTaskController { ...@@ -37,13 +37,21 @@ public class MonitorTaskController {
@Autowired @Autowired
JdbcTemplate jdbcTemplate; JdbcTemplate jdbcTemplate;
/**
* 获取监控列表,带搜索和分页
* @param pageNum 第几页
* @param pageSize 每页多少个
* @param businessLine 业务线
* @param serviceName 服务名
* @param owner 负责人
* @return
*/
@GetMapping("/list") @GetMapping("/list")
public JsonResult getMonitorTaskList(@RequestParam(defaultValue = "1") Integer pageNum, public JsonResult getMonitorTaskList(@RequestParam(defaultValue = "1") Integer pageNum,
@RequestParam(defaultValue = "10") Integer pageSize, @RequestParam(defaultValue = "10") Integer pageSize,
String businessLine, @RequestParam String businessLine,
String serviceName, @RequestParam String serviceName,
String owner) { @RequestParam String owner) {
IPage<MonitorTask> pageParam = new Page<>(pageNum, pageSize);
QueryWrapper<MonitorTask> queryWrapper = new QueryWrapper<>(); QueryWrapper<MonitorTask> queryWrapper = new QueryWrapper<>();
if (!StringUtils.isEmpty(businessLine)) { if (!StringUtils.isEmpty(businessLine)) {
queryWrapper.eq("business_line", businessLine); queryWrapper.eq("business_line", businessLine);
...@@ -51,9 +59,11 @@ public class MonitorTaskController { ...@@ -51,9 +59,11 @@ public class MonitorTaskController {
if (!StringUtils.isEmpty(serviceName)) { if (!StringUtils.isEmpty(serviceName)) {
queryWrapper.eq("service_name", serviceName); queryWrapper.eq("service_name", serviceName);
} }
if (!StringUtils.isEmpty("owner")) { if (!StringUtils.isEmpty(owner)) {
queryWrapper.eq("owner", owner); queryWrapper.eq("owner", owner);
} }
queryWrapper.orderByDesc("id");
IPage<MonitorTask> pageParam = new Page<>(pageNum, pageSize);
IPage<MonitorTask> monitorTaskIPage = monitorTaskService.page(pageParam, queryWrapper); IPage<MonitorTask> monitorTaskIPage = monitorTaskService.page(pageParam, queryWrapper);
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
resultMap.put("list", monitorTaskIPage.getRecords()); resultMap.put("list", monitorTaskIPage.getRecords());
......
...@@ -25,21 +25,21 @@ public class MonitorTask { ...@@ -25,21 +25,21 @@ public class MonitorTask {
/** /**
* 定时任务执行类 * 定时任务执行类
*/ */
@TableField(value = "task_class") @TableField(value = "`task_class`")
@NotBlank(message = "定时任务执行类不能为空") @NotBlank(message = "定时任务执行类不能为空")
private String taskClass; private String taskClass;
/** /**
* 定时任务描述 * 定时任务描述
*/ */
@TableField(value = "task_name") @TableField(value = "`task_name`")
@NotBlank(message = "定时任务名称不能为空") @NotBlank(message = "定时任务名称不能为空")
private String taskName; private String taskName;
/** /**
* 定时任务cron表达式 * 定时任务cron表达式
*/ */
@TableField(value = "task_cron") @TableField(value = "`task_cron`")
private String taskCron; private String taskCron;
@TableField(value = "`sql`") @TableField(value = "`sql`")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment