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());