Merge pull request #7761 from dataease/pr@dev@fixSql
feat: 定时同步任务支持在历史数据变动后增量更新到doris中 #6276
This commit is contained in:
commit
11e0da0351
@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
|
|||||||
import com.auth0.jwt.JWT;
|
import com.auth0.jwt.JWT;
|
||||||
import com.auth0.jwt.interfaces.DecodedJWT;
|
import com.auth0.jwt.interfaces.DecodedJWT;
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||||
|
import com.google.gson.Gson;
|
||||||
import io.dataease.auth.annotation.DePermission;
|
import io.dataease.auth.annotation.DePermission;
|
||||||
import io.dataease.auth.annotation.DePermissions;
|
import io.dataease.auth.annotation.DePermissions;
|
||||||
import io.dataease.auth.filter.F2CLinkFilter;
|
import io.dataease.auth.filter.F2CLinkFilter;
|
||||||
@ -12,6 +13,7 @@ import io.dataease.commons.constants.ResourceAuthLevel;
|
|||||||
import io.dataease.controller.request.dataset.DataSetTableRequest;
|
import io.dataease.controller.request.dataset.DataSetTableRequest;
|
||||||
import io.dataease.controller.request.dataset.MultFieldValuesRequest;
|
import io.dataease.controller.request.dataset.MultFieldValuesRequest;
|
||||||
import io.dataease.controller.response.DatasetTableField4Type;
|
import io.dataease.controller.response.DatasetTableField4Type;
|
||||||
|
import io.dataease.dto.dataset.DataTableInfoDTO;
|
||||||
import io.dataease.dto.dataset.DatasetTableFieldDTO;
|
import io.dataease.dto.dataset.DatasetTableFieldDTO;
|
||||||
import io.dataease.i18n.Translator;
|
import io.dataease.i18n.Translator;
|
||||||
import io.dataease.plugins.common.base.domain.DatasetTable;
|
import io.dataease.plugins.common.base.domain.DatasetTable;
|
||||||
@ -108,6 +110,8 @@ public class DataSetTableFieldController {
|
|||||||
DatasetTableField datasetTableField = DatasetTableField.builder().build();
|
DatasetTableField datasetTableField = DatasetTableField.builder().build();
|
||||||
datasetTableField.setTableId(tableId);
|
datasetTableField.setTableId(tableId);
|
||||||
datasetTableField.setGroupType("d");
|
datasetTableField.setGroupType("d");
|
||||||
|
DatasetTable datasetTable = dataSetTableService.get(tableId);
|
||||||
|
DataTableInfoDTO dataTableInfoDTO = new Gson().fromJson(datasetTable.getInfo(), DataTableInfoDTO.class);
|
||||||
List<DatasetTableFieldDTO> dimensionList = new ArrayList<>();
|
List<DatasetTableFieldDTO> dimensionList = new ArrayList<>();
|
||||||
dataSetTableFieldsService.list(datasetTableField).forEach(o -> {
|
dataSetTableFieldsService.list(datasetTableField).forEach(o -> {
|
||||||
DatasetTableFieldDTO datasetTableFieldDTO = new DatasetTableFieldDTO();
|
DatasetTableFieldDTO datasetTableFieldDTO = new DatasetTableFieldDTO();
|
||||||
@ -118,6 +122,9 @@ public class DataSetTableFieldController {
|
|||||||
deTypeCascader.add(datasetTableFieldDTO.getDateFormatType());
|
deTypeCascader.add(datasetTableFieldDTO.getDateFormatType());
|
||||||
}
|
}
|
||||||
datasetTableFieldDTO.setDeTypeCascader(deTypeCascader);
|
datasetTableFieldDTO.setDeTypeCascader(deTypeCascader);
|
||||||
|
if (dataTableInfoDTO.isSetKey() && dataTableInfoDTO.getKeys().contains(datasetTableFieldDTO.getOriginName())){
|
||||||
|
datasetTableFieldDTO.setKey(true);
|
||||||
|
}
|
||||||
dimensionList.add(datasetTableFieldDTO);
|
dimensionList.add(datasetTableFieldDTO);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -133,6 +140,9 @@ public class DataSetTableFieldController {
|
|||||||
deTypeCascader.add(datasetTableFieldDTO.getDateFormatType());
|
deTypeCascader.add(datasetTableFieldDTO.getDateFormatType());
|
||||||
}
|
}
|
||||||
datasetTableFieldDTO.setDeTypeCascader(deTypeCascader);
|
datasetTableFieldDTO.setDeTypeCascader(deTypeCascader);
|
||||||
|
if (dataTableInfoDTO.isSetKey() && dataTableInfoDTO.getKeys().contains(datasetTableFieldDTO.getOriginName())){
|
||||||
|
datasetTableFieldDTO.setKey(true);
|
||||||
|
}
|
||||||
quotaList.add(datasetTableFieldDTO);
|
quotaList.add(datasetTableFieldDTO);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -187,6 +197,16 @@ public class DataSetTableFieldController {
|
|||||||
return dataSetTableFieldsService.save(datasetTableField);
|
return dataSetTableFieldsService.save(datasetTableField);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DePermission(type = DePermissionType.DATASET, value = "tableId", level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
|
||||||
|
@ApiOperation("设置主键")
|
||||||
|
@PostMapping("saveKey")
|
||||||
|
public void saveKey(@RequestBody DatasetTableFieldDTO datasetTableField) throws Exception {
|
||||||
|
DatasetTable datasetTable = dataSetTableService.get(datasetTableField.getTableId());
|
||||||
|
if (datasetTable.getMode() == 1) {
|
||||||
|
dataSetTableService.saveKey(datasetTable, datasetTableField);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@DePermissions(value = {
|
@DePermissions(value = {
|
||||||
@DePermission(type = DePermissionType.DATASET, level = ResourceAuthLevel.DATASET_LEVEL_MANAGE, paramIndex = 1)
|
@DePermission(type = DePermissionType.DATASET, level = ResourceAuthLevel.DATASET_LEVEL_MANAGE, paramIndex = 1)
|
||||||
})
|
})
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import io.dataease.dto.dataset.union.UnionDTO;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -14,6 +15,8 @@ import java.util.List;
|
|||||||
@Getter
|
@Getter
|
||||||
public class DataTableInfoDTO {
|
public class DataTableInfoDTO {
|
||||||
private String table;
|
private String table;
|
||||||
|
private boolean setKey = false;
|
||||||
|
private List<String> keys = new ArrayList<>();
|
||||||
private String sql;
|
private String sql;
|
||||||
private boolean isBase64Encryption = false;
|
private boolean isBase64Encryption = false;
|
||||||
private List<ExcelSheetData> excelSheetDataList;
|
private List<ExcelSheetData> excelSheetDataList;
|
||||||
|
|||||||
@ -9,4 +9,5 @@ import java.util.List;
|
|||||||
public class DatasetTableFieldDTO extends DatasetTableField {
|
public class DatasetTableFieldDTO extends DatasetTableField {
|
||||||
private String jsonPath;
|
private String jsonPath;
|
||||||
private List<Object> deTypeCascader;
|
private List<Object> deTypeCascader;
|
||||||
|
private boolean isKey;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,8 @@ package io.dataease.dto.dataset;
|
|||||||
import io.dataease.plugins.common.dto.datasource.TableField;
|
import io.dataease.plugins.common.dto.datasource.TableField;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -31,4 +33,6 @@ public class ExcelSheetData {
|
|||||||
@ApiModelProperty("字段变更")
|
@ApiModelProperty("字段变更")
|
||||||
private Boolean changeFiled = false;
|
private Boolean changeFiled = false;
|
||||||
private Boolean effectExtField = false;
|
private Boolean effectExtField = false;
|
||||||
|
private boolean setKey = false;
|
||||||
|
private List<String> keys = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package io.dataease.provider;
|
package io.dataease.provider;
|
||||||
|
|
||||||
|
import io.dataease.dto.dataset.DataTableInfoDTO;
|
||||||
import io.dataease.plugins.common.base.domain.DatasetTableField;
|
import io.dataease.plugins.common.base.domain.DatasetTableField;
|
||||||
import io.dataease.plugins.common.base.domain.Datasource;
|
import io.dataease.plugins.common.base.domain.Datasource;
|
||||||
|
|
||||||
@ -18,7 +19,7 @@ public abstract class DDLProvider {
|
|||||||
|
|
||||||
public abstract String replaceTable(String name);
|
public abstract String replaceTable(String name);
|
||||||
|
|
||||||
public abstract String createTableSql(String name, List<DatasetTableField> datasetTableFields, Datasource engine, String version);
|
public abstract String createTableSql(DataTableInfoDTO dataTableInfoDTO, String name, List<DatasetTableField> datasetTableFields, Datasource engine, String version);
|
||||||
|
|
||||||
public abstract String insertSql(String name, List<String[]> dataList, int page, int pageNumber);
|
public abstract String insertSql(String name, List<String[]> dataList, int page, int pageNumber);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package io.dataease.provider;
|
package io.dataease.provider;
|
||||||
|
|
||||||
|
import io.dataease.dto.dataset.DataTableInfoDTO;
|
||||||
import io.dataease.plugins.common.base.domain.DatasetTableField;
|
import io.dataease.plugins.common.base.domain.DatasetTableField;
|
||||||
import io.dataease.plugins.common.base.domain.Datasource;
|
import io.dataease.plugins.common.base.domain.Datasource;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@ -30,7 +31,7 @@ public class DDLProviderImpl extends DDLProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String createTableSql(String name, List<DatasetTableField> datasetTableFields, Datasource engine, String version) {
|
public String createTableSql(DataTableInfoDTO dataTableInfoDTO, String name, List<DatasetTableField> datasetTableFields, Datasource engine, String version) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
package io.dataease.provider.engine.doris;
|
package io.dataease.provider.engine.doris;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
import io.dataease.dto.dataset.DataTableInfoDTO;
|
||||||
import io.dataease.plugins.common.base.domain.DatasetTableField;
|
import io.dataease.plugins.common.base.domain.DatasetTableField;
|
||||||
import io.dataease.plugins.common.base.domain.Datasource;
|
import io.dataease.plugins.common.base.domain.Datasource;
|
||||||
import io.dataease.commons.utils.TableUtils;
|
import io.dataease.commons.utils.TableUtils;
|
||||||
import io.dataease.dto.datasource.DorisConfiguration;
|
import io.dataease.dto.datasource.DorisConfiguration;
|
||||||
import io.dataease.provider.DDLProviderImpl;
|
import io.dataease.provider.DDLProviderImpl;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -44,12 +46,16 @@ public class DorisDDLProvider extends DDLProviderImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String createTableSql(String tableName, List<DatasetTableField> datasetTableFields, Datasource engine, String version) {
|
public String createTableSql(DataTableInfoDTO dataTableInfoDTO, String tableName, List<DatasetTableField> datasetTableFields, Datasource engine, String version) {
|
||||||
DorisConfiguration dorisConfiguration = new Gson().fromJson(engine.getConfiguration(), DorisConfiguration.class);
|
DorisConfiguration dorisConfiguration = new Gson().fromJson(engine.getConfiguration(), DorisConfiguration.class);
|
||||||
String dorisTableColumnSql = createDorisTableColumnSql(datasetTableFields, version);
|
String dorisTableColumnSql = createDorisTableColumnSql(datasetTableFields, version);
|
||||||
return creatTableSql.replace("TABLE_NAME", tableName).replace("Column_Fields", dorisTableColumnSql)
|
String sql = creatTableSql.replace("TABLE_NAME", tableName).replace("Column_Fields", dorisTableColumnSql)
|
||||||
.replace("BUCKETS_NUM", dorisConfiguration.getBucketNum().toString())
|
.replace("BUCKETS_NUM", dorisConfiguration.getBucketNum().toString())
|
||||||
.replace("ReplicationNum", dorisConfiguration.getReplicationNum().toString());
|
.replace("ReplicationNum", dorisConfiguration.getReplicationNum().toString());
|
||||||
|
if(dataTableInfoDTO.isSetKey() && CollectionUtils.isNotEmpty(dataTableInfoDTO.getKeys())){
|
||||||
|
sql = sql.replace("dataease_uuid", "`" + String.join("`, `", dataTableInfoDTO.getKeys()) + "`");
|
||||||
|
}
|
||||||
|
return sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String createDorisTableColumnSql(final List<DatasetTableField> datasetTableFields, String version) {
|
private String createDorisTableColumnSql(final List<DatasetTableField> datasetTableFields, String version) {
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package io.dataease.provider.engine.mysql;
|
package io.dataease.provider.engine.mysql;
|
||||||
|
|
||||||
|
import io.dataease.dto.dataset.DataTableInfoDTO;
|
||||||
import io.dataease.plugins.common.base.domain.DatasetTableField;
|
import io.dataease.plugins.common.base.domain.DatasetTableField;
|
||||||
import io.dataease.plugins.common.base.domain.Datasource;
|
import io.dataease.plugins.common.base.domain.Datasource;
|
||||||
import io.dataease.commons.utils.TableUtils;
|
import io.dataease.commons.utils.TableUtils;
|
||||||
@ -71,7 +72,7 @@ public class MysqlDDLProvider extends DDLProviderImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String createTableSql(String tableName, List<DatasetTableField> datasetTableFields, Datasource engine, String version) {
|
public String createTableSql(DataTableInfoDTO dataTableInfoDTO, String tableName, List<DatasetTableField> datasetTableFields, Datasource engine, String version) {
|
||||||
String dorisTableColumnSql = createDorisTableColumnSql(datasetTableFields);
|
String dorisTableColumnSql = createDorisTableColumnSql(datasetTableFields);
|
||||||
return creatTableSql.replace("TABLE_NAME", tableName).replace("Column_Fields", dorisTableColumnSql);
|
return creatTableSql.replace("TABLE_NAME", tableName).replace("Column_Fields", dorisTableColumnSql);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -179,6 +179,20 @@ public class DataSetTableService {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void saveKey(DatasetTable datasetTable, DatasetTableFieldDTO datasetTableField) {
|
||||||
|
DataTableInfoDTO dt = new Gson().fromJson(datasetTable.getInfo(), DataTableInfoDTO.class);
|
||||||
|
if (datasetTableField.isKey()) {
|
||||||
|
dt.getKeys().add(datasetTableField.getOriginName());
|
||||||
|
} else {
|
||||||
|
dt.getKeys().remove(datasetTableField.getOriginName());
|
||||||
|
}
|
||||||
|
DatasetTable record = new DatasetTable();
|
||||||
|
record.setInfo(new Gson().toJson(dt));
|
||||||
|
DatasetTableExample example = new DatasetTableExample();
|
||||||
|
example.createCriteria().andIdEqualTo(datasetTable.getId());
|
||||||
|
datasetTableMapper.updateByExampleSelective(record, example);
|
||||||
|
}
|
||||||
|
|
||||||
private void extractData(DataSetTableRequest datasetTable) throws Exception {
|
private void extractData(DataSetTableRequest datasetTable) throws Exception {
|
||||||
if (datasetTable.getMode() == 1 && StringUtils.isNotEmpty(datasetTable.getSyncType()) && datasetTable.getSyncType().equalsIgnoreCase("sync_now")) {
|
if (datasetTable.getMode() == 1 && StringUtils.isNotEmpty(datasetTable.getSyncType()) && datasetTable.getSyncType().equalsIgnoreCase("sync_now")) {
|
||||||
DataSetTaskRequest dataSetTaskRequest = new DataSetTaskRequest();
|
DataSetTaskRequest dataSetTaskRequest = new DataSetTaskRequest();
|
||||||
@ -234,6 +248,8 @@ public class DataSetTableService {
|
|||||||
});
|
});
|
||||||
DataTableInfoDTO info = new DataTableInfoDTO();
|
DataTableInfoDTO info = new DataTableInfoDTO();
|
||||||
info.setExcelSheetDataList(excelSheetDataList);
|
info.setExcelSheetDataList(excelSheetDataList);
|
||||||
|
info.setKeys(excelSheetDataList.get(0).getKeys());
|
||||||
|
info.setSetKey(excelSheetDataList.get(0).isSetKey());
|
||||||
sheetTable.setInfo(new Gson().toJson(info));
|
sheetTable.setInfo(new Gson().toJson(info));
|
||||||
datasetTableMapper.insert(sheetTable);
|
datasetTableMapper.insert(sheetTable);
|
||||||
sysAuthService.copyAuth(sheetTable.getId(), SysAuthConstants.AUTH_SOURCE_TYPE_DATASET);
|
sysAuthService.copyAuth(sheetTable.getId(), SysAuthConstants.AUTH_SOURCE_TYPE_DATASET);
|
||||||
@ -263,6 +279,8 @@ public class DataSetTableService {
|
|||||||
excelSheetDataList.add(sheet);
|
excelSheetDataList.add(sheet);
|
||||||
DataTableInfoDTO info = new DataTableInfoDTO();
|
DataTableInfoDTO info = new DataTableInfoDTO();
|
||||||
info.setExcelSheetDataList(excelSheetDataList);
|
info.setExcelSheetDataList(excelSheetDataList);
|
||||||
|
info.setKeys(sheet.getKeys());
|
||||||
|
info.setSetKey(sheet.isSetKey());
|
||||||
sheetTable.setInfo(new Gson().toJson(info));
|
sheetTable.setInfo(new Gson().toJson(info));
|
||||||
datasetTableMapper.insert(sheetTable);
|
datasetTableMapper.insert(sheetTable);
|
||||||
sysAuthService.copyAuth(sheetTable.getId(), SysAuthConstants.AUTH_SOURCE_TYPE_DATASET);
|
sysAuthService.copyAuth(sheetTable.getId(), SysAuthConstants.AUTH_SOURCE_TYPE_DATASET);
|
||||||
@ -296,6 +314,8 @@ public class DataSetTableService {
|
|||||||
excelSheetDataList.add(sheet);
|
excelSheetDataList.add(sheet);
|
||||||
}
|
}
|
||||||
DataTableInfoDTO info = new DataTableInfoDTO();
|
DataTableInfoDTO info = new DataTableInfoDTO();
|
||||||
|
info.setKeys(datasetTable.getSheets().get(0).getKeys());
|
||||||
|
info.setSetKey(datasetTable.getSheets().get(0).isSetKey());
|
||||||
info.setExcelSheetDataList(excelSheetDataList);
|
info.setExcelSheetDataList(excelSheetDataList);
|
||||||
datasetTable.setInfo(new Gson().toJson(info));
|
datasetTable.setInfo(new Gson().toJson(info));
|
||||||
datasetTableMapper.updateByPrimaryKeySelective(datasetTable);
|
datasetTableMapper.updateByPrimaryKeySelective(datasetTable);
|
||||||
|
|||||||
@ -191,8 +191,8 @@ public class ExtractDataService {
|
|||||||
switch (updateType) {
|
switch (updateType) {
|
||||||
case all_scope: // 全量更新
|
case all_scope: // 全量更新
|
||||||
try {
|
try {
|
||||||
createEngineTable(TableUtils.tableName(datasetTableId), datasetTableFields);
|
createEngineTable(datasetTable.getInfo(), TableUtils.tableName(datasetTableId), datasetTableFields);
|
||||||
createEngineTable(TableUtils.tmpName(TableUtils.tableName(datasetTableId)), datasetTableFields);
|
createEngineTable(datasetTable.getInfo(), TableUtils.tmpName(TableUtils.tableName(datasetTableId)), datasetTableFields);
|
||||||
Long execTime = System.currentTimeMillis();
|
Long execTime = System.currentTimeMillis();
|
||||||
if (!engineService.isSimpleMode()) {
|
if (!engineService.isSimpleMode()) {
|
||||||
generateTransFile("all_scope", datasetTable, datasource, datasetTableFields, null);
|
generateTransFile("all_scope", datasetTable, datasource, datasetTableFields, null);
|
||||||
@ -318,8 +318,8 @@ public class ExtractDataService {
|
|||||||
switch (updateType) {
|
switch (updateType) {
|
||||||
case all_scope: // 全量更新
|
case all_scope: // 全量更新
|
||||||
try {
|
try {
|
||||||
createEngineTable(TableUtils.tableName(datasetTableId), datasetTableFields);
|
createEngineTable(datasetTable.getInfo(), TableUtils.tableName(datasetTableId), datasetTableFields);
|
||||||
createEngineTable(TableUtils.tmpName(TableUtils.tableName(datasetTableId)), datasetTableFields);
|
createEngineTable(datasetTable.getInfo(), TableUtils.tmpName(TableUtils.tableName(datasetTableId)), datasetTableFields);
|
||||||
execTime = System.currentTimeMillis();
|
execTime = System.currentTimeMillis();
|
||||||
extractData(datasetTable, datasource, datasetTableFields, "all_scope", null);
|
extractData(datasetTable, datasource, datasetTableFields, "all_scope", null);
|
||||||
replaceTable(TableUtils.tableName(datasetTableId));
|
replaceTable(TableUtils.tableName(datasetTableId));
|
||||||
@ -641,7 +641,8 @@ public class ExtractDataService {
|
|||||||
dataSetTableTaskLogService.save(datasetTableTaskLog, hasTask);
|
dataSetTableTaskLogService.save(datasetTableTaskLog, hasTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createEngineTable(String tableName, List<DatasetTableField> datasetTableFields) throws Exception {
|
public void createEngineTable(String datasetTableInfo, String tableName, List<DatasetTableField> datasetTableFields) throws Exception {
|
||||||
|
DataTableInfoDTO dataTableInfoDTO = new Gson().fromJson(datasetTableInfo, DataTableInfoDTO.class);
|
||||||
Datasource engine = engineService.getDeEngine();
|
Datasource engine = engineService.getDeEngine();
|
||||||
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);
|
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);
|
||||||
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
||||||
@ -649,7 +650,7 @@ public class ExtractDataService {
|
|||||||
datasourceRequest.setQuery("SELECT VERSION()");
|
datasourceRequest.setQuery("SELECT VERSION()");
|
||||||
String version = jdbcProvider.getData(datasourceRequest).get(0)[0];
|
String version = jdbcProvider.getData(datasourceRequest).get(0)[0];
|
||||||
DDLProvider ddlProvider = ProviderFactory.getDDLProvider(engine.getType());
|
DDLProvider ddlProvider = ProviderFactory.getDDLProvider(engine.getType());
|
||||||
datasourceRequest.setQuery(ddlProvider.createTableSql(tableName, datasetTableFields, engine, version));
|
datasourceRequest.setQuery(ddlProvider.createTableSql(dataTableInfoDTO, tableName, datasetTableFields, engine, version));
|
||||||
jdbcProvider.exec(datasourceRequest);
|
jdbcProvider.exec(datasourceRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1323,7 +1324,7 @@ public class ExtractDataService {
|
|||||||
String handleMysqlBIGINTUNSIGNEDStr = "";
|
String handleMysqlBIGINTUNSIGNEDStr = "";
|
||||||
if (datasourceType.equals(DatasourceTypes.mysql)) {
|
if (datasourceType.equals(DatasourceTypes.mysql)) {
|
||||||
for (DatasetTableField datasetTableField : datasetTableFields) {
|
for (DatasetTableField datasetTableField : datasetTableFields) {
|
||||||
if(datasetTableField.getType().equalsIgnoreCase("BIGINT UNSIGNED")){
|
if (datasetTableField.getType().equalsIgnoreCase("BIGINT UNSIGNED")) {
|
||||||
handleMysqlBIGINTUNSIGNEDStr = handleMysqlBIGINTUNSIGNEDStr + handleMysqlBIGINTUNSIGNED.replace("BIGINTUNSIGNEDFIELD", datasetTableField.getDataeaseName()) + "; \n";
|
handleMysqlBIGINTUNSIGNEDStr = handleMysqlBIGINTUNSIGNEDStr + handleMysqlBIGINTUNSIGNED.replace("BIGINTUNSIGNEDFIELD", datasetTableField.getDataeaseName()) + "; \n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -281,7 +281,7 @@ public class PanelAppTemplateService {
|
|||||||
for (DatasetTable datasetTable : datasetTablesInfo) {
|
for (DatasetTable datasetTable : datasetTablesInfo) {
|
||||||
if (1 == datasetTable.getMode() && !(DatasetType.CUSTOM.name().equalsIgnoreCase(datasetTable.getType()) || DatasetType.UNION.name().equalsIgnoreCase(datasetTable.getType()))) {
|
if (1 == datasetTable.getMode() && !(DatasetType.CUSTOM.name().equalsIgnoreCase(datasetTable.getType()) || DatasetType.UNION.name().equalsIgnoreCase(datasetTable.getType()))) {
|
||||||
List<DatasetTableField> fields = extractDataService.getDatasetTableFields(datasetTable.getId());
|
List<DatasetTableField> fields = extractDataService.getDatasetTableFields(datasetTable.getId());
|
||||||
extractDataService.createEngineTable(TableUtils.tableName(datasetTable.getId()), fields);
|
extractDataService.createEngineTable(datasetTable.getInfo(), TableUtils.tableName(datasetTable.getId()), fields);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1874,7 +1874,11 @@ export default {
|
|||||||
tip6: 'Use the functions supported by the database type corresponding to the dataset. The syntax is the same as that of the corresponding database',
|
tip6: 'Use the functions supported by the database type corresponding to the dataset. The syntax is the same as that of the corresponding database',
|
||||||
tip7: 'For example, date format: MySQL uses DATE_ FORMAT(date,format); Oracle uses TO_ DATE(X,[,fmt])',
|
tip7: 'For example, date format: MySQL uses DATE_ FORMAT(date,format); Oracle uses TO_ DATE(X,[,fmt])',
|
||||||
tip8: 'Non direct connection mode data set, use Doris database functions, refer to Doris official website'
|
tip8: 'Non direct connection mode data set, use Doris database functions, refer to Doris official website'
|
||||||
}
|
},
|
||||||
|
set_key: 'Set Primary Key',
|
||||||
|
change_to_key: 'Set as primary key',
|
||||||
|
selecet_key: 'Select primary key',
|
||||||
|
no_set_key: 'No primary key set'
|
||||||
},
|
},
|
||||||
driver: {
|
driver: {
|
||||||
driver: 'Driver',
|
driver: 'Driver',
|
||||||
|
|||||||
@ -1866,7 +1866,11 @@ export default {
|
|||||||
tip6: '使用數據集對應數據庫類型所支持的函數,語法同對應數據庫',
|
tip6: '使用數據集對應數據庫類型所支持的函數,語法同對應數據庫',
|
||||||
tip7: '如日期格式化:MySQL使用DATE_FORMAT(date,format);Oracle使用TO_DATE(X,[,fmt])',
|
tip7: '如日期格式化:MySQL使用DATE_FORMAT(date,format);Oracle使用TO_DATE(X,[,fmt])',
|
||||||
tip8: '非直連模式數據集,使用Doris數據庫函數,可參考Doris官網'
|
tip8: '非直連模式數據集,使用Doris數據庫函數,可參考Doris官網'
|
||||||
}
|
},
|
||||||
|
set_key: '設定主鍵',
|
||||||
|
change_to_key: '設定為主鍵',
|
||||||
|
selecet_key: '選擇主鍵',
|
||||||
|
no_set_key: '未設定主鍵'
|
||||||
},
|
},
|
||||||
driver: {
|
driver: {
|
||||||
driver: '驅動',
|
driver: '驅動',
|
||||||
|
|||||||
@ -1866,7 +1866,11 @@ export default {
|
|||||||
tip6: '使用数据集对应数据库类型所支持的函数,语法同对应数据库',
|
tip6: '使用数据集对应数据库类型所支持的函数,语法同对应数据库',
|
||||||
tip7: '如日期格式化:MySQL使用DATE_FORMAT(date,format);Oracle使用TO_DATE(X,[,fmt])',
|
tip7: '如日期格式化:MySQL使用DATE_FORMAT(date,format);Oracle使用TO_DATE(X,[,fmt])',
|
||||||
tip8: '非直连模式数据集,使用Doris数据库函数,可参考Doris官网'
|
tip8: '非直连模式数据集,使用Doris数据库函数,可参考Doris官网'
|
||||||
}
|
},
|
||||||
|
set_key: '设置主键',
|
||||||
|
change_to_key: '设置为主键',
|
||||||
|
selecet_key: '选择主键',
|
||||||
|
no_set_key: '未设置主键'
|
||||||
},
|
},
|
||||||
driver: {
|
driver: {
|
||||||
driver: '驱动',
|
driver: '驱动',
|
||||||
|
|||||||
@ -159,6 +159,24 @@
|
|||||||
>
|
>
|
||||||
{{ $t('deDataset.already_exists') }}
|
{{ $t('deDataset.already_exists') }}
|
||||||
</div>
|
</div>
|
||||||
|
<el-checkbox v-if="engineMode !== 'simple'" v-model="activeTable.setKey">{{ $t('dataset.set_key') }}</el-checkbox>
|
||||||
|
|
||||||
|
<el-select
|
||||||
|
size="small"
|
||||||
|
v-model="activeTable.keys"
|
||||||
|
v-if="engineMode !== 'simple'"
|
||||||
|
multiple
|
||||||
|
filterable
|
||||||
|
:disabled="!activeTable.setKey"
|
||||||
|
:placeholder="$t('dataset.selecet_key')"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="field in fields"
|
||||||
|
:key="field.fieldName"
|
||||||
|
:label="field.fieldName"
|
||||||
|
:value="field.fieldName"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-loading="tableLoading"
|
v-loading="tableLoading"
|
||||||
@ -421,20 +439,25 @@ export default {
|
|||||||
const tables = []
|
const tables = []
|
||||||
const mode = this.mode
|
const mode = this.mode
|
||||||
const syncType = this.syncType
|
const syncType = this.syncType
|
||||||
this.checkTableList.forEach((name) => {
|
|
||||||
const datasetName = this.tables.find(
|
for (let i = 0; i < this.checkTableList.length; i++) {
|
||||||
(ele) => ele.name === name
|
const table = this.tables.find(
|
||||||
).datasetName
|
(ele) => ele.name === this.checkTableList[i]
|
||||||
|
)
|
||||||
|
if(table.setKey && table.keys.length === 0 ){
|
||||||
|
this.openMessageSuccess(this.checkTableList[i] + this.$t('dataset.no_set_key') , 'error')
|
||||||
|
return
|
||||||
|
}
|
||||||
tables.push({
|
tables.push({
|
||||||
name: datasetName,
|
name: table.datasetName,
|
||||||
sceneId: sceneId,
|
sceneId: sceneId,
|
||||||
dataSourceId: dataSourceId,
|
dataSourceId: dataSourceId,
|
||||||
type: 'api',
|
type: 'api',
|
||||||
syncType: syncType,
|
syncType: syncType,
|
||||||
mode: parseInt(mode),
|
mode: parseInt(mode),
|
||||||
info: JSON.stringify({ table: name })
|
info: JSON.stringify({ table: this.checkTableList[i], setKey: table.setKey, keys: table.keys})
|
||||||
})
|
})
|
||||||
})
|
}
|
||||||
post('/dataset/table/batchAdd', tables)
|
post('/dataset/table/batchAdd', tables)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
this.openMessageSuccess('deDataset.set_saved_successfully')
|
this.openMessageSuccess('deDataset.set_saved_successfully')
|
||||||
@ -610,6 +633,10 @@ export default {
|
|||||||
width: 420px;
|
width: 420px;
|
||||||
margin-left: 12px;
|
margin-left: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.el-checkbox{
|
||||||
|
margin-left: 12px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.data {
|
.data {
|
||||||
|
|||||||
@ -166,6 +166,26 @@
|
|||||||
>
|
>
|
||||||
{{ $t('deDataset.already_exists') }}
|
{{ $t('deDataset.already_exists') }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<el-checkbox v-if="mode === '1'" v-model="activeTable.setKey">{{ $t('dataset.set_key') }}</el-checkbox>
|
||||||
|
|
||||||
|
<el-select
|
||||||
|
size="small"
|
||||||
|
v-model="activeTable.keys"
|
||||||
|
v-if="mode === '1'"
|
||||||
|
multiple
|
||||||
|
filterable
|
||||||
|
:disabled="!activeTable.setKey"
|
||||||
|
:placeholder="$t('dataset.selecet_key')"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="field in fields"
|
||||||
|
:key="field.fieldName"
|
||||||
|
:label="field.fieldName"
|
||||||
|
:value="field.fieldName"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-loading="tableLoading"
|
v-loading="tableLoading"
|
||||||
@ -293,6 +313,8 @@ export default {
|
|||||||
this.tables.forEach((ele) => {
|
this.tables.forEach((ele) => {
|
||||||
this.$set(ele, 'datasetName', dsName + '_' + ele.name)
|
this.$set(ele, 'datasetName', dsName + '_' + ele.name)
|
||||||
this.$set(ele, 'nameExist', false)
|
this.$set(ele, 'nameExist', false)
|
||||||
|
this.$set(ele, 'setKey', false)
|
||||||
|
this.$set(ele, 'keys', [])
|
||||||
})
|
})
|
||||||
this.tableData = [...this.tables]
|
this.tableData = [...this.tables]
|
||||||
this.avilibelTable = !this.tableData.some((ele) => ele.enableCheck)
|
this.avilibelTable = !this.tableData.some((ele) => ele.enableCheck)
|
||||||
@ -436,27 +458,33 @@ export default {
|
|||||||
this.openMessageSuccess('deDataset.cannot_be_duplicate', 'error')
|
this.openMessageSuccess('deDataset.cannot_be_duplicate', 'error')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.loading) return
|
if (this.loading) return
|
||||||
this.loading = true
|
|
||||||
const sceneId = this.param.id
|
const sceneId = this.param.id
|
||||||
const dataSourceId = this.dataSource
|
const dataSourceId = this.dataSource
|
||||||
const tables = []
|
const tables = []
|
||||||
const mode = this.mode
|
const mode = this.mode
|
||||||
const syncType = this.syncType
|
const syncType = this.syncType
|
||||||
this.checkTableList.forEach((name) => {
|
for (let i = 0; i < this.checkTableList.length; i++) {
|
||||||
const datasetName = this.tables.find(
|
const table = this.tables.find(
|
||||||
(ele) => ele.name === name
|
(ele) => ele.name === this.checkTableList[i]
|
||||||
).datasetName
|
)
|
||||||
|
if(table.setKey && table.keys.length === 0 ){
|
||||||
|
this.openMessageSuccess(this.checkTableList[i] + this.$t('dataset.no_set_key') , 'error')
|
||||||
|
return
|
||||||
|
}
|
||||||
tables.push({
|
tables.push({
|
||||||
name: datasetName,
|
name: table.datasetName,
|
||||||
sceneId: sceneId,
|
sceneId: sceneId,
|
||||||
dataSourceId: dataSourceId,
|
dataSourceId: dataSourceId,
|
||||||
type: 'db',
|
type: 'db',
|
||||||
syncType: syncType,
|
syncType: syncType,
|
||||||
mode: parseInt(mode),
|
mode: parseInt(mode),
|
||||||
info: JSON.stringify({ table: name })
|
info: JSON.stringify({ table: this.checkTableList[i], setKey: table.setKey, keys: table.keys})
|
||||||
})
|
})
|
||||||
})
|
}
|
||||||
|
|
||||||
|
this.loading = true
|
||||||
post('/dataset/table/batchAdd', tables)
|
post('/dataset/table/batchAdd', tables)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
this.openMessageSuccess('deDataset.set_saved_successfully')
|
this.openMessageSuccess('deDataset.set_saved_successfully')
|
||||||
@ -632,6 +660,15 @@ export default {
|
|||||||
width: 420px;
|
width: 420px;
|
||||||
margin-left: 12px;
|
margin-left: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.el-select {
|
||||||
|
width: 420px;
|
||||||
|
margin-left: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-checkbox{
|
||||||
|
margin-left: 12px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.data {
|
.data {
|
||||||
|
|||||||
@ -138,6 +138,23 @@
|
|||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
|
<el-checkbox v-model="sheetObj.setKey">{{ $t('dataset.set_key') }}</el-checkbox>
|
||||||
|
<el-select
|
||||||
|
size="small"
|
||||||
|
v-model="sheetObj.keys"
|
||||||
|
v-if="mode === '1'"
|
||||||
|
multiple
|
||||||
|
filterable
|
||||||
|
:disabled="!sheetObj.setKey"
|
||||||
|
:placeholder="$t('dataset.selecet_key')"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="field in sheetObj.fields"
|
||||||
|
:key="field.fieldName"
|
||||||
|
:label="field.fieldName"
|
||||||
|
:value="field.fieldName"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
<div class="data">
|
<div class="data">
|
||||||
<div class="result-num">
|
<div class="result-num">
|
||||||
@ -771,6 +788,10 @@ export default {
|
|||||||
width: 420px;
|
width: 420px;
|
||||||
margin-left: 12px;
|
margin-left: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.el-checkbox{
|
||||||
|
margin-left: 12px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.data {
|
.data {
|
||||||
|
|||||||
@ -61,6 +61,25 @@
|
|||||||
value="sync_latter"
|
value="sync_latter"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
<el-checkbox style="margin-left: 12px" v-if="mode === '1' && engineMode !== 'simple'" v-model="param.setKey">{{ $t('dataset.set_key') }}</el-checkbox>
|
||||||
|
|
||||||
|
<el-select
|
||||||
|
size="small"
|
||||||
|
v-model="param.keys"
|
||||||
|
v-if="mode === '1' && engineMode !== 'simple'"
|
||||||
|
multiple
|
||||||
|
filterable
|
||||||
|
:disabled="!param.setKey"
|
||||||
|
:placeholder="$t('dataset.selecet_key')"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="field in fields"
|
||||||
|
:key="field.fieldName"
|
||||||
|
:label="field.fieldName"
|
||||||
|
:value="field.fieldName"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col
|
<el-col
|
||||||
style="text-align: right"
|
style="text-align: right"
|
||||||
@ -1051,7 +1070,9 @@ export default {
|
|||||||
sqlVariableDetails: JSON.stringify(this.variables),
|
sqlVariableDetails: JSON.stringify(this.variables),
|
||||||
info: JSON.stringify({
|
info: JSON.stringify({
|
||||||
sql: Base64.encode(this.sql.trim()),
|
sql: Base64.encode(this.sql.trim()),
|
||||||
isBase64Encryption: true
|
isBase64Encryption: true,
|
||||||
|
setKey: this.param.setKey,
|
||||||
|
keys: this.param.keys
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
post('/dataset/table/update', table)
|
post('/dataset/table/update', table)
|
||||||
|
|||||||
@ -225,6 +225,22 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
property="key"
|
||||||
|
:label="$t('dataset.change_to_key')"
|
||||||
|
v-if=""
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-select v-model="scope.row.key" @change="saveKey(scope.row)" >
|
||||||
|
<el-option
|
||||||
|
v-for="item in getKeyFields(scope.row)"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
property="deExtractType"
|
property="deExtractType"
|
||||||
:label="$t('dataset.origin_field_type')"
|
:label="$t('dataset.origin_field_type')"
|
||||||
@ -564,6 +580,21 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
property="key"
|
||||||
|
:label="$t('dataset.change_to_key')"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-select v-model="scope.row.key" @change="saveKey(scope.row)" >
|
||||||
|
<el-option
|
||||||
|
v-for="item in getKeyFields(scope.row)"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
property="deExtractType"
|
property="deExtractType"
|
||||||
:label="$t('dataset.origin_field_type')"
|
:label="$t('dataset.origin_field_type')"
|
||||||
@ -746,6 +777,7 @@ import { batchEdit, dateformats, fieldListDQ, post } from '@/api/dataset/dataset
|
|||||||
import CalcFieldEdit from './CalcFieldEdit'
|
import CalcFieldEdit from './CalcFieldEdit'
|
||||||
import { getFieldName } from '@/views/dataset/data/utils'
|
import { getFieldName } from '@/views/dataset/data/utils'
|
||||||
import msgCfm from '@/components/msgCfm/index'
|
import msgCfm from '@/components/msgCfm/index'
|
||||||
|
import {engineMode} from "@/api/system/engine";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'FieldEdit',
|
name: 'FieldEdit',
|
||||||
@ -780,7 +812,8 @@ export default {
|
|||||||
dimensionChecked: false,
|
dimensionChecked: false,
|
||||||
dimensionIndeterminate: false,
|
dimensionIndeterminate: false,
|
||||||
quotaChecked: false,
|
quotaChecked: false,
|
||||||
quotaIndeterminate: false
|
quotaIndeterminate: false,
|
||||||
|
engineMode: 'local',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@ -794,6 +827,11 @@ export default {
|
|||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
window.removeEventListener('resize', this.calcHeight)
|
window.removeEventListener('resize', this.calcHeight)
|
||||||
},
|
},
|
||||||
|
created() {
|
||||||
|
engineMode().then((res) => {
|
||||||
|
this.engineMode = res.data
|
||||||
|
})
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
window.addEventListener('resize', this.calcHeight)
|
window.addEventListener('resize', this.calcHeight)
|
||||||
this.calcHeight()
|
this.calcHeight()
|
||||||
@ -826,6 +864,12 @@ export default {
|
|||||||
this.dateformats = children
|
this.dateformats = children
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
getKeyFields(item) {
|
||||||
|
return [
|
||||||
|
{ label: this.$t('commons.yes'), value: true },
|
||||||
|
{ label: this.$t('commons.no'), value: false }
|
||||||
|
]
|
||||||
|
},
|
||||||
getFields(item) {
|
getFields(item) {
|
||||||
if (item.deExtractType === 0) {
|
if (item.deExtractType === 0) {
|
||||||
const children = this.dateformats
|
const children = this.dateformats
|
||||||
@ -850,6 +894,19 @@ export default {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
saveKey(item ) {
|
||||||
|
post('/dataset/field/saveKey', item)
|
||||||
|
.then((response) => {
|
||||||
|
this.initField()
|
||||||
|
localStorage.setItem('reloadDsData', 'true')
|
||||||
|
})
|
||||||
|
.catch((res) => {
|
||||||
|
this.initField()
|
||||||
|
localStorage.setItem('reloadDsData', 'true')
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
saveEdit(item, checkExp = true) {
|
saveEdit(item, checkExp = true) {
|
||||||
if (item.name && item.name.length > 50) {
|
if (item.name && item.name.length > 50) {
|
||||||
this.$message.error(this.$t('dataset.field_name_less_50'))
|
this.$message.error(this.$t('dataset.field_name_less_50'))
|
||||||
|
|||||||
@ -0,0 +1,15 @@
|
|||||||
|
package io.dataease.plugins.common.base.domain;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DatasetTableKey implements Serializable {
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
private String tableId;
|
||||||
|
|
||||||
|
private String tableFieldId;
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
}
|
||||||
@ -0,0 +1,410 @@
|
|||||||
|
package io.dataease.plugins.common.base.domain;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class DatasetTableKeyExample {
|
||||||
|
protected String orderByClause;
|
||||||
|
|
||||||
|
protected boolean distinct;
|
||||||
|
|
||||||
|
protected List<Criteria> oredCriteria;
|
||||||
|
|
||||||
|
public DatasetTableKeyExample() {
|
||||||
|
oredCriteria = new ArrayList<Criteria>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrderByClause(String orderByClause) {
|
||||||
|
this.orderByClause = orderByClause;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOrderByClause() {
|
||||||
|
return orderByClause;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDistinct(boolean distinct) {
|
||||||
|
this.distinct = distinct;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDistinct() {
|
||||||
|
return distinct;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Criteria> getOredCriteria() {
|
||||||
|
return oredCriteria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void or(Criteria criteria) {
|
||||||
|
oredCriteria.add(criteria);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria or() {
|
||||||
|
Criteria criteria = createCriteriaInternal();
|
||||||
|
oredCriteria.add(criteria);
|
||||||
|
return criteria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria createCriteria() {
|
||||||
|
Criteria criteria = createCriteriaInternal();
|
||||||
|
if (oredCriteria.size() == 0) {
|
||||||
|
oredCriteria.add(criteria);
|
||||||
|
}
|
||||||
|
return criteria;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Criteria createCriteriaInternal() {
|
||||||
|
Criteria criteria = new Criteria();
|
||||||
|
return criteria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
oredCriteria.clear();
|
||||||
|
orderByClause = null;
|
||||||
|
distinct = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract static class GeneratedCriteria {
|
||||||
|
protected List<Criterion> criteria;
|
||||||
|
|
||||||
|
protected GeneratedCriteria() {
|
||||||
|
super();
|
||||||
|
criteria = new ArrayList<Criterion>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isValid() {
|
||||||
|
return criteria.size() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Criterion> getAllCriteria() {
|
||||||
|
return criteria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Criterion> getCriteria() {
|
||||||
|
return criteria;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addCriterion(String condition) {
|
||||||
|
if (condition == null) {
|
||||||
|
throw new RuntimeException("Value for condition cannot be null");
|
||||||
|
}
|
||||||
|
criteria.add(new Criterion(condition));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addCriterion(String condition, Object value, String property) {
|
||||||
|
if (value == null) {
|
||||||
|
throw new RuntimeException("Value for " + property + " cannot be null");
|
||||||
|
}
|
||||||
|
criteria.add(new Criterion(condition, value));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addCriterion(String condition, Object value1, Object value2, String property) {
|
||||||
|
if (value1 == null || value2 == null) {
|
||||||
|
throw new RuntimeException("Between values for " + property + " cannot be null");
|
||||||
|
}
|
||||||
|
criteria.add(new Criterion(condition, value1, value2));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andIdIsNull() {
|
||||||
|
addCriterion("id is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andIdIsNotNull() {
|
||||||
|
addCriterion("id is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andIdEqualTo(String value) {
|
||||||
|
addCriterion("id =", value, "id");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andIdNotEqualTo(String value) {
|
||||||
|
addCriterion("id <>", value, "id");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andIdGreaterThan(String value) {
|
||||||
|
addCriterion("id >", value, "id");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andIdGreaterThanOrEqualTo(String value) {
|
||||||
|
addCriterion("id >=", value, "id");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andIdLessThan(String value) {
|
||||||
|
addCriterion("id <", value, "id");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andIdLessThanOrEqualTo(String value) {
|
||||||
|
addCriterion("id <=", value, "id");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andIdLike(String value) {
|
||||||
|
addCriterion("id like", value, "id");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andIdNotLike(String value) {
|
||||||
|
addCriterion("id not like", value, "id");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andIdIn(List<String> values) {
|
||||||
|
addCriterion("id in", values, "id");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andIdNotIn(List<String> values) {
|
||||||
|
addCriterion("id not in", values, "id");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andIdBetween(String value1, String value2) {
|
||||||
|
addCriterion("id between", value1, value2, "id");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andIdNotBetween(String value1, String value2) {
|
||||||
|
addCriterion("id not between", value1, value2, "id");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTableIdIsNull() {
|
||||||
|
addCriterion("table_id is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTableIdIsNotNull() {
|
||||||
|
addCriterion("table_id is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTableIdEqualTo(String value) {
|
||||||
|
addCriterion("table_id =", value, "tableId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTableIdNotEqualTo(String value) {
|
||||||
|
addCriterion("table_id <>", value, "tableId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTableIdGreaterThan(String value) {
|
||||||
|
addCriterion("table_id >", value, "tableId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTableIdGreaterThanOrEqualTo(String value) {
|
||||||
|
addCriterion("table_id >=", value, "tableId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTableIdLessThan(String value) {
|
||||||
|
addCriterion("table_id <", value, "tableId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTableIdLessThanOrEqualTo(String value) {
|
||||||
|
addCriterion("table_id <=", value, "tableId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTableIdLike(String value) {
|
||||||
|
addCriterion("table_id like", value, "tableId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTableIdNotLike(String value) {
|
||||||
|
addCriterion("table_id not like", value, "tableId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTableIdIn(List<String> values) {
|
||||||
|
addCriterion("table_id in", values, "tableId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTableIdNotIn(List<String> values) {
|
||||||
|
addCriterion("table_id not in", values, "tableId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTableIdBetween(String value1, String value2) {
|
||||||
|
addCriterion("table_id between", value1, value2, "tableId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTableIdNotBetween(String value1, String value2) {
|
||||||
|
addCriterion("table_id not between", value1, value2, "tableId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTableFieldIdIsNull() {
|
||||||
|
addCriterion("table_field_id is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTableFieldIdIsNotNull() {
|
||||||
|
addCriterion("table_field_id is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTableFieldIdEqualTo(String value) {
|
||||||
|
addCriterion("table_field_id =", value, "tableFieldId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTableFieldIdNotEqualTo(String value) {
|
||||||
|
addCriterion("table_field_id <>", value, "tableFieldId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTableFieldIdGreaterThan(String value) {
|
||||||
|
addCriterion("table_field_id >", value, "tableFieldId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTableFieldIdGreaterThanOrEqualTo(String value) {
|
||||||
|
addCriterion("table_field_id >=", value, "tableFieldId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTableFieldIdLessThan(String value) {
|
||||||
|
addCriterion("table_field_id <", value, "tableFieldId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTableFieldIdLessThanOrEqualTo(String value) {
|
||||||
|
addCriterion("table_field_id <=", value, "tableFieldId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTableFieldIdLike(String value) {
|
||||||
|
addCriterion("table_field_id like", value, "tableFieldId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTableFieldIdNotLike(String value) {
|
||||||
|
addCriterion("table_field_id not like", value, "tableFieldId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTableFieldIdIn(List<String> values) {
|
||||||
|
addCriterion("table_field_id in", values, "tableFieldId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTableFieldIdNotIn(List<String> values) {
|
||||||
|
addCriterion("table_field_id not in", values, "tableFieldId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTableFieldIdBetween(String value1, String value2) {
|
||||||
|
addCriterion("table_field_id between", value1, value2, "tableFieldId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTableFieldIdNotBetween(String value1, String value2) {
|
||||||
|
addCriterion("table_field_id not between", value1, value2, "tableFieldId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Criteria extends GeneratedCriteria {
|
||||||
|
|
||||||
|
protected Criteria() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Criterion {
|
||||||
|
private String condition;
|
||||||
|
|
||||||
|
private Object value;
|
||||||
|
|
||||||
|
private Object secondValue;
|
||||||
|
|
||||||
|
private boolean noValue;
|
||||||
|
|
||||||
|
private boolean singleValue;
|
||||||
|
|
||||||
|
private boolean betweenValue;
|
||||||
|
|
||||||
|
private boolean listValue;
|
||||||
|
|
||||||
|
private String typeHandler;
|
||||||
|
|
||||||
|
public String getCondition() {
|
||||||
|
return condition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getSecondValue() {
|
||||||
|
return secondValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNoValue() {
|
||||||
|
return noValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSingleValue() {
|
||||||
|
return singleValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isBetweenValue() {
|
||||||
|
return betweenValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isListValue() {
|
||||||
|
return listValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTypeHandler() {
|
||||||
|
return typeHandler;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Criterion(String condition) {
|
||||||
|
super();
|
||||||
|
this.condition = condition;
|
||||||
|
this.typeHandler = null;
|
||||||
|
this.noValue = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Criterion(String condition, Object value, String typeHandler) {
|
||||||
|
super();
|
||||||
|
this.condition = condition;
|
||||||
|
this.value = value;
|
||||||
|
this.typeHandler = typeHandler;
|
||||||
|
if (value instanceof List<?>) {
|
||||||
|
this.listValue = true;
|
||||||
|
} else {
|
||||||
|
this.singleValue = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Criterion(String condition, Object value) {
|
||||||
|
this(condition, value, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
|
||||||
|
super();
|
||||||
|
this.condition = condition;
|
||||||
|
this.value = value;
|
||||||
|
this.secondValue = secondValue;
|
||||||
|
this.typeHandler = typeHandler;
|
||||||
|
this.betweenValue = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Criterion(String condition, Object value, Object secondValue) {
|
||||||
|
this(condition, value, secondValue, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
package io.dataease.plugins.common.base.mapper;
|
||||||
|
|
||||||
|
import io.dataease.plugins.common.base.domain.DatasetTableKey;
|
||||||
|
import io.dataease.plugins.common.base.domain.DatasetTableKeyExample;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
public interface DatasetTableKeyMapper {
|
||||||
|
long countByExample(DatasetTableKeyExample example);
|
||||||
|
|
||||||
|
int deleteByExample(DatasetTableKeyExample example);
|
||||||
|
|
||||||
|
int deleteByPrimaryKey(String id);
|
||||||
|
|
||||||
|
int insert(DatasetTableKey record);
|
||||||
|
|
||||||
|
int insertSelective(DatasetTableKey record);
|
||||||
|
|
||||||
|
List<DatasetTableKey> selectByExample(DatasetTableKeyExample example);
|
||||||
|
|
||||||
|
DatasetTableKey selectByPrimaryKey(String id);
|
||||||
|
|
||||||
|
int updateByExampleSelective(@Param("record") DatasetTableKey record, @Param("example") DatasetTableKeyExample example);
|
||||||
|
|
||||||
|
int updateByExample(@Param("record") DatasetTableKey record, @Param("example") DatasetTableKeyExample example);
|
||||||
|
|
||||||
|
int updateByPrimaryKeySelective(DatasetTableKey record);
|
||||||
|
|
||||||
|
int updateByPrimaryKey(DatasetTableKey record);
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user