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
61aed89a
Commit
61aed89a
authored
Oct 15, 2021
by
黎博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增接口tableList
parent
23fb7de5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
2 deletions
+12
-2
DbSyncController.java
...java/cn/qg/holmes/controller/effect/DbSyncController.java
+11
-0
DatabaseSyncServiceImpl.java
...g/holmes/service/effect/impl/DatabaseSyncServiceImpl.java
+0
-1
DbSyncTask.java
src/main/java/cn/qg/holmes/task/DbSyncTask.java
+1
-1
No files found.
src/main/java/cn/qg/holmes/controller/effect/DbSyncController.java
View file @
61aed89a
...
...
@@ -105,6 +105,17 @@ public class DbSyncController {
return
JsonResult
.
buildSuccessResult
(
tableList
);
}
/**
* 跟数据库同步脚本使用的接口
* @param database 数据库名
* @return
*/
@GetMapping
(
"/tableList"
)
public
String
getTableListForSync
(
@RequestParam
String
database
)
{
List
<
String
>
tableList
=
databaseSyncService
.
getTableListByDb
(
ip
,
port
,
username
,
password
,
database
);
return
StringUtils
.
join
(
tableList
,
" "
);
}
/**
* 老数据库同步,调用Jenkins job sync_database_schema
* @param dbName 数据库名
...
...
src/main/java/cn/qg/holmes/service/effect/impl/DatabaseSyncServiceImpl.java
View file @
61aed89a
...
...
@@ -158,7 +158,6 @@ public class DatabaseSyncServiceImpl implements DatabaseSyncService {
StringBuilder
insertSql
=
new
StringBuilder
();
while
(
selectResultSet
.
next
())
{
String
rowValues
=
getRowValues
(
selectResultSet
,
columnNameList
.
size
(),
columnTypeList
);
// String insertSql = String.format("insert into %s (%s) values(%s);", tableName, columnArrayStr, rowValues);
insertSql
.
append
(
"insert into "
)
.
append
(
tableName
)
...
...
src/main/java/cn/qg/holmes/task/DbSyncTask.java
View file @
61aed89a
...
...
@@ -32,7 +32,7 @@ public class DbSyncTask {
private
String
password
;
// @Scheduled(cron = "0 0 24 * * ?")
@Scheduled
(
cron
=
"0
15
15 * * ?"
)
@Scheduled
(
cron
=
"0
38
15 * * ?"
)
public
void
getDbInfoFromSourceJob
()
{
List
<
String
>
dbList
=
databaseSyncService
.
getDatabaseList
(
ip
,
port
,
username
,
password
);
for
(
String
dbName:
dbList
)
{
...
...
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