fix: trigger diff failed
This commit is contained in:
parent
ae8dc7ebcc
commit
2a7de68680
|
@ -2,10 +2,7 @@ package com.databasir.core.domain.document.converter;
|
|||
|
||||
import com.databasir.core.domain.document.data.TableDocumentResponse;
|
||||
import com.databasir.core.infrastructure.converter.JsonConverter;
|
||||
import com.databasir.core.meta.data.ColumnMeta;
|
||||
import com.databasir.core.meta.data.DatabaseMeta;
|
||||
import com.databasir.core.meta.data.IndexMeta;
|
||||
import com.databasir.core.meta.data.TableMeta;
|
||||
import com.databasir.core.meta.data.*;
|
||||
import com.databasir.dao.tables.pojos.*;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
|
@ -65,6 +62,9 @@ public interface DatabaseMetaConverter {
|
|||
@Mapping(target = "columnNames", source = "pojo.columnNameArray")
|
||||
IndexMeta of(TableIndexDocumentPojo pojo);
|
||||
|
||||
@Mapping(target = "createAt", source = "pojo.triggerCreateAt")
|
||||
TriggerMeta of(TableTriggerDocumentPojo pojo);
|
||||
|
||||
List<TableMeta> of(List<TableDocumentResponse> table);
|
||||
|
||||
TableMeta of(TableDocumentResponse table);
|
||||
|
|
|
@ -35,14 +35,17 @@ public class JdbcIndexMetaProvider implements IndexMetaProvider {
|
|||
return indexMetas;
|
||||
}
|
||||
|
||||
Map<String, IndexMeta> pojoGroupByName = new HashMap<>();
|
||||
Map<String, IndexMeta> metaGroupByName = new HashMap<>();
|
||||
try {
|
||||
while (indexResults.next()) {
|
||||
Boolean nonUnique = indexResults.getBoolean("NON_UNIQUE");
|
||||
String indexName = indexResults.getString("INDEX_NAME");
|
||||
String columnName = indexResults.getString("COLUMN_NAME");
|
||||
if (pojoGroupByName.containsKey(indexName)) {
|
||||
pojoGroupByName.get(indexName).getColumnNames().add(columnName);
|
||||
if (indexName == null) {
|
||||
continue;
|
||||
}
|
||||
if (metaGroupByName.containsKey(indexName)) {
|
||||
metaGroupByName.get(indexName).getColumnNames().add(columnName);
|
||||
} else {
|
||||
List<String> columns = new ArrayList<>();
|
||||
columns.add(columnName);
|
||||
|
@ -51,13 +54,13 @@ public class JdbcIndexMetaProvider implements IndexMetaProvider {
|
|||
.columnNames(columns)
|
||||
.isUniqueKey(Objects.equals(nonUnique, false))
|
||||
.build();
|
||||
pojoGroupByName.put(indexName, indexMeta);
|
||||
metaGroupByName.put(indexName, indexMeta);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
indexResults.close();
|
||||
}
|
||||
return new ArrayList<>(pojoGroupByName.values());
|
||||
return new ArrayList<>(metaGroupByName.values());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue