From c5e9941adb6cdb5cd5eb207493962acc2360e450 Mon Sep 17 00:00:00 2001 From: shahaibo <1023316923@qq.com> Date: Fri, 20 Sep 2024 11:31:48 +0800 Subject: [PATCH] =?UTF-8?q?BUGFIX:design=20colorboard=E5=85=83=E7=B4=A0?= =?UTF-8?q?=E6=B7=B7=E5=85=A5sketchboard;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/CollectionElementServiceImpl.java | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/ai/da/service/impl/CollectionElementServiceImpl.java b/src/main/java/com/ai/da/service/impl/CollectionElementServiceImpl.java index 521b4ab0..222fdbf5 100644 --- a/src/main/java/com/ai/da/service/impl/CollectionElementServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/CollectionElementServiceImpl.java @@ -78,6 +78,9 @@ public class CollectionElementServiceImpl extends ServiceImpl sketchBoards) { if (CollectionUtil.isNotEmpty(sketchBoards)) { - sketchBoards.forEach(sketchBoard -> { + List collect = sketchBoards.stream().filter(o -> o.getDesignType().equals(DesignTypeEnum.COLLECTION.getRealName())).collect(Collectors.toList()); + collect.forEach(sketchBoard -> { CollectionElement collectionElement = CopyUtil.copyObject(sketchBoard, CollectionElement.class); collectionElement.setHasPin(sketchBoard.getIsPin()); collectionElement.setId(sketchBoard.getSketchBoardId()); collectionElementMapper.updateById(collectionElement); }); - List sketchBoardIds = sketchBoards.stream().map(CollectionSketchDTO::getSketchBoardId).collect(Collectors.toList()); - List sketchBoardElements = collectionElementMapper.selectBatchIds(sketchBoardIds); - elementVO.setSketchBoardElements(sketchBoardElements); + List sketchBoardIds = collect.stream().map(CollectionSketchDTO::getSketchBoardId).collect(Collectors.toList()); + if (!CollectionUtils.isEmpty(sketchBoardIds)) { + List sketchBoardElements = collectionElementMapper.selectBatchIds(sketchBoardIds); + elementVO.setSketchBoardElements(sketchBoardElements); + }else { + elementVO.setSketchBoardElements(new ArrayList<>()); + } } } @Override public void editPrintBoardsElement(ValidateElementVO elementVO, List printBoards) { if (CollectionUtil.isNotEmpty(printBoards)) { - printBoards.forEach(printBoard -> { + List collect = printBoards.stream().filter(o -> o.getDesignType().equals(DesignTypeEnum.COLLECTION.getRealName())).collect(Collectors.toList()); + collect.forEach(printBoard -> { CollectionElement collectionElement = CopyUtil.copyObject(printBoard, CollectionElement.class); collectionElement.setHasPin(Objects.isNull(printBoard.getIsPin()) ? 0 : printBoard.getIsPin()); collectionElement.setId(printBoard.getId()); collectionElementMapper.updateById(collectionElement); }); - List printBoardIds = printBoards.stream().map(DesignCollectionPrintElementDTO::getId).collect(Collectors.toList()); - List printBoardElements = collectionElementMapper.selectBatchIds(printBoardIds); - elementVO.setPrintBoardElements(printBoardElements); + List printBoardIds = collect.stream().map(DesignCollectionPrintElementDTO::getId).collect(Collectors.toList()); + if (!CollectionUtils.isEmpty(printBoardIds)) { + List printBoardElements = collectionElementMapper.selectBatchIds(printBoardIds); + elementVO.setPrintBoardElements(printBoardElements); + }else { + elementVO.setPrintBoardElements(new ArrayList<>()); + } } }