From d52cf79d66b5d618c90e0e6f981669ba8934e246 Mon Sep 17 00:00:00 2001 From: Yvan Date: Tue, 29 Mar 2022 15:53:13 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-68803=20=E3=80=90=E8=BF=AD=E4=BB=A3?= =?UTF-8?q?=E3=80=91=E3=80=90=E6=95=B0=E6=8D=AE=E9=9B=86=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E3=80=91=E5=A4=8D=E5=88=B6=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=A0=BC=EF=BC=8C=E5=B7=B2=E5=AD=98=E5=9C=A8=E5=90=8C=E5=90=8D?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=9B=86=EF=BC=8C=E6=95=B0=E6=8D=AE=E9=9B=86?= =?UTF-8?q?=E4=B8=8D=E9=9C=80=E8=A6=81=E8=B7=9F=E9=9A=8F=E5=A4=8D=E5=88=B6?= =?UTF-8?q?=20=E3=80=90=E9=97=AE=E9=A2=98=E5=8E=9F=E5=9B=A0=E3=80=91rt=20?= =?UTF-8?q?=E3=80=90=E6=94=B9=E5=8A=A8=E6=80=9D=E8=B7=AF=E3=80=91=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E5=AD=98=E5=9C=A8=E5=90=8C=E5=90=8D=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E4=B8=8D=E8=B7=9F=E9=9A=8F=E5=A4=8D=E5=88=B6=20?= =?UTF-8?q?=E3=80=90review=E5=BB=BA=E8=AE=AE=E3=80=91=E6=97=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../paste/TableDataFollowingPasteUtils.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/paste/TableDataFollowingPasteUtils.java b/designer-base/src/main/java/com/fr/design/data/tabledata/paste/TableDataFollowingPasteUtils.java index ffeb9e5f62..465c0361a7 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/paste/TableDataFollowingPasteUtils.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/paste/TableDataFollowingPasteUtils.java @@ -16,7 +16,9 @@ import com.fr.form.ui.DictionaryContainer; import com.fr.form.ui.Widget; import com.fr.form.ui.concept.data.ValueInitializer; import com.fr.report.cell.tabledata.ElementUsedTableDataProvider; +import com.fr.stable.StringUtils; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -43,15 +45,23 @@ public class TableDataFollowingPasteUtils { TableDataTreePane tableDataTreePane = (TableDataTreePane) TableDataTreePane.getInstance(currentModelAdapter); // 粘贴(添加)数据集 for (Map.Entry dataWrapperEntry : tableDataWrapperMap.entrySet()) { - String oldName = dataWrapperEntry.getKey(); + String dsName = dataWrapperEntry.getKey(); // 处理名称重复情况 - String dsName = tableDataTreePane.getNoRepeatedDsName4Paste(oldName); + if (isDsNameRepeated(dsName)) { + continue; + } AbstractTableDataWrapper tableDataWrapper = new TemplateTableDataWrapper(dataWrapperEntry.getValue(), dsName); AbstractTableDataPane tableDataPane = tableDataWrapper.creatTableDataPane(); tableDataTreePane.addDataPane(tableDataPane, dsName); } } + private static boolean isDsNameRepeated(String dsName) { + DesignModelAdapter currentModelAdapter = DesignModelAdapter.getCurrentModelAdapter(); + String[] allDSNames = DesignTableDataManager.getAllDSNames(currentModelAdapter.getBook()); + return Arrays.stream(allDSNames).anyMatch(name -> StringUtils.equals(name, dsName)); + } + /** * 处理 ElementUsedTableDataProvider,从中获取数据集名称 - 数据集Wrapper 的Map *