mirror of
https://github.com/WeiYe-Jing/datax-web.git
synced 2026-06-13 21:00:50 +08:00
Merge branch 'v2.1.2'
This commit is contained in:
commit
8be1dae322
36
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
36
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
---
|
||||
name: "\U0001F41B Bug Report"
|
||||
about: Create a report to help us improve
|
||||
title: "[BUG] bug title "
|
||||
labels: bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
*For better global communication, please give priority to using English description, thx! *
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior, for example:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
|
||||
**Which version of DataX Web:**
|
||||
-[2.1.1]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
|
||||
**Requirement or improvement
|
||||
- Please describe about your requirements or improvement suggestions.
|
||||
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
name: "\U0001F680 Feature Request"
|
||||
about: Suggest an idea for this project
|
||||
title: "[Feature]"
|
||||
labels: new feature
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
23
.github/ISSUE_TEMPLATE/question.md
vendored
Normal file
23
.github/ISSUE_TEMPLATE/question.md
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
---
|
||||
name: "\U0001F914 Question"
|
||||
about: have a question wanted to be help
|
||||
title: "[QUESTION] question title"
|
||||
labels: question
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
*For better global communication, please give priority to using English description, thx! *
|
||||
|
||||
**Describe the question**
|
||||
A clear and concise description of what the question is.
|
||||
|
||||
|
||||
**Which version of DataX Web:**
|
||||
-[2.1.1]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
|
||||
**Requirement or improvement
|
||||
- Please describe about your requirements or improvement suggestions.
|
||||
@ -72,7 +72,7 @@ public class MetadataController extends BaseController {
|
||||
*/
|
||||
@GetMapping("/getTables")
|
||||
@ApiOperation("根据数据源id获取可用表名")
|
||||
public R<List<String>> getTableNames(Long datasourceId,String tableSchema) throws IOException, SQLException {
|
||||
public R<List<String>> getTableNames(Long datasourceId,String tableSchema) throws IOException {
|
||||
return success(datasourceQueryService.getTables(datasourceId,tableSchema));
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ public class MetadataController extends BaseController {
|
||||
*/
|
||||
@GetMapping("/getColumns")
|
||||
@ApiOperation("根据数据源id和表名获取所有字段")
|
||||
public R<List<String>> getColumns(Long datasourceId, String tableName) throws IOException, SQLException {
|
||||
public R<List<String>> getColumns(Long datasourceId, String tableName) throws IOException {
|
||||
return success(datasourceQueryService.getColumns(datasourceId, tableName));
|
||||
}
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@ import com.wugui.datax.admin.service.DatasourceQueryService;
|
||||
import com.wugui.datax.admin.service.JobDatasourceService;
|
||||
import com.wugui.datax.admin.tool.query.*;
|
||||
import com.wugui.datax.admin.util.JdbcConstants;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -50,7 +51,11 @@ public class DatasourceQueryServiceImpl implements DatasourceQueryService {
|
||||
return new MongoDBQueryTool(datasource).getCollectionNames(datasource.getDatabaseName());
|
||||
} else {
|
||||
BaseQueryTool qTool = QueryToolFactory.getByDbType(datasource);
|
||||
return qTool.getTableNames(tableSchema);
|
||||
if(StringUtils.isBlank(tableSchema)){
|
||||
return qTool.getTableNames();
|
||||
}else{
|
||||
return qTool.getTableNames(tableSchema);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -49,4 +49,9 @@ public abstract class BaseDatabaseMeta implements DatabaseInterface {
|
||||
public String getSQLQueryTableSchema(String... args) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLQueryTables() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,6 +28,13 @@ public interface DatabaseInterface {
|
||||
*/
|
||||
String getSQLQueryTables(String... tableSchema);
|
||||
|
||||
/**
|
||||
* 获取所有表名的sql
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getSQLQueryTables();
|
||||
|
||||
/**
|
||||
* 获取 Table schema
|
||||
*
|
||||
|
||||
@ -59,10 +59,10 @@ public class OracleDatabaseMeta extends BaseDatabaseMeta implements DatabaseInte
|
||||
}
|
||||
|
||||
|
||||
/*@Override
|
||||
public String getSQLQueryTables(String... args) {
|
||||
@Override
|
||||
public String getSQLQueryTables() {
|
||||
return "select table_name from user_tab_comments";
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLQueryColumns(String... args) {
|
||||
|
||||
@ -28,6 +28,13 @@ public class PostgresqlDatabaseMeta extends BaseDatabaseMeta implements Database
|
||||
return "select column_name from information_schema.columns where table_schema='public' and table_name='tb_cis_patient_info' and is_identity = 'YES'";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLQueryTables() {
|
||||
return "select relname as tabname from pg_class c \n" +
|
||||
"where relkind = 'r' and relname not like 'pg_%' and relname not like 'sql_%' group by relname order by relname limit 500";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getSQLQueryTables(String... tableSchema) {
|
||||
return "SELECT concat_ws('.',\"table_schema\",\"table_name\") FROM information_schema.tables \n" +
|
||||
|
||||
@ -354,6 +354,30 @@ public abstract class BaseQueryTool implements QueryToolInterface {
|
||||
return tables;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTableNames() {
|
||||
List<String> tables = new ArrayList<String>();
|
||||
Statement stmt = null;
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
stmt = connection.createStatement();
|
||||
//获取sql
|
||||
String sql = getSQLQueryTables();
|
||||
rs = stmt.executeQuery(sql);
|
||||
while (rs.next()) {
|
||||
String tableName = rs.getString(1);
|
||||
tables.add(tableName);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
logger.error("[getTableNames Exception] --> "
|
||||
+ "the exception message is:" + e.getMessage());
|
||||
} finally {
|
||||
JdbcUtils.close(rs);
|
||||
JdbcUtils.close(stmt);
|
||||
}
|
||||
return tables;
|
||||
}
|
||||
|
||||
public Boolean dataSourceTest() {
|
||||
try {
|
||||
DatabaseMetaData metaData = connection.getMetaData();
|
||||
@ -367,13 +391,18 @@ public abstract class BaseQueryTool implements QueryToolInterface {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
protected String getSQLQueryTables(String tableSchema) {
|
||||
return sqlBuilder.getSQLQueryTables(tableSchema);
|
||||
}
|
||||
|
||||
/**
|
||||
* 不需要其他参数的可不重写
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
protected String getSQLQueryTables(String tableSchema) {
|
||||
return sqlBuilder.getSQLQueryTables(tableSchema);
|
||||
protected String getSQLQueryTables() {
|
||||
return sqlBuilder.getSQLQueryTables();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -16,7 +16,7 @@ import java.sql.SQLException;
|
||||
*/
|
||||
public class QueryToolFactory {
|
||||
|
||||
public static final BaseQueryTool getByDbType(JobDatasource jobDatasource) {
|
||||
public static BaseQueryTool getByDbType(JobDatasource jobDatasource) {
|
||||
//获取dbType
|
||||
String datasource = jobDatasource.getDatasource();
|
||||
if (JdbcConstants.MYSQL.equals(datasource)) {
|
||||
|
||||
@ -62,6 +62,13 @@ public interface QueryToolInterface {
|
||||
*/
|
||||
List<String> getTableNames(String schema);
|
||||
|
||||
/**
|
||||
* 获取所有可用表名
|
||||
*
|
||||
* @return2
|
||||
*/
|
||||
List<String> getTableNames();
|
||||
|
||||
/**
|
||||
* 通过查询sql获取columns
|
||||
* @param querySql
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user