From d379f778dcf612cd796c7b73eabeaf6ba98d3590 Mon Sep 17 00:00:00 2001 From: xupei Date: Tue, 8 Jul 2025 14:29:54 +0800 Subject: [PATCH] =?UTF-8?q?TASK:=20=E9=BB=98=E8=AE=A4=E4=B8=8Dlike?= =?UTF-8?q?=E7=9A=84=E5=85=83=E7=B4=A0=EF=BC=8C=E5=A6=82=E6=9C=89parentId?= =?UTF-8?q?=EF=BC=8C=E9=9C=80=E8=A6=81=E6=B7=BB=E5=8A=A0=E5=88=B0Collectio?= =?UTF-8?q?nSort=E8=A1=A8=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/ai/da/service/DesignService.java | 2 ++ .../com/ai/da/service/impl/DesignServiceImpl.java | 12 ++++++++++++ .../ai/da/service/impl/UserLikeGroupServiceImpl.java | 12 +++++++++++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/ai/da/service/DesignService.java b/src/main/java/com/ai/da/service/DesignService.java index 0c9c3957..32723fd5 100644 --- a/src/main/java/com/ai/da/service/DesignService.java +++ b/src/main/java/com/ai/da/service/DesignService.java @@ -63,6 +63,8 @@ public interface DesignService extends IService { CollectionSort addCollectionSort(Long relationId, String relationType, Long projectId, Long parentId); + CollectionSort queryCollectionSortByRelation(Long relationId, String relationType, Long projectId); + int getNextSort(Long projectId, Long parentId); /** 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 6cd85d12..ff0651a3 100644 --- a/src/main/java/com/ai/da/service/impl/DesignServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/DesignServiceImpl.java @@ -1262,6 +1262,10 @@ public class DesignServiceImpl extends ServiceImpl impleme @Override public CollectionSort addCollectionSort(Long relationId, String relationType, Long projectId, Long collectionSortParentId) { + CollectionSort collectionSort = queryCollectionSortByRelation(relationId, relationType, projectId); + if (Objects.nonNull(collectionSort)){ + return collectionSort; + } int sort = getNextSort(projectId, collectionSortParentId); CollectionSort userLikeSort = new CollectionSort(); // userLikeSort.setUserLikeGroupId(userGroupId); @@ -1278,6 +1282,14 @@ public class DesignServiceImpl extends ServiceImpl impleme return userLikeSort; } + public CollectionSort queryCollectionSortByRelation(Long relationId, String relationType, Long projectId){ + QueryWrapper qw = new QueryWrapper<>(); + qw.lambda().eq(CollectionSort::getProjectId, projectId). + eq(CollectionSort::getRelationId, relationId). + eq(CollectionSort::getRelationType, relationType); + return collectionSortMapper.selectOne(qw); + } + @Override public int getNextSort(Long projectId, Long parentId) { QueryWrapper qw = new QueryWrapper<>(); diff --git a/src/main/java/com/ai/da/service/impl/UserLikeGroupServiceImpl.java b/src/main/java/com/ai/da/service/impl/UserLikeGroupServiceImpl.java index 915cfc98..7fbe1ada 100644 --- a/src/main/java/com/ai/da/service/impl/UserLikeGroupServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/UserLikeGroupServiceImpl.java @@ -500,6 +500,8 @@ public class UserLikeGroupServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); queryWrapper.eq("account_id", authPrincipalVo.getId()); - queryWrapper.eq("id", query.getId()); + if (Objects.nonNull(query.getId())){ + queryWrapper.eq("id", query.getId()); + } // queryWrapper.isNull("parent_id"); if (!StringUtils.isEmpty(query.getProjectName())) { queryWrapper.like("name", query.getProjectName());