diff --git a/src/main/java/com/sjhy/plugin/dto/TableInfoDTO.java b/src/main/java/com/sjhy/plugin/dto/TableInfoDTO.java index a7a1636..418319f 100644 --- a/src/main/java/com/sjhy/plugin/dto/TableInfoDTO.java +++ b/src/main/java/com/sjhy/plugin/dto/TableInfoDTO.java @@ -70,7 +70,7 @@ public class TableInfoDTO { } private static void merge(TableInfoDTO oldData, TableInfoDTO newData) { - if (oldData == null || CollectionUtil.isEmpty(oldData.getFullColumn())) { + if (oldData == null) { return; } if (!StringUtils.isEmpty(oldData.getPreName())) { @@ -88,6 +88,9 @@ public class TableInfoDTO { if (!StringUtils.isEmpty(oldData.getSaveModelName())) { newData.saveModelName = oldData.getSaveModelName(); } + if (CollectionUtil.isEmpty(oldData.getFullColumn())) { + return; + } // 补充自定义列 for (ColumnInfoDTO oldColumn : oldData.getFullColumn()) { if (!oldColumn.getCustom()) { diff --git a/src/main/java/com/sjhy/plugin/dto/TableInfoSettingsDTO.java b/src/main/java/com/sjhy/plugin/dto/TableInfoSettingsDTO.java index d8549f0..525d6a6 100644 --- a/src/main/java/com/sjhy/plugin/dto/TableInfoSettingsDTO.java +++ b/src/main/java/com/sjhy/plugin/dto/TableInfoSettingsDTO.java @@ -87,6 +87,7 @@ public class TableInfoSettingsDTO { public TableInfo readTableInfo(DbTable dbTable) { String key = generateKey(dbTable); TableInfoDTO dto = this.tableInfoMap.get(key); + // 表可能新增了字段,需要重新合并保存 dto = new TableInfoDTO(dto, dbTable); this.tableInfoMap.put(key, dto); return dto.toTableInfo(dbTable);