mirror of
https://github.com/dataease/dataease.git
synced 2026-05-20 19:48:18 +08:00
feat:非直连数据集做校验;前端登陆样式fix 测试;不同用户创建db类型数据集可以选择相同表
This commit is contained in:
@@ -34,7 +34,7 @@ public class DataSetTableController {
|
||||
}
|
||||
|
||||
@PostMapping("delete/{id}")
|
||||
public void delete(@PathVariable String id)throws Exception {
|
||||
public void delete(@PathVariable String id) throws Exception {
|
||||
dataSetTableService.delete(id);
|
||||
}
|
||||
|
||||
@@ -92,4 +92,9 @@ public class DataSetTableController {
|
||||
public Map<String, Object> excelUpload(@RequestParam("file") MultipartFile file) throws Exception {
|
||||
return dataSetTableService.excelSaveAndParse(file);
|
||||
}
|
||||
|
||||
@PostMapping("checkDorisTableIsExists/{id}")
|
||||
public Boolean checkDorisTableIsExists(@PathVariable String id) throws Exception {
|
||||
return dataSetTableService.checkDorisTableIsExists(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import io.dataease.base.mapper.*;
|
||||
import io.dataease.base.mapper.ext.ExtDataSourceMapper;
|
||||
import io.dataease.base.mapper.ext.query.GridExample;
|
||||
import io.dataease.commons.exception.DEException;
|
||||
import io.dataease.commons.utils.AuthUtils;
|
||||
import io.dataease.commons.utils.CommonThreadPool;
|
||||
import io.dataease.controller.sys.base.BaseGridRequest;
|
||||
import io.dataease.datasource.dto.DBTableDTO;
|
||||
@@ -108,7 +109,7 @@ public class DatasourceService {
|
||||
dbTableDTO.setDatasetPath(null);
|
||||
for (DatasetTable datasetTable : datasetTables) {
|
||||
DataTableInfoDTO dataTableInfoDTO = new Gson().fromJson(datasetTable.getInfo(), DataTableInfoDTO.class);
|
||||
if (StringUtils.equals(name, dataTableInfoDTO.getTable())) {
|
||||
if (StringUtils.equals(name, dataTableInfoDTO.getTable()) && StringUtils.equals(datasetTable.getCreateBy(), AuthUtils.getUser().getUsername())) {
|
||||
dbTableDTO.setEnableCheck(false);
|
||||
|
||||
List<DatasetGroup> parents = dataSetGroupService.getParents(datasetTable.getSceneId());
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.List;
|
||||
* @Date 2021/5/17 2:42 下午
|
||||
*/
|
||||
public abstract class QueryProvider {
|
||||
public abstract Integer transFieldType( String field);
|
||||
public abstract Integer transFieldType(String field);
|
||||
|
||||
public abstract String createQueryCountSQL(String table);
|
||||
|
||||
@@ -30,4 +30,6 @@ public abstract class QueryProvider {
|
||||
public abstract String getSQL(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartExtFilterRequest> extFilterRequestList);
|
||||
|
||||
public abstract String getSQLAsTmp(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartExtFilterRequest> extFilterRequestList);
|
||||
|
||||
public abstract String searchTable(String table);
|
||||
}
|
||||
|
||||
@@ -224,6 +224,11 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
return getSQL(" (" + sql + ") AS tmp ", xAxis, yAxis, extFilterRequestList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String searchTable(String table) {
|
||||
return "SELECT table_name FROM information_schema.TABLES WHERE table_name ='" + table + "'";
|
||||
}
|
||||
|
||||
public String transMysqlFilterTerm(String term) {
|
||||
switch (term) {
|
||||
case "eq":
|
||||
|
||||
@@ -231,6 +231,11 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
return getSQL(" (" + sql + ") AS tmp ", xAxis, yAxis, extFilterRequestList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String searchTable(String table) {
|
||||
return "SELECT table_name FROM information_schema.TABLES WHERE table_name ='" + table + "'";
|
||||
}
|
||||
|
||||
public String transMysqlFilterTerm(String term) {
|
||||
switch (term) {
|
||||
case "eq":
|
||||
|
||||
@@ -788,4 +788,15 @@ public class DataSetTableService {
|
||||
fileOutputStream.close();
|
||||
return filePath;
|
||||
}
|
||||
|
||||
public Boolean checkDorisTableIsExists(String id) throws Exception {
|
||||
Datasource dorisDatasource = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
|
||||
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);
|
||||
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
||||
datasourceRequest.setDatasource(dorisDatasource);
|
||||
QueryProvider qp = ProviderFactory.getQueryProvider(dorisDatasource.getType());
|
||||
datasourceRequest.setQuery(qp.searchTable(DorisTableUtils.dorisName(id)));
|
||||
List<String[]> data = jdbcProvider.getData(datasourceRequest);
|
||||
return CollectionUtils.isNotEmpty(data);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user