Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
holmes
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
QA
holmes
Commits
0e816633
Commit
0e816633
authored
Dec 21, 2021
by
黎博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化定时任务列表接口
parent
b5d90b65
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
8 deletions
+18
-8
MonitorTaskController.java
...n/qg/holmes/controller/monitor/MonitorTaskController.java
+15
-5
MonitorTask.java
src/main/java/cn/qg/holmes/entity/monitor/MonitorTask.java
+3
-3
No files found.
src/main/java/cn/qg/holmes/controller/monitor/MonitorTaskController.java
View file @
0e816633
...
@@ -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
());
...
...
src/main/java/cn/qg/holmes/entity/monitor/MonitorTask.java
View file @
0e816633
...
@@ -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`"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment