From 892a967d24a3a780eb2310b1467a44c3f1a28bf4 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Tue, 28 Dec 2021 17:52:31 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BB=AA=E8=A1=A8=E6=9D=BF?= =?UTF-8?q?=E5=91=BD=E5=90=8D=EF=BC=8C=E7=9B=B8=E5=90=8C=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E4=B8=8B=E7=9A=84=E4=BB=AA=E8=A1=A8=E6=9D=BF=E5=92=8C=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E5=85=81=E8=AE=B8=E9=87=8D=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/panel/PanelGroupService.java | 16 ++++++++-------- frontend/src/views/panel/list/PanelList.vue | 9 ++++++--- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/backend/src/main/java/io/dataease/service/panel/PanelGroupService.java b/backend/src/main/java/io/dataease/service/panel/PanelGroupService.java index 26e97f8a72..b063082e99 100644 --- a/backend/src/main/java/io/dataease/service/panel/PanelGroupService.java +++ b/backend/src/main/java/io/dataease/service/panel/PanelGroupService.java @@ -87,7 +87,7 @@ public class PanelGroupService { String panelId = request.getId(); if (StringUtils.isEmpty(panelId)) { // 新建 - checkPanelName(request.getName(), request.getPid(), PanelConstants.OPT_TYPE_INSERT, null); + checkPanelName(request.getName(), request.getPid(), PanelConstants.OPT_TYPE_INSERT, null,request.getNodeType()); panelId = UUID.randomUUID().toString(); request.setId(panelId); request.setCreateTime(System.currentTimeMillis()); @@ -105,7 +105,7 @@ public class PanelGroupService { newDefaultPanel.setLevel(0); newDefaultPanel.setSource(request.getId()); newDefaultPanel.setCreateBy(AuthUtils.getUser().getUsername()); - checkPanelName(newDefaultPanel.getName(), newDefaultPanel.getPid(), PanelConstants.OPT_TYPE_INSERT, newDefaultPanel.getId()); + checkPanelName(newDefaultPanel.getName(), newDefaultPanel.getPid(), PanelConstants.OPT_TYPE_INSERT, newDefaultPanel.getId(),newDefaultPanel.getNodeType()); panelGroupMapper.insertSelective(newDefaultPanel); } else if ("copy".equals(request.getOptType())) { panelId = UUID.randomUUID().toString(); @@ -113,7 +113,7 @@ public class PanelGroupService { PanelGroupWithBLOBs newPanel = panelGroupMapper.selectByPrimaryKey(request.getId()); // 插入校验 if (StringUtils.isNotEmpty(request.getName())) { - checkPanelName(request.getName(), newPanel.getPid(), PanelConstants.OPT_TYPE_INSERT, request.getId()); + checkPanelName(request.getName(), newPanel.getPid(), PanelConstants.OPT_TYPE_INSERT, request.getId(),newPanel.getNodeType()); } newPanel.setName(request.getName()); newPanel.setId(panelId); @@ -133,7 +133,7 @@ public class PanelGroupService { } // 移动校验 if (StringUtils.isNotEmpty(request.getName())) { - checkPanelName(request.getName(), request.getPid(), PanelConstants.OPT_TYPE_INSERT, request.getId()); + checkPanelName(request.getName(), request.getPid(), PanelConstants.OPT_TYPE_INSERT, request.getId(),panelInfo.getNodeType()); } PanelGroupWithBLOBs record = new PanelGroupWithBLOBs(); record.setName(request.getName()); @@ -144,7 +144,7 @@ public class PanelGroupService { } else { // 更新 if (StringUtils.isNotEmpty(request.getName())) { - checkPanelName(request.getName(), request.getPid(), PanelConstants.OPT_TYPE_UPDATE, request.getId()); + checkPanelName(request.getName(), request.getPid(), PanelConstants.OPT_TYPE_UPDATE, request.getId(),request.getNodeType()); } panelGroupMapper.updateByPrimaryKeySelective(request); } @@ -161,12 +161,12 @@ public class PanelGroupService { } - private void checkPanelName(String name, String pid, String optType, String id) { + private void checkPanelName(String name, String pid, String optType, String id,String nodeType) { PanelGroupExample groupExample = new PanelGroupExample(); if (PanelConstants.OPT_TYPE_INSERT.equalsIgnoreCase(optType)) { - groupExample.createCriteria().andPidEqualTo(pid).andNameEqualTo(name); + groupExample.createCriteria().andPidEqualTo(pid).andNameEqualTo(name).andNodeTypeEqualTo(nodeType); } else if (PanelConstants.OPT_TYPE_UPDATE.equalsIgnoreCase(optType)) { - groupExample.createCriteria().andPidEqualTo(pid).andNameEqualTo(name).andIdNotEqualTo(id); + groupExample.createCriteria().andPidEqualTo(pid).andNameEqualTo(name).andIdNotEqualTo(id).andNodeTypeEqualTo(nodeType); } List checkResult = panelGroupMapper.selectByExample(groupExample); diff --git a/frontend/src/views/panel/list/PanelList.vue b/frontend/src/views/panel/list/PanelList.vue index 35a1a27b6e..6f1f47b855 100644 --- a/frontend/src/views/panel/list/PanelList.vue +++ b/frontend/src/views/panel/list/PanelList.vue @@ -448,7 +448,8 @@ export default { panelInfo: { id: param.data.id, pid: param.data.pid, - name: param.data.name + name: param.data.name, + nodeType: param.type } } break @@ -459,7 +460,8 @@ export default { panelInfo: { id: param.data.id, name: param.data.name, - optType: 'toDefaultPanel' + optType: 'toDefaultPanel', + nodeType: param.type } } break @@ -471,7 +473,8 @@ export default { panelInfo: { id: param.data.id, name: param.data.name, - optType: 'copy' + optType: 'copy', + nodeType: param.type } } break