Merge pull request #13608 from dataease/pr@dev-v2@fixds
Pr@dev v2@fixds
This commit is contained in:
commit
bad0dbf75c
@ -672,6 +672,9 @@ public class DatasourceServer implements DatasourceApi {
|
|||||||
@Override
|
@Override
|
||||||
public List<DatasetTableDTO> getTables(DatasetTableDTO datasetTableDTO) throws DEException {
|
public List<DatasetTableDTO> getTables(DatasetTableDTO datasetTableDTO) throws DEException {
|
||||||
CoreDatasource coreDatasource = datasourceMapper.selectById(datasetTableDTO.getDatasourceId());
|
CoreDatasource coreDatasource = datasourceMapper.selectById(datasetTableDTO.getDatasourceId());
|
||||||
|
if (coreDatasource == null) {
|
||||||
|
DEException.throwException("无效数据源!");
|
||||||
|
}
|
||||||
DatasourceDTO datasourceDTO = new DatasourceDTO();
|
DatasourceDTO datasourceDTO = new DatasourceDTO();
|
||||||
BeanUtils.copyBean(datasourceDTO, coreDatasource);
|
BeanUtils.copyBean(datasourceDTO, coreDatasource);
|
||||||
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
||||||
@ -698,6 +701,11 @@ public class DatasourceServer implements DatasourceApi {
|
|||||||
public List<TableField> getTableField(Map<String, String> req) throws DEException {
|
public List<TableField> getTableField(Map<String, String> req) throws DEException {
|
||||||
String tableName = req.get("tableName");
|
String tableName = req.get("tableName");
|
||||||
String datasourceId = req.get("datasourceId");
|
String datasourceId = req.get("datasourceId");
|
||||||
|
DatasetTableDTO datasetTableDTO = new DatasetTableDTO();
|
||||||
|
datasetTableDTO.setDatasourceId(Long.valueOf(datasourceId));
|
||||||
|
if (!getTables(datasetTableDTO).stream().map(DatasetTableDTO::getTableName).collect(Collectors.toList()).contains("tableName")) {
|
||||||
|
DEException.throwException("无效的表名!");
|
||||||
|
}
|
||||||
CoreDatasource coreDatasource = datasourceMapper.selectById(datasourceId);
|
CoreDatasource coreDatasource = datasourceMapper.selectById(datasourceId);
|
||||||
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
||||||
datasourceRequest.setDatasource(transDTO(coreDatasource));
|
datasourceRequest.setDatasource(transDTO(coreDatasource));
|
||||||
|
|||||||
@ -20,6 +20,11 @@ public class Mysql extends DatasourceConfiguration {
|
|||||||
|
|
||||||
public String getJdbc() {
|
public String getJdbc() {
|
||||||
if(StringUtils.isNoneEmpty(getUrlType()) && !getUrlType().equalsIgnoreCase("hostName")){
|
if(StringUtils.isNoneEmpty(getUrlType()) && !getUrlType().equalsIgnoreCase("hostName")){
|
||||||
|
for (String illegalParameter : illegalParameters) {
|
||||||
|
if (getJdbcUrl().toLowerCase().contains(illegalParameter.toLowerCase()) || URLDecoder.decode(getExtraParams()).contains(illegalParameter.toLowerCase())) {
|
||||||
|
DEException.throwException("Illegal parameter: " + illegalParameter);
|
||||||
|
}
|
||||||
|
}
|
||||||
return getJdbcUrl();
|
return getJdbcUrl();
|
||||||
}
|
}
|
||||||
if (StringUtils.isEmpty(extraParams.trim())) {
|
if (StringUtils.isEmpty(extraParams.trim())) {
|
||||||
|
|||||||
@ -919,25 +919,29 @@ const handleClick = (tabName: TabPaneName) => {
|
|||||||
switch (tabName) {
|
switch (tabName) {
|
||||||
case 'config':
|
case 'config':
|
||||||
tableData.value = []
|
tableData.value = []
|
||||||
listDatasourceTables({ datasourceId: nodeInfo.id }).then(res => {
|
if (nodeInfo.type === 'Excel') {
|
||||||
tabList.value = res.data.map(ele => {
|
listDatasourceTables({ datasourceId: nodeInfo.id }).then(res => {
|
||||||
const { name, tableName } = ele
|
tabList.value = res.data.map(ele => {
|
||||||
return {
|
const { name, tableName } = ele
|
||||||
value: name,
|
return {
|
||||||
label: tableName
|
value: name,
|
||||||
}
|
label: tableName
|
||||||
})
|
}
|
||||||
if (!!tabList.value.length && !activeTab.value) {
|
})
|
||||||
activeTab.value = tabList.value[0].value
|
if (!!tabList.value.length && !activeTab.value) {
|
||||||
if (nodeInfo.type === 'Excel') {
|
activeTab.value = tabList.value[0].value
|
||||||
handleTabClick(activeTab)
|
handleTabClick(activeTab)
|
||||||
}
|
}
|
||||||
}
|
tableData.value = res.data
|
||||||
tableData.value = res.data
|
})
|
||||||
})
|
}
|
||||||
break
|
break
|
||||||
case 'table':
|
case 'table':
|
||||||
initSearch()
|
tableData.value = []
|
||||||
|
listDatasourceTables({ datasourceId: nodeInfo.id }).then(res => {
|
||||||
|
tableData.value = res.data
|
||||||
|
initSearch()
|
||||||
|
})
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user