diff --git a/src/main/java/com/ai/da/service/impl/DesignServiceImpl.java b/src/main/java/com/ai/da/service/impl/DesignServiceImpl.java index aa8c2f13..66367b93 100644 --- a/src/main/java/com/ai/da/service/impl/DesignServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/DesignServiceImpl.java @@ -1332,14 +1332,16 @@ public class DesignServiceImpl extends ServiceImpl impleme qw.lambda().orderByDesc(CollectionSort::getSort); List userLikeSorts = collectionSortMapper.selectList(qw); CollectionSort userLikeSort = getUserLikeSortByUserLikeId(relationId, relationType, projectId); - Long userLikeSortId = userLikeSort.getId(); - for (CollectionSort likeSort : userLikeSorts) { - if (Objects.equals(likeSort.getId(), userLikeSortId)) { - collectionSortMapper.deleteById(likeSort); - break; - }else { - likeSort.setSort(likeSort.getSort() - 1); - collectionSortMapper.updateById(likeSort); + if (Objects.nonNull(userLikeSort)) { + Long userLikeSortId = userLikeSort.getId(); + for (CollectionSort likeSort : userLikeSorts) { + if (Objects.equals(likeSort.getId(), userLikeSortId)) { + collectionSortMapper.deleteById(likeSort); + break; + }else { + likeSort.setSort(likeSort.getSort() - 1); + collectionSortMapper.updateById(likeSort); + } } } }