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
d9e48b82
Commit
d9e48b82
authored
Jan 05, 2022
by
黎博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增参数判断
parent
aba58c21
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
SqlMonitorTaskController.java
...g/holmes/controller/monitor/SqlMonitorTaskController.java
+12
-0
No files found.
src/main/java/cn/qg/holmes/controller/monitor/SqlMonitorTaskController.java
View file @
d9e48b82
...
...
@@ -159,7 +159,13 @@ public class SqlMonitorTaskController {
*/
@PostMapping
(
"/execute"
)
public
JsonResult
executeSql
(
@RequestParam
Integer
dsId
,
@RequestParam
String
sql
)
{
if
(
dsId
==
null
)
{
return
JsonResult
.
buildErrorStateResult
(
"数据源不能为空!"
,
false
);
}
SqlMonitorDataSource
sqlMonitorDataSource
=
sqlMonitorDataSourceService
.
getById
(
dsId
);
if
(
sqlMonitorDataSource
==
null
)
{
return
JsonResult
.
buildErrorStateResult
(
"数据源不存在!"
,
false
);
}
List
<
Map
<
String
,
Object
>>
resultList
=
JdbcUtils
.
queryForList
(
sqlMonitorDataSource
.
getHost
(),
sqlMonitorDataSource
.
getPort
(),
sqlMonitorDataSource
.
getUsername
(),
sqlMonitorDataSource
.
getPassword
(),
null
,
sql
);
return
JsonResult
.
buildSuccessResult
(
resultList
);
...
...
@@ -175,7 +181,13 @@ public class SqlMonitorTaskController {
public
JsonResult
testMonitorTask
(
@RequestBody
SqlMonitorTask
sqlMonitorTask
)
{
try
{
Integer
dsId
=
sqlMonitorTask
.
getDsId
();
if
(
dsId
==
null
)
{
return
JsonResult
.
buildErrorStateResult
(
"数据源不能为空!"
,
false
);
}
SqlMonitorDataSource
sqlMonitorDataSource
=
sqlMonitorDataSourceService
.
getById
(
dsId
);
if
(
sqlMonitorDataSource
==
null
)
{
return
JsonResult
.
buildErrorStateResult
(
"数据源不存在!"
,
false
);
}
List
<
Map
<
String
,
Object
>>
resultList
=
JdbcUtils
.
queryForList
(
sqlMonitorDataSource
.
getHost
(),
sqlMonitorDataSource
.
getPort
(),
sqlMonitorDataSource
.
getUsername
(),
sqlMonitorDataSource
.
getPassword
(),
null
,
sqlMonitorTask
.
getSql
());
String
dingUrl
=
sqlMonitorTask
.
getDingUrl
();
...
...
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