diff options
| author | tanghao <admin@LAPTOP-QCSKVLI9> | 2021-07-23 10:13:54 +0800 |
|---|---|---|
| committer | tanghao <admin@LAPTOP-QCSKVLI9> | 2021-07-23 10:13:54 +0800 |
| commit | c684b0070db43b4f7ec362ff7982a935dfd3f89b (patch) | |
| tree | 30db4ec6431b7f929c2a1dbe9f0772513b7b08aa | |
| parent | 210e5f524af4c828f69600d07ab4736f17569c7c (diff) | |
fix: 修复资产模型图表同步时 chart group导致异常v2.1-release
| -rw-r--r-- | nz-admin/src/main/java/com/nis/modules/panel/service/impl/VisualChartServiceImpl.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/nz-admin/src/main/java/com/nis/modules/panel/service/impl/VisualChartServiceImpl.java b/nz-admin/src/main/java/com/nis/modules/panel/service/impl/VisualChartServiceImpl.java index 9feaad86..7562adb4 100644 --- a/nz-admin/src/main/java/com/nis/modules/panel/service/impl/VisualChartServiceImpl.java +++ b/nz-admin/src/main/java/com/nis/modules/panel/service/impl/VisualChartServiceImpl.java @@ -904,9 +904,10 @@ public class VisualChartServiceImpl extends ServiceImpl<VisualChartDao, VisualCh if(syncChart.getType().equals(Constant.CHART_GROUP_TYPE)) { // 当chart为group时 不允许name重复 会影响chart批量导入 - List<VisualChart> charts = this.list(new QueryWrapper<VisualChart>().lambda().eq(VisualChart::getName, syncChart.getName()).eq(VisualChart::getType, Constant.CHART_GROUP_TYPE.toString()).eq(VisualChart::getPanelId, syncChart.getPanelId()).ne(ToolUtil.isNotEmpty(syncChart.getId()), VisualChart::getId,syncChart.getId())); - if(ToolUtil.isNotEmpty(charts)) { - throw new NZException(RCode.CHART_GROUP_NAME_DUPLICATE); + VisualChart chart = this.getOne(new QueryWrapper<VisualChart>().lambda().eq(VisualChart::getName, syncChart.getName()).eq(VisualChart::getType, Constant.CHART_GROUP_TYPE.toString()).eq(VisualChart::getPanelId, syncChart.getPanelId()).ne(ToolUtil.isNotEmpty(syncChart.getId()), VisualChart::getId,syncChart.getId())); + if(ToolUtil.isNotEmpty(chart)) { + // group chart不能重复 先将group删除 防止不能创建组 + this.removeById(chart.getId()); } } this.save(syncChart); |
