From 6ffdb6fad0301b41b78abffc46286b6ca7a85c6e Mon Sep 17 00:00:00 2001 From: makejava <1353036300@qq.com> Date: Wed, 6 Jul 2022 12:21:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BD=93=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E4=B8=AD=E4=B8=8D=E5=AD=98=E5=9C=A8=E5=88=97?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=97=B6=E5=8F=AF=E8=83=BD=E4=BC=9A=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E8=A1=A8=E7=9A=84=E5=85=B6=E4=BB=96=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E4=B8=A2=E5=A4=B1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/sjhy/plugin/dto/TableInfoDTO.java | 5 ++++- src/main/java/com/sjhy/plugin/dto/TableInfoSettingsDTO.java | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) 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);