Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
njgzx
dataease
Commits
7db17563
提交
7db17563
authored
10月 11, 2021
作者:
wangjiahao
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/dev' into dev
上级
e3f3928b
7faa88f2
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
17 个修改的文件
包含
50 行增加
和
53 行删除
+50
-53
CHConfiguration.java
...main/java/io/dataease/datasource/dto/CHConfiguration.java
+1
-1
DorisConfiguration.java
...n/java/io/dataease/datasource/dto/DorisConfiguration.java
+1
-1
EsConfiguration.java
...main/java/io/dataease/datasource/dto/EsConfiguration.java
+1
-1
JdbcConfiguration.java
...in/java/io/dataease/datasource/dto/JdbcConfiguration.java
+1
-1
MysqlConfiguration.java
...n/java/io/dataease/datasource/dto/MysqlConfiguration.java
+1
-1
OracleConfiguration.java
.../java/io/dataease/datasource/dto/OracleConfiguration.java
+1
-1
PgConfiguration.java
...main/java/io/dataease/datasource/dto/PgConfiguration.java
+1
-1
SqlServerConfiguration.java
...va/io/dataease/datasource/dto/SqlServerConfiguration.java
+1
-1
EsProvider.java
...main/java/io/dataease/datasource/provider/EsProvider.java
+17
-18
JdbcProvider.java
...in/java/io/dataease/datasource/provider/JdbcProvider.java
+0
-0
DatasourceService.java
...ava/io/dataease/datasource/service/DatasourceService.java
+5
-5
QueryProvider.java
...end/src/main/java/io/dataease/provider/QueryProvider.java
+2
-2
OracleQueryProvider.java
...java/io/dataease/provider/oracle/OracleQueryProvider.java
+7
-8
PgQueryProvider.java
...rc/main/java/io/dataease/provider/pg/PgQueryProvider.java
+3
-5
SqlserverQueryProvider.java
...o/dataease/provider/sqlserver/SqlserverQueryProvider.java
+4
-7
ExtractDataService.java
.../java/io/dataease/service/dataset/ExtractDataService.java
+0
-0
form.vue
frontend/src/views/system/datasource/form.vue
+4
-0
没有找到文件。
backend/src/main/java/io/dataease/datasource/dto/CHConfigration.java
→
backend/src/main/java/io/dataease/datasource/dto/CHConfig
u
ration.java
浏览文件 @
7db17563
...
@@ -6,7 +6,7 @@ import org.apache.commons.lang3.StringUtils;
...
@@ -6,7 +6,7 @@ import org.apache.commons.lang3.StringUtils;
@Getter
@Getter
@Setter
@Setter
public
class
CHConfig
ration
extends
JdbcDTO
{
public
class
CHConfig
uration
extends
JdbcConfiguration
{
private
String
driver
=
"ru.yandex.clickhouse.ClickHouseDriver"
;
private
String
driver
=
"ru.yandex.clickhouse.ClickHouseDriver"
;
private
String
extraParams
=
""
;
private
String
extraParams
=
""
;
...
...
backend/src/main/java/io/dataease/datasource/dto/DorisConfigration.java
→
backend/src/main/java/io/dataease/datasource/dto/DorisConfig
u
ration.java
浏览文件 @
7db17563
...
@@ -5,7 +5,7 @@ import lombok.Setter;
...
@@ -5,7 +5,7 @@ import lombok.Setter;
@Getter
@Getter
@Setter
@Setter
public
class
DorisConfig
ration
extends
MysqlConfig
ration
{
public
class
DorisConfig
uration
extends
MysqlConfigu
ration
{
private
Integer
httpPort
;
private
Integer
httpPort
;
}
}
backend/src/main/java/io/dataease/datasource/dto/EsConfig
DTO
.java
→
backend/src/main/java/io/dataease/datasource/dto/EsConfig
uration
.java
浏览文件 @
7db17563
...
@@ -6,7 +6,7 @@ import lombok.Setter;
...
@@ -6,7 +6,7 @@ import lombok.Setter;
@Getter
@Getter
@Setter
@Setter
public
class
EsConfig
DTO
{
public
class
EsConfig
uration
{
private
String
url
;
private
String
url
;
private
String
esUsername
;
private
String
esUsername
;
private
String
esPassword
;
private
String
esPassword
;
...
...
backend/src/main/java/io/dataease/datasource/dto/Jdbc
DTO
.java
→
backend/src/main/java/io/dataease/datasource/dto/Jdbc
Configuration
.java
浏览文件 @
7db17563
...
@@ -6,7 +6,7 @@ import lombok.Setter;
...
@@ -6,7 +6,7 @@ import lombok.Setter;
@Getter
@Getter
@Setter
@Setter
public
class
Jdbc
DTO
{
public
class
Jdbc
Configuration
{
private
String
host
;
private
String
host
;
private
Integer
port
;
private
Integer
port
;
private
String
username
;
private
String
username
;
...
...
backend/src/main/java/io/dataease/datasource/dto/MysqlConfigration.java
→
backend/src/main/java/io/dataease/datasource/dto/MysqlConfig
u
ration.java
浏览文件 @
7db17563
...
@@ -6,7 +6,7 @@ import org.apache.commons.lang3.StringUtils;
...
@@ -6,7 +6,7 @@ import org.apache.commons.lang3.StringUtils;
@Getter
@Getter
@Setter
@Setter
public
class
MysqlConfig
ration
extends
JdbcDTO
{
public
class
MysqlConfig
uration
extends
JdbcConfiguration
{
private
String
driver
=
"com.mysql.cj.jdbc.Driver"
;
private
String
driver
=
"com.mysql.cj.jdbc.Driver"
;
private
String
extraParams
=
"characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true"
;
private
String
extraParams
=
"characterEncoding=UTF-8&connectTimeout=5000&useSSL=false&allowPublicKeyRetrieval=true"
;
...
...
backend/src/main/java/io/dataease/datasource/dto/OracleConfigration.java
→
backend/src/main/java/io/dataease/datasource/dto/OracleConfig
u
ration.java
浏览文件 @
7db17563
...
@@ -5,7 +5,7 @@ import lombok.Setter;
...
@@ -5,7 +5,7 @@ import lombok.Setter;
@Getter
@Getter
@Setter
@Setter
public
class
OracleConfig
ration
extends
JdbcDTO
{
public
class
OracleConfig
uration
extends
JdbcConfiguration
{
private
String
driver
=
"oracle.jdbc.driver.OracleDriver"
;
private
String
driver
=
"oracle.jdbc.driver.OracleDriver"
;
private
String
connectionType
;
private
String
connectionType
;
...
...
backend/src/main/java/io/dataease/datasource/dto/PgConfigration.java
→
backend/src/main/java/io/dataease/datasource/dto/PgConfig
u
ration.java
浏览文件 @
7db17563
...
@@ -6,7 +6,7 @@ import org.apache.commons.lang3.StringUtils;
...
@@ -6,7 +6,7 @@ import org.apache.commons.lang3.StringUtils;
@Getter
@Getter
@Setter
@Setter
public
class
PgConfig
ration
extends
JdbcDTO
{
public
class
PgConfig
uration
extends
JdbcConfiguration
{
private
String
driver
=
"org.postgresql.Driver"
;
private
String
driver
=
"org.postgresql.Driver"
;
private
String
extraParams
=
""
;
private
String
extraParams
=
""
;
...
...
backend/src/main/java/io/dataease/datasource/dto/SqlServerConfigration.java
→
backend/src/main/java/io/dataease/datasource/dto/SqlServerConfig
u
ration.java
浏览文件 @
7db17563
...
@@ -7,7 +7,7 @@ import org.apache.commons.lang3.StringUtils;
...
@@ -7,7 +7,7 @@ import org.apache.commons.lang3.StringUtils;
@Getter
@Getter
@Setter
@Setter
public
class
SqlServerConfig
ration
extends
JdbcDTO
{
public
class
SqlServerConfig
uration
extends
JdbcConfiguration
{
private
String
driver
=
"com.microsoft.sqlserver.jdbc.SQLServerDriver"
;
private
String
driver
=
"com.microsoft.sqlserver.jdbc.SQLServerDriver"
;
private
String
extraParams
=
""
;
private
String
extraParams
=
""
;
public
String
getJdbc
(){
public
String
getJdbc
(){
...
...
backend/src/main/java/io/dataease/datasource/provider/EsProvider.java
浏览文件 @
7db17563
package
io
.
dataease
.
datasource
.
provider
;
package
io
.
dataease
.
datasource
.
provider
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.gson.Gson
;
import
com.google.gson.Gson
;
import
com.mchange.v2.c3p0.ComboPooledDataSource
;
import
com.mchange.v2.c3p0.ComboPooledDataSource
;
...
@@ -48,17 +47,17 @@ public class EsProvider extends DatasourceProvider {
...
@@ -48,17 +47,17 @@ public class EsProvider extends DatasourceProvider {
public
List
<
String
[]>
getData
(
DatasourceRequest
dsr
)
throws
Exception
{
public
List
<
String
[]>
getData
(
DatasourceRequest
dsr
)
throws
Exception
{
List
<
String
[]>
list
=
new
LinkedList
<>();
List
<
String
[]>
list
=
new
LinkedList
<>();
try
{
try
{
EsConfig
DTO
esConfigDTO
=
new
Gson
().
fromJson
(
dsr
.
getDatasource
().
getConfiguration
(),
EsConfigDTO
.
class
);
EsConfig
uration
esConfiguration
=
new
Gson
().
fromJson
(
dsr
.
getDatasource
().
getConfiguration
(),
EsConfiguration
.
class
);
HttpClientConfig
httpClientConfig
=
new
HttpClientConfig
();
HttpClientConfig
httpClientConfig
=
new
HttpClientConfig
();
if
(
StringUtils
.
isNotEmpty
(
esConfig
DTO
.
getEsUsername
())){
if
(
StringUtils
.
isNotEmpty
(
esConfig
uration
.
getEsUsername
())){
String
auth
=
esConfig
DTO
.
getEsUsername
()
+
":"
+
esConfigDTO
.
getEsPassword
();
String
auth
=
esConfig
uration
.
getEsUsername
()
+
":"
+
esConfiguration
.
getEsPassword
();
byte
[]
encodedAuth
=
Base64
.
encodeBase64
(
auth
.
getBytes
(
StandardCharsets
.
UTF_8
));
byte
[]
encodedAuth
=
Base64
.
encodeBase64
(
auth
.
getBytes
(
StandardCharsets
.
UTF_8
));
httpClientConfig
.
addHeader
(
HttpHeaders
.
AUTHORIZATION
,
"Basic "
+
new
String
(
encodedAuth
));
httpClientConfig
.
addHeader
(
HttpHeaders
.
AUTHORIZATION
,
"Basic "
+
new
String
(
encodedAuth
));
}
}
Requst
requst
=
new
Requst
();
Requst
requst
=
new
Requst
();
requst
.
setQuery
(
dsr
.
getQuery
());
requst
.
setQuery
(
dsr
.
getQuery
());
requst
.
setFetch_size
(
dsr
.
getFetchSize
());
requst
.
setFetch_size
(
dsr
.
getFetchSize
());
String
url
=
esConfig
DTO
.
getUrl
().
endsWith
(
"/"
)
?
esConfigDTO
.
getUrl
()
+
esConfigDTO
.
getUri
()
+
"?format=json"
:
esConfigDTO
.
getUrl
()
+
"/"
+
esConfigDTO
.
getUri
()
+
"?format=json"
;
String
url
=
esConfig
uration
.
getUrl
().
endsWith
(
"/"
)
?
esConfiguration
.
getUrl
()
+
esConfiguration
.
getUri
()
+
"?format=json"
:
esConfiguration
.
getUrl
()
+
"/"
+
esConfiguration
.
getUri
()
+
"?format=json"
;
String
response
=
HttpClientUtil
.
post
(
url
,
new
Gson
().
toJson
(
requst
),
httpClientConfig
);
String
response
=
HttpClientUtil
.
post
(
url
,
new
Gson
().
toJson
(
requst
),
httpClientConfig
);
EsReponse
esReponse
=
new
Gson
().
fromJson
(
response
,
EsReponse
.
class
);
EsReponse
esReponse
=
new
Gson
().
fromJson
(
response
,
EsReponse
.
class
);
...
@@ -225,7 +224,7 @@ public class EsProvider extends DatasourceProvider {
...
@@ -225,7 +224,7 @@ public class EsProvider extends DatasourceProvider {
@Override
@Override
public
void
checkStatus
(
DatasourceRequest
datasourceRequest
)
throws
Exception
{
public
void
checkStatus
(
DatasourceRequest
datasourceRequest
)
throws
Exception
{
EsConfig
DTO
esConfigDTO
=
new
Gson
().
fromJson
(
datasourceRequest
.
getDatasource
().
getConfiguration
(),
EsConfigDTO
.
class
);
EsConfig
uration
esConfiguration
=
new
Gson
().
fromJson
(
datasourceRequest
.
getDatasource
().
getConfiguration
(),
EsConfiguration
.
class
);
String
response
=
exexGetQuery
(
datasourceRequest
);
String
response
=
exexGetQuery
(
datasourceRequest
);
if
(
JSONObject
.
parseObject
(
response
).
getJSONObject
(
"error"
)
!=
null
){
if
(
JSONObject
.
parseObject
(
response
).
getJSONObject
(
"error"
)
!=
null
){
...
@@ -239,21 +238,21 @@ public class EsProvider extends DatasourceProvider {
...
@@ -239,21 +238,21 @@ public class EsProvider extends DatasourceProvider {
throw
new
Exception
(
Translator
.
get
(
"i18n_es_limit"
));
throw
new
Exception
(
Translator
.
get
(
"i18n_es_limit"
));
}
}
if
(
Integer
.
valueOf
(
version
.
substring
(
0
,
1
))
==
6
)
{
if
(
Integer
.
valueOf
(
version
.
substring
(
0
,
1
))
==
6
)
{
esConfig
DTO
.
setUri
(
"_xpack/sql"
);
esConfig
uration
.
setUri
(
"_xpack/sql"
);
}
}
if
(
Integer
.
valueOf
(
version
.
substring
(
0
,
1
))
==
7
)
{
if
(
Integer
.
valueOf
(
version
.
substring
(
0
,
1
))
==
7
)
{
esConfig
DTO
.
setUri
(
"_sql"
);
esConfig
uration
.
setUri
(
"_sql"
);
}
}
datasourceRequest
.
getDatasource
().
setConfiguration
(
new
Gson
().
toJson
(
esConfig
DTO
));
datasourceRequest
.
getDatasource
().
setConfiguration
(
new
Gson
().
toJson
(
esConfig
uration
));
getTables
(
datasourceRequest
);
getTables
(
datasourceRequest
);
}
}
private
String
exexQuery
(
DatasourceRequest
datasourceRequest
,
String
sql
,
String
uri
){
private
String
exexQuery
(
DatasourceRequest
datasourceRequest
,
String
sql
,
String
uri
){
EsConfig
DTO
esConfigDTO
=
new
Gson
().
fromJson
(
datasourceRequest
.
getDatasource
().
getConfiguration
(),
EsConfigDTO
.
class
);
EsConfig
uration
esConfiguration
=
new
Gson
().
fromJson
(
datasourceRequest
.
getDatasource
().
getConfiguration
(),
EsConfiguration
.
class
);
uri
=
esConfig
DTO
.
getUri
()+
uri
;
uri
=
esConfig
uration
.
getUri
()+
uri
;
HttpClientConfig
httpClientConfig
=
new
HttpClientConfig
();
HttpClientConfig
httpClientConfig
=
new
HttpClientConfig
();
if
(
StringUtils
.
isNotEmpty
(
esConfig
DTO
.
getEsUsername
())
&&
StringUtils
.
isNotEmpty
(
esConfigDTO
.
getEsPassword
())){
if
(
StringUtils
.
isNotEmpty
(
esConfig
uration
.
getEsUsername
())
&&
StringUtils
.
isNotEmpty
(
esConfiguration
.
getEsPassword
())){
String
auth
=
esConfig
DTO
.
getEsUsername
()
+
":"
+
esConfigDTO
.
getEsPassword
();
String
auth
=
esConfig
uration
.
getEsUsername
()
+
":"
+
esConfiguration
.
getEsPassword
();
byte
[]
encodedAuth
=
Base64
.
encodeBase64
(
auth
.
getBytes
(
StandardCharsets
.
UTF_8
));
byte
[]
encodedAuth
=
Base64
.
encodeBase64
(
auth
.
getBytes
(
StandardCharsets
.
UTF_8
));
httpClientConfig
.
addHeader
(
HttpHeaders
.
AUTHORIZATION
,
"Basic "
+
new
String
(
encodedAuth
));
httpClientConfig
.
addHeader
(
HttpHeaders
.
AUTHORIZATION
,
"Basic "
+
new
String
(
encodedAuth
));
}
}
...
@@ -261,21 +260,21 @@ public class EsProvider extends DatasourceProvider {
...
@@ -261,21 +260,21 @@ public class EsProvider extends DatasourceProvider {
Requst
requst
=
new
Requst
();
Requst
requst
=
new
Requst
();
requst
.
setQuery
(
sql
);
requst
.
setQuery
(
sql
);
requst
.
setFetch_size
(
datasourceRequest
.
getFetchSize
());
requst
.
setFetch_size
(
datasourceRequest
.
getFetchSize
());
String
url
=
esConfig
DTO
.
getUrl
().
endsWith
(
"/"
)
?
esConfigDTO
.
getUrl
()
+
uri
:
esConfigDTO
.
getUrl
()
+
"/"
+
uri
;
String
url
=
esConfig
uration
.
getUrl
().
endsWith
(
"/"
)
?
esConfiguration
.
getUrl
()
+
uri
:
esConfiguration
.
getUrl
()
+
"/"
+
uri
;
String
response
=
HttpClientUtil
.
post
(
url
,
new
Gson
().
toJson
(
requst
),
httpClientConfig
);
String
response
=
HttpClientUtil
.
post
(
url
,
new
Gson
().
toJson
(
requst
),
httpClientConfig
);
return
response
;
return
response
;
}
}
private
String
exexGetQuery
(
DatasourceRequest
datasourceRequest
){
private
String
exexGetQuery
(
DatasourceRequest
datasourceRequest
){
EsConfig
DTO
esConfigDTO
=
new
Gson
().
fromJson
(
datasourceRequest
.
getDatasource
().
getConfiguration
(),
EsConfigDTO
.
class
);
EsConfig
uration
esConfiguration
=
new
Gson
().
fromJson
(
datasourceRequest
.
getDatasource
().
getConfiguration
(),
EsConfiguration
.
class
);
HttpClientConfig
httpClientConfig
=
new
HttpClientConfig
();
HttpClientConfig
httpClientConfig
=
new
HttpClientConfig
();
if
(
StringUtils
.
isNotEmpty
(
esConfig
DTO
.
getEsUsername
())
&&
StringUtils
.
isNotEmpty
(
esConfigDTO
.
getEsPassword
())){
if
(
StringUtils
.
isNotEmpty
(
esConfig
uration
.
getEsUsername
())
&&
StringUtils
.
isNotEmpty
(
esConfiguration
.
getEsPassword
())){
String
auth
=
esConfig
DTO
.
getEsUsername
()
+
":"
+
esConfigDTO
.
getEsPassword
();
String
auth
=
esConfig
uration
.
getEsUsername
()
+
":"
+
esConfiguration
.
getEsPassword
();
byte
[]
encodedAuth
=
Base64
.
encodeBase64
(
auth
.
getBytes
(
StandardCharsets
.
UTF_8
));
byte
[]
encodedAuth
=
Base64
.
encodeBase64
(
auth
.
getBytes
(
StandardCharsets
.
UTF_8
));
httpClientConfig
.
addHeader
(
HttpHeaders
.
AUTHORIZATION
,
"Basic "
+
new
String
(
encodedAuth
));
httpClientConfig
.
addHeader
(
HttpHeaders
.
AUTHORIZATION
,
"Basic "
+
new
String
(
encodedAuth
));
}
}
String
response
=
HttpClientUtil
.
get
(
esConfig
DTO
.
getUrl
(),
httpClientConfig
);
String
response
=
HttpClientUtil
.
get
(
esConfig
uration
.
getUrl
(),
httpClientConfig
);
return
response
;
return
response
;
}
}
...
...
backend/src/main/java/io/dataease/datasource/provider/JdbcProvider.java
浏览文件 @
7db17563
差异被折叠。
点击展开。
backend/src/main/java/io/dataease/datasource/service/DatasourceService.java
浏览文件 @
7db17563
...
@@ -96,19 +96,19 @@ public class DatasourceService {
...
@@ -96,19 +96,19 @@ public class DatasourceService {
case
mariadb:
case
mariadb:
case
de_doris:
case
de_doris:
case
ds_doris:
case
ds_doris:
datasourceDTO
.
setConfiguration
(
JSONObject
.
toJSONString
(
new
Gson
().
fromJson
(
datasourceDTO
.
getConfiguration
(),
MysqlConfigration
.
class
))
);
datasourceDTO
.
setConfiguration
(
JSONObject
.
toJSONString
(
new
Gson
().
fromJson
(
datasourceDTO
.
getConfiguration
(),
MysqlConfig
u
ration
.
class
))
);
break
;
break
;
case
sqlServer:
case
sqlServer:
datasourceDTO
.
setConfiguration
(
JSONObject
.
toJSONString
(
new
Gson
().
fromJson
(
datasourceDTO
.
getConfiguration
(),
SqlServerConfigration
.
class
))
);
datasourceDTO
.
setConfiguration
(
JSONObject
.
toJSONString
(
new
Gson
().
fromJson
(
datasourceDTO
.
getConfiguration
(),
SqlServerConfig
u
ration
.
class
))
);
break
;
break
;
case
oracle:
case
oracle:
datasourceDTO
.
setConfiguration
(
JSONObject
.
toJSONString
(
new
Gson
().
fromJson
(
datasourceDTO
.
getConfiguration
(),
OracleConfigration
.
class
))
);
datasourceDTO
.
setConfiguration
(
JSONObject
.
toJSONString
(
new
Gson
().
fromJson
(
datasourceDTO
.
getConfiguration
(),
OracleConfig
u
ration
.
class
))
);
break
;
break
;
case
pg:
case
pg:
datasourceDTO
.
setConfiguration
(
JSONObject
.
toJSONString
(
new
Gson
().
fromJson
(
datasourceDTO
.
getConfiguration
(),
PgConfigration
.
class
))
);
datasourceDTO
.
setConfiguration
(
JSONObject
.
toJSONString
(
new
Gson
().
fromJson
(
datasourceDTO
.
getConfiguration
(),
PgConfig
u
ration
.
class
))
);
break
;
break
;
case
ck:
case
ck:
datasourceDTO
.
setConfiguration
(
JSONObject
.
toJSONString
(
new
Gson
().
fromJson
(
datasourceDTO
.
getConfiguration
(),
CHConfigration
.
class
))
);
datasourceDTO
.
setConfiguration
(
JSONObject
.
toJSONString
(
new
Gson
().
fromJson
(
datasourceDTO
.
getConfiguration
(),
CHConfig
u
ration
.
class
))
);
break
;
break
;
default
:
default
:
break
;
break
;
...
...
backend/src/main/java/io/dataease/provider/QueryProvider.java
浏览文件 @
7db17563
...
@@ -4,7 +4,7 @@ import com.google.gson.Gson;
...
@@ -4,7 +4,7 @@ import com.google.gson.Gson;
import
io.dataease.base.domain.DatasetTableField
;
import
io.dataease.base.domain.DatasetTableField
;
import
io.dataease.base.domain.Datasource
;
import
io.dataease.base.domain.Datasource
;
import
io.dataease.controller.request.chart.ChartExtFilterRequest
;
import
io.dataease.controller.request.chart.ChartExtFilterRequest
;
import
io.dataease.datasource.dto.Jdbc
DTO
;
import
io.dataease.datasource.dto.Jdbc
Configuration
;
import
io.dataease.dto.chart.ChartCustomFilterDTO
;
import
io.dataease.dto.chart.ChartCustomFilterDTO
;
import
io.dataease.dto.chart.ChartViewFieldDTO
;
import
io.dataease.dto.chart.ChartViewFieldDTO
;
import
io.dataease.dto.sqlObj.SQLObj
;
import
io.dataease.dto.sqlObj.SQLObj
;
...
@@ -76,7 +76,7 @@ public abstract class QueryProvider {
...
@@ -76,7 +76,7 @@ public abstract class QueryProvider {
public
void
setSchema
(
SQLObj
tableObj
,
Datasource
ds
){
public
void
setSchema
(
SQLObj
tableObj
,
Datasource
ds
){
if
(
ds
!=
null
&&
!
tableObj
.
getTableName
().
startsWith
(
"("
)
&&
!
tableObj
.
getTableName
().
endsWith
(
")"
)){
if
(
ds
!=
null
&&
!
tableObj
.
getTableName
().
startsWith
(
"("
)
&&
!
tableObj
.
getTableName
().
endsWith
(
")"
)){
String
schema
=
new
Gson
().
fromJson
(
ds
.
getConfiguration
(),
Jdbc
DTO
.
class
).
getSchema
();
String
schema
=
new
Gson
().
fromJson
(
ds
.
getConfiguration
(),
Jdbc
Configuration
.
class
).
getSchema
();
schema
=
String
.
format
(
PgConstants
.
KEYWORD_TABLE
,
schema
);
schema
=
String
.
format
(
PgConstants
.
KEYWORD_TABLE
,
schema
);
tableObj
.
setTableName
(
schema
+
"."
+
tableObj
.
getTableName
());
tableObj
.
setTableName
(
schema
+
"."
+
tableObj
.
getTableName
());
}
}
...
...
backend/src/main/java/io/dataease/provider/oracle/OracleQueryProvider.java
浏览文件 @
7db17563
...
@@ -6,14 +6,13 @@ import io.dataease.base.domain.DatasetTableFieldExample;
...
@@ -6,14 +6,13 @@ import io.dataease.base.domain.DatasetTableFieldExample;
import
io.dataease.base.domain.Datasource
;
import
io.dataease.base.domain.Datasource
;
import
io.dataease.base.mapper.DatasetTableFieldMapper
;
import
io.dataease.base.mapper.DatasetTableFieldMapper
;
import
io.dataease.controller.request.chart.ChartExtFilterRequest
;
import
io.dataease.controller.request.chart.ChartExtFilterRequest
;
import
io.dataease.datasource.dto.Jdbc
DTO
;
import
io.dataease.datasource.dto.Jdbc
Configuration
;
import
io.dataease.datasource.dto.OracleConfigration
;
import
io.dataease.datasource.dto.OracleConfig
u
ration
;
import
io.dataease.dto.chart.ChartCustomFilterDTO
;
import
io.dataease.dto.chart.ChartCustomFilterDTO
;
import
io.dataease.dto.chart.ChartViewFieldDTO
;
import
io.dataease.dto.chart.ChartViewFieldDTO
;
import
io.dataease.dto.sqlObj.SQLObj
;
import
io.dataease.dto.sqlObj.SQLObj
;
import
io.dataease.provider.QueryProvider
;
import
io.dataease.provider.QueryProvider
;
import
io.dataease.provider.SQLConstants
;
import
io.dataease.provider.SQLConstants
;
import
io.dataease.provider.mysql.MySQLConstants
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
@@ -112,7 +111,7 @@ public class OracleQueryProvider extends QueryProvider {
...
@@ -112,7 +111,7 @@ public class OracleQueryProvider extends QueryProvider {
public
void
setSchema
(
SQLObj
tableObj
,
Datasource
ds
){
public
void
setSchema
(
SQLObj
tableObj
,
Datasource
ds
){
if
(
ds
!=
null
&&
!
tableObj
.
getTableName
().
startsWith
(
"("
)
&&
!
tableObj
.
getTableName
().
endsWith
(
")"
)){
if
(
ds
!=
null
&&
!
tableObj
.
getTableName
().
startsWith
(
"("
)
&&
!
tableObj
.
getTableName
().
endsWith
(
")"
)){
String
schema
=
new
Gson
().
fromJson
(
ds
.
getConfiguration
(),
Jdbc
DTO
.
class
).
getSchema
();
String
schema
=
new
Gson
().
fromJson
(
ds
.
getConfiguration
(),
Jdbc
Configuration
.
class
).
getSchema
();
schema
=
String
.
format
(
OracleConstants
.
KEYWORD_TABLE
,
schema
);
schema
=
String
.
format
(
OracleConstants
.
KEYWORD_TABLE
,
schema
);
tableObj
.
setTableName
(
schema
+
"."
+
tableObj
.
getTableName
());
tableObj
.
setTableName
(
schema
+
"."
+
tableObj
.
getTableName
());
}
}
...
@@ -203,7 +202,7 @@ public class OracleQueryProvider extends QueryProvider {
...
@@ -203,7 +202,7 @@ public class OracleQueryProvider extends QueryProvider {
@Override
@Override
public
String
createQueryTableWithLimit
(
String
table
,
List
<
DatasetTableField
>
fields
,
Integer
limit
,
boolean
isGroup
,
Datasource
ds
)
{
public
String
createQueryTableWithLimit
(
String
table
,
List
<
DatasetTableField
>
fields
,
Integer
limit
,
boolean
isGroup
,
Datasource
ds
)
{
String
schema
=
new
Gson
().
fromJson
(
ds
.
getConfiguration
(),
Jdbc
DTO
.
class
).
getSchema
();
String
schema
=
new
Gson
().
fromJson
(
ds
.
getConfiguration
(),
Jdbc
Configuration
.
class
).
getSchema
();
return
String
.
format
(
"SELECT * from %s WHERE rownum <= %s "
,
schema
+
"."
+
String
.
format
(
OracleConstants
.
KEYWORD_TABLE
,
table
),
limit
.
toString
());
return
String
.
format
(
"SELECT * from %s WHERE rownum <= %s "
,
schema
+
"."
+
String
.
format
(
OracleConstants
.
KEYWORD_TABLE
,
table
),
limit
.
toString
());
}
}
...
@@ -730,8 +729,8 @@ public class OracleQueryProvider extends QueryProvider {
...
@@ -730,8 +729,8 @@ public class OracleQueryProvider extends QueryProvider {
stringBuilder
.
append
(
" \""
).
append
(
f
.
getOriginName
()).
append
(
"\""
);
stringBuilder
.
append
(
" \""
).
append
(
f
.
getOriginName
()).
append
(
"\""
);
return
stringBuilder
.
toString
();
return
stringBuilder
.
toString
();
}).
toArray
(
String
[]::
new
);
}).
toArray
(
String
[]::
new
);
OracleConfig
ration
oracleConfigration
=
new
Gson
().
fromJson
(
ds
.
getConfiguration
(),
OracleConfig
ration
.
class
);
OracleConfig
uration
oracleConfiguration
=
new
Gson
().
fromJson
(
ds
.
getConfiguration
(),
OracleConfigu
ration
.
class
);
return
MessageFormat
.
format
(
"SELECT {0} FROM {1}"
,
StringUtils
.
join
(
array
,
","
),
oracleConfigration
.
getSchema
()
+
".\""
+
table
+
"\""
);
return
MessageFormat
.
format
(
"SELECT {0} FROM {1}"
,
StringUtils
.
join
(
array
,
","
),
oracleConfig
u
ration
.
getSchema
()
+
".\""
+
table
+
"\""
);
}
}
@Override
@Override
...
@@ -746,7 +745,7 @@ public class OracleQueryProvider extends QueryProvider {
...
@@ -746,7 +745,7 @@ public class OracleQueryProvider extends QueryProvider {
@Override
@Override
public
String
convertTableToSql
(
String
tableName
,
Datasource
ds
){
public
String
convertTableToSql
(
String
tableName
,
Datasource
ds
){
String
schema
=
new
Gson
().
fromJson
(
ds
.
getConfiguration
(),
Jdbc
DTO
.
class
).
getSchema
();
String
schema
=
new
Gson
().
fromJson
(
ds
.
getConfiguration
(),
Jdbc
Configuration
.
class
).
getSchema
();
schema
=
String
.
format
(
OracleConstants
.
KEYWORD_TABLE
,
schema
);
schema
=
String
.
format
(
OracleConstants
.
KEYWORD_TABLE
,
schema
);
return
createSQLPreview
(
"SELECT * FROM "
+
schema
+
"."
+
String
.
format
(
OracleConstants
.
KEYWORD_TABLE
,
tableName
),
null
);
return
createSQLPreview
(
"SELECT * FROM "
+
schema
+
"."
+
String
.
format
(
OracleConstants
.
KEYWORD_TABLE
,
tableName
),
null
);
}
}
...
...
backend/src/main/java/io/dataease/provider/pg/PgQueryProvider.java
浏览文件 @
7db17563
...
@@ -7,14 +7,12 @@ import io.dataease.base.domain.Datasource;
...
@@ -7,14 +7,12 @@ import io.dataease.base.domain.Datasource;
import
io.dataease.base.mapper.DatasetTableFieldMapper
;
import
io.dataease.base.mapper.DatasetTableFieldMapper
;
import
io.dataease.commons.constants.DeTypeConstants
;
import
io.dataease.commons.constants.DeTypeConstants
;
import
io.dataease.controller.request.chart.ChartExtFilterRequest
;
import
io.dataease.controller.request.chart.ChartExtFilterRequest
;
import
io.dataease.datasource.dto.Jdbc
DTO
;
import
io.dataease.datasource.dto.Jdbc
Configuration
;
import
io.dataease.dto.chart.ChartCustomFilterDTO
;
import
io.dataease.dto.chart.ChartCustomFilterDTO
;
import
io.dataease.dto.chart.ChartViewFieldDTO
;
import
io.dataease.dto.chart.ChartViewFieldDTO
;
import
io.dataease.dto.sqlObj.SQLObj
;
import
io.dataease.dto.sqlObj.SQLObj
;
import
io.dataease.provider.QueryProvider
;
import
io.dataease.provider.QueryProvider
;
import
io.dataease.provider.SQLConstants
;
import
io.dataease.provider.SQLConstants
;
import
io.dataease.provider.mysql.MySQLConstants
;
import
io.dataease.provider.oracle.OracleConstants
;
import
io.dataease.provider.sqlserver.SqlServerSQLConstants
;
import
io.dataease.provider.sqlserver.SqlServerSQLConstants
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
...
@@ -709,7 +707,7 @@ public class PgQueryProvider extends QueryProvider {
...
@@ -709,7 +707,7 @@ public class PgQueryProvider extends QueryProvider {
return
stringBuilder
.
toString
();
return
stringBuilder
.
toString
();
}).
toArray
(
String
[]::
new
);
}).
toArray
(
String
[]::
new
);
if
(
ds
!=
null
)
{
if
(
ds
!=
null
)
{
String
schema
=
new
Gson
().
fromJson
(
ds
.
getConfiguration
(),
Jdbc
DTO
.
class
).
getSchema
();
String
schema
=
new
Gson
().
fromJson
(
ds
.
getConfiguration
(),
Jdbc
Configuration
.
class
).
getSchema
();
String
tableWithSchema
=
String
.
format
(
SqlServerSQLConstants
.
KEYWORD_TABLE
,
schema
)
+
"."
+
String
.
format
(
SqlServerSQLConstants
.
KEYWORD_TABLE
,
table
);
String
tableWithSchema
=
String
.
format
(
SqlServerSQLConstants
.
KEYWORD_TABLE
,
schema
)
+
"."
+
String
.
format
(
SqlServerSQLConstants
.
KEYWORD_TABLE
,
table
);
return
MessageFormat
.
format
(
"SELECT {0} FROM {1} "
,
StringUtils
.
join
(
array
,
","
),
tableWithSchema
);
return
MessageFormat
.
format
(
"SELECT {0} FROM {1} "
,
StringUtils
.
join
(
array
,
","
),
tableWithSchema
);
}
else
{
}
else
{
...
@@ -724,7 +722,7 @@ public class PgQueryProvider extends QueryProvider {
...
@@ -724,7 +722,7 @@ public class PgQueryProvider extends QueryProvider {
@Override
@Override
public
String
convertTableToSql
(
String
tableName
,
Datasource
ds
){
public
String
convertTableToSql
(
String
tableName
,
Datasource
ds
){
String
schema
=
new
Gson
().
fromJson
(
ds
.
getConfiguration
(),
Jdbc
DTO
.
class
).
getSchema
();
String
schema
=
new
Gson
().
fromJson
(
ds
.
getConfiguration
(),
Jdbc
Configuration
.
class
).
getSchema
();
schema
=
String
.
format
(
PgConstants
.
KEYWORD_TABLE
,
schema
);
schema
=
String
.
format
(
PgConstants
.
KEYWORD_TABLE
,
schema
);
return
createSQLPreview
(
"SELECT * FROM "
+
schema
+
"."
+
String
.
format
(
PgConstants
.
KEYWORD_TABLE
,
tableName
),
null
);
return
createSQLPreview
(
"SELECT * FROM "
+
schema
+
"."
+
String
.
format
(
PgConstants
.
KEYWORD_TABLE
,
tableName
),
null
);
}
}
...
...
backend/src/main/java/io/dataease/provider/sqlserver/SqlserverQueryProvider.java
浏览文件 @
7db17563
...
@@ -7,15 +7,12 @@ import io.dataease.base.domain.Datasource;
...
@@ -7,15 +7,12 @@ import io.dataease.base.domain.Datasource;
import
io.dataease.base.mapper.DatasetTableFieldMapper
;
import
io.dataease.base.mapper.DatasetTableFieldMapper
;
import
io.dataease.commons.constants.DeTypeConstants
;
import
io.dataease.commons.constants.DeTypeConstants
;
import
io.dataease.controller.request.chart.ChartExtFilterRequest
;
import
io.dataease.controller.request.chart.ChartExtFilterRequest
;
import
io.dataease.datasource.dto.JdbcDTO
;
import
io.dataease.datasource.dto.JdbcConfiguration
;
import
io.dataease.datasource.dto.SqlServerConfigration
;
import
io.dataease.dto.chart.ChartCustomFilterDTO
;
import
io.dataease.dto.chart.ChartCustomFilterDTO
;
import
io.dataease.dto.chart.ChartViewFieldDTO
;
import
io.dataease.dto.chart.ChartViewFieldDTO
;
import
io.dataease.dto.sqlObj.SQLObj
;
import
io.dataease.dto.sqlObj.SQLObj
;
import
io.dataease.provider.QueryProvider
;
import
io.dataease.provider.QueryProvider
;
import
io.dataease.provider.SQLConstants
;
import
io.dataease.provider.SQLConstants
;
import
io.dataease.provider.oracle.OracleConstants
;
import
io.dataease.provider.pg.PgConstants
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
@@ -159,7 +156,7 @@ public class SqlserverQueryProvider extends QueryProvider {
...
@@ -159,7 +156,7 @@ public class SqlserverQueryProvider extends QueryProvider {
@Override
@Override
public
String
createQueryTableWithLimit
(
String
table
,
List
<
DatasetTableField
>
fields
,
Integer
limit
,
boolean
isGroup
,
Datasource
ds
)
{
public
String
createQueryTableWithLimit
(
String
table
,
List
<
DatasetTableField
>
fields
,
Integer
limit
,
boolean
isGroup
,
Datasource
ds
)
{
String
schema
=
new
Gson
().
fromJson
(
ds
.
getConfiguration
(),
Jdbc
DTO
.
class
).
getSchema
();
String
schema
=
new
Gson
().
fromJson
(
ds
.
getConfiguration
(),
Jdbc
Configuration
.
class
).
getSchema
();
return
String
.
format
(
"SELECT top %s * from %s "
,
limit
.
toString
(),
schema
+
"."
+
table
);
return
String
.
format
(
"SELECT top %s * from %s "
,
limit
.
toString
(),
schema
+
"."
+
table
);
}
}
...
@@ -666,7 +663,7 @@ public class SqlserverQueryProvider extends QueryProvider {
...
@@ -666,7 +663,7 @@ public class SqlserverQueryProvider extends QueryProvider {
return
stringBuilder
.
toString
();
return
stringBuilder
.
toString
();
}).
toArray
(
String
[]::
new
);
}).
toArray
(
String
[]::
new
);
if
(
ds
!=
null
)
{
if
(
ds
!=
null
)
{
String
schema
=
new
Gson
().
fromJson
(
ds
.
getConfiguration
(),
Jdbc
DTO
.
class
).
getSchema
();
String
schema
=
new
Gson
().
fromJson
(
ds
.
getConfiguration
(),
Jdbc
Configuration
.
class
).
getSchema
();
String
tableWithSchema
=
String
.
format
(
SqlServerSQLConstants
.
KEYWORD_TABLE
,
schema
)
+
"."
+
String
.
format
(
SqlServerSQLConstants
.
KEYWORD_TABLE
,
table
);
String
tableWithSchema
=
String
.
format
(
SqlServerSQLConstants
.
KEYWORD_TABLE
,
schema
)
+
"."
+
String
.
format
(
SqlServerSQLConstants
.
KEYWORD_TABLE
,
table
);
return
MessageFormat
.
format
(
"SELECT {0} FROM {1} "
,
StringUtils
.
join
(
array
,
","
),
tableWithSchema
);
return
MessageFormat
.
format
(
"SELECT {0} FROM {1} "
,
StringUtils
.
join
(
array
,
","
),
tableWithSchema
);
}
else
{
}
else
{
...
@@ -681,7 +678,7 @@ public class SqlserverQueryProvider extends QueryProvider {
...
@@ -681,7 +678,7 @@ public class SqlserverQueryProvider extends QueryProvider {
@Override
@Override
public
String
convertTableToSql
(
String
tableName
,
Datasource
ds
){
public
String
convertTableToSql
(
String
tableName
,
Datasource
ds
){
String
schema
=
new
Gson
().
fromJson
(
ds
.
getConfiguration
(),
Jdbc
DTO
.
class
).
getSchema
();
String
schema
=
new
Gson
().
fromJson
(
ds
.
getConfiguration
(),
Jdbc
Configuration
.
class
).
getSchema
();
schema
=
String
.
format
(
SqlServerSQLConstants
.
KEYWORD_TABLE
,
schema
);
schema
=
String
.
format
(
SqlServerSQLConstants
.
KEYWORD_TABLE
,
schema
);
return
createSQLPreview
(
"SELECT * FROM "
+
schema
+
"."
+
String
.
format
(
SqlServerSQLConstants
.
KEYWORD_TABLE
,
tableName
),
null
);
return
createSQLPreview
(
"SELECT * FROM "
+
schema
+
"."
+
String
.
format
(
SqlServerSQLConstants
.
KEYWORD_TABLE
,
tableName
),
null
);
}
}
...
...
backend/src/main/java/io/dataease/service/dataset/ExtractDataService.java
浏览文件 @
7db17563
差异被折叠。
点击展开。
frontend/src/views/system/datasource/form.vue
浏览文件 @
7db17563
...
@@ -278,6 +278,10 @@ export default {
...
@@ -278,6 +278,10 @@ export default {
this
.
$message
.
error
(
this
.
$t
(
'datasource.please_choose_schema'
))
this
.
$message
.
error
(
this
.
$t
(
'datasource.please_choose_schema'
))
return
return
}
}
if
(
this
.
form
.
configuration
.
dataSourceType
===
'jdbc'
&&
this
.
form
.
configuration
.
port
<=
0
)
{
this
.
$message
.
error
(
this
.
$t
(
'datasource.port_no_less_then_0'
))
return
}
this
.
$refs
.
dsForm
.
validate
(
valid
=>
{
this
.
$refs
.
dsForm
.
validate
(
valid
=>
{
if
(
valid
)
{
if
(
valid
)
{
const
data
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
form
))
const
data
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
form
))
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论