|
|
@ -7,6 +7,7 @@ import java.io.StringWriter;
|
|
|
|
import java.util.LinkedHashMap;
|
|
|
|
import java.util.LinkedHashMap;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import java.util.function.Function;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.zip.ZipEntry;
|
|
|
|
import java.util.zip.ZipEntry;
|
|
|
|
import java.util.zip.ZipOutputStream;
|
|
|
|
import java.util.zip.ZipOutputStream;
|
|
|
@ -286,7 +287,7 @@ public class GenTableServiceImpl implements IGenTableService
|
|
|
|
{
|
|
|
|
{
|
|
|
|
GenTable table = genTableMapper.selectGenTableByName(tableName);
|
|
|
|
GenTable table = genTableMapper.selectGenTableByName(tableName);
|
|
|
|
List<GenTableColumn> tableColumns = table.getColumns();
|
|
|
|
List<GenTableColumn> tableColumns = table.getColumns();
|
|
|
|
List<String> tableColumnNames = tableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList());
|
|
|
|
Map<String, GenTableColumn> tableColumnMap = tableColumns.stream().collect(Collectors.toMap(GenTableColumn::getColumnName, Function.identity()));
|
|
|
|
|
|
|
|
|
|
|
|
List<GenTableColumn> dbTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName);
|
|
|
|
List<GenTableColumn> dbTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName);
|
|
|
|
if (StringUtils.isEmpty(dbTableColumns))
|
|
|
|
if (StringUtils.isEmpty(dbTableColumns))
|
|
|
@ -296,9 +297,17 @@ public class GenTableServiceImpl implements IGenTableService
|
|
|
|
List<String> dbTableColumnNames = dbTableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList());
|
|
|
|
List<String> dbTableColumnNames = dbTableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
dbTableColumns.forEach(column -> {
|
|
|
|
dbTableColumns.forEach(column -> {
|
|
|
|
if (!tableColumnNames.contains(column.getColumnName()))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
GenUtils.initColumnField(column, table);
|
|
|
|
GenUtils.initColumnField(column, table);
|
|
|
|
|
|
|
|
if (tableColumnMap.containsKey(column.getColumnName()))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
GenTableColumn prevColumn = tableColumnMap.get(column.getColumnName());
|
|
|
|
|
|
|
|
column.setColumnId(prevColumn.getColumnId());
|
|
|
|
|
|
|
|
if (column.isList()) {
|
|
|
|
|
|
|
|
// 如果是列表,继续保留字典类型
|
|
|
|
|
|
|
|
column.setDictType(prevColumn.getDictType());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
genTableColumnMapper.updateGenTableColumn(column);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
genTableColumnMapper.insertGenTableColumn(column);
|
|
|
|
genTableColumnMapper.insertGenTableColumn(column);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|