From a17641c7b60925bd46915c6ee6afa5652405c77c Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Wed, 25 Oct 2023 11:39:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=A4=A7=E5=B1=8F=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=A4=B9=E5=85=BC=E5=AE=B9=E8=84=8F=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manage/CoreVisualizationManage.java | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/core/core-backend/src/main/java/io/dataease/visualization/manage/CoreVisualizationManage.java b/core/core-backend/src/main/java/io/dataease/visualization/manage/CoreVisualizationManage.java index 57b28b2f71..d4979bc207 100644 --- a/core/core-backend/src/main/java/io/dataease/visualization/manage/CoreVisualizationManage.java +++ b/core/core-backend/src/main/java/io/dataease/visualization/manage/CoreVisualizationManage.java @@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.dataease.api.visualization.request.DataVisualizationBaseRequest; import io.dataease.api.visualization.request.VisualizationWorkbranchQueryRequest; import io.dataease.api.visualization.vo.VisualizationResourceVO; -import io.dataease.api.visualization.vo.VisualizationStoreVO; import io.dataease.commons.constants.DataVisualizationConstants; import io.dataease.commons.constants.OptConstants; import io.dataease.constant.BusiResourceEnum; @@ -21,7 +20,6 @@ import io.dataease.visualization.dao.auto.entity.DataVisualizationInfo; import io.dataease.visualization.dao.auto.mapper.DataVisualizationInfoMapper; import io.dataease.visualization.dao.ext.mapper.CoreVisualiationExtMapper; import io.dataease.visualization.dao.ext.mapper.ExtDataVisualizationMapper; -import io.dataease.visualization.dao.ext.po.StorePO; import io.dataease.visualization.dao.ext.po.VisualizationNodePO; import io.dataease.visualization.dao.ext.po.VisualizationResourcePO; import io.dataease.visualization.dto.VisualizationNodeBO; @@ -30,7 +28,6 @@ import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.bind.annotation.RequestBody; import java.util.*; @@ -84,30 +81,34 @@ public class CoreVisualizationManage { delIds.add(tempPid); List childrenIdList = extMapper.queryChildrenId(tempPid); if (CollectionUtil.isNotEmpty(childrenIdList)) { - stack.addAll(childrenIdList); + childrenIdList.forEach(kid -> { + if (!delIds.contains(kid)) { + stack.add(kid); + } + }); } } extMapper.batchDel(delIds, System.currentTimeMillis(), AuthUtils.getUser().getUserId()); - coreOptRecentManage.saveOpt(id, OptConstants.OPT_RESOURCE_TYPE.VISUALIZATION,OptConstants.OPT_TYPE.DELETE); + coreOptRecentManage.saveOpt(id, OptConstants.OPT_RESOURCE_TYPE.VISUALIZATION, OptConstants.OPT_TYPE.DELETE); } @XpackInteract(value = "visualizationResourceTree", before = false) public void move(DataVisualizationBaseRequest request) { - if(!request.getMoveFromUpdate()){ + if (!request.getMoveFromUpdate()) { DataVisualizationInfo visualizationInfo = new DataVisualizationInfo(); BeanUtils.copyBean(visualizationInfo, request); if (ObjectUtils.isEmpty(visualizationInfo.getId())) { DEException.throwException("resource not exist"); } visualizationInfo.setUpdateTime(System.currentTimeMillis()); - coreOptRecentManage.saveOpt(visualizationInfo.getId(), OptConstants.OPT_RESOURCE_TYPE.VISUALIZATION,OptConstants.OPT_TYPE.UPDATE); + coreOptRecentManage.saveOpt(visualizationInfo.getId(), OptConstants.OPT_RESOURCE_TYPE.VISUALIZATION, OptConstants.OPT_TYPE.UPDATE); mapper.updateById(visualizationInfo); } } @XpackInteract(value = "visualizationResourceTree", before = false) public Long innerSave(DataVisualizationInfo visualizationInfo) { - if(visualizationInfo.getId() == null){ + if (visualizationInfo.getId() == null) { Long id = IDUtils.snowID(); visualizationInfo.setId(id); } @@ -118,7 +119,7 @@ public class CoreVisualizationManage { visualizationInfo.setUpdateTime(System.currentTimeMillis()); visualizationInfo.setOrgId(AuthUtils.getUser().getDefaultOid()); mapper.insert(visualizationInfo); - coreOptRecentManage.saveOpt(visualizationInfo.getId(), OptConstants.OPT_RESOURCE_TYPE.VISUALIZATION,OptConstants.OPT_TYPE.NEW); + coreOptRecentManage.saveOpt(visualizationInfo.getId(), OptConstants.OPT_RESOURCE_TYPE.VISUALIZATION, OptConstants.OPT_TYPE.NEW); return visualizationInfo.getId(); } @@ -127,7 +128,7 @@ public class CoreVisualizationManage { visualizationInfo.setUpdateTime(System.currentTimeMillis()); visualizationInfo.setUpdateBy(AuthUtils.getUser().getUserId().toString()); mapper.updateById(visualizationInfo); - coreOptRecentManage.saveOpt(visualizationInfo.getId(), OptConstants.OPT_RESOURCE_TYPE.VISUALIZATION,OptConstants.OPT_TYPE.UPDATE); + coreOptRecentManage.saveOpt(visualizationInfo.getId(), OptConstants.OPT_RESOURCE_TYPE.VISUALIZATION, OptConstants.OPT_TYPE.UPDATE); } private boolean isTopNode(Long pid) { @@ -162,15 +163,15 @@ public class CoreVisualizationManage { return iPage; } - List formatResult(List pos){ - if (CollectionUtil.isEmpty(pos)){ + List formatResult(List pos) { + if (CollectionUtil.isEmpty(pos)) { return new ArrayList<>(); } return pos.stream().map(po -> new VisualizationResourceVO( po.getId(), po.getResourceId(), po.getName(), - po.getType(), String.valueOf(po.getCreator()),String.valueOf(po.getLastEditor()), po.getLastEditTime(), - po.getFavorite(),9)).toList(); + po.getType(), String.valueOf(po.getCreator()), String.valueOf(po.getLastEditor()), po.getLastEditTime(), + po.getFavorite(), 9)).toList(); } public IPage queryVisualizationPage(int goPage, int pageSize, VisualizationWorkbranchQueryRequest request) { @@ -188,6 +189,6 @@ public class CoreVisualizationManage { } queryWrapper.orderBy(true, request.isAsc(), "core_opt_recent.time"); Page page = new Page<>(goPage, pageSize); - return extDataVisualizationMapper.findRecent(page,uid, queryWrapper); + return extDataVisualizationMapper.findRecent(page, uid, queryWrapper); } }