From 442e87267a9ac6fc55303726679023b92898f5e1 Mon Sep 17 00:00:00 2001 From: shahaibo <1023316923@qq.com> Date: Tue, 3 Jun 2025 13:41:45 +0800 Subject: [PATCH] =?UTF-8?q?TASK:collection=20sort=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ai/da/model/dto/CollectionLikeUpdateDTO.java | 2 +- .../ai/da/service/impl/UserLikeGroupServiceImpl.java | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/ai/da/model/dto/CollectionLikeUpdateDTO.java b/src/main/java/com/ai/da/model/dto/CollectionLikeUpdateDTO.java index 7bf99ea5..5c5af656 100644 --- a/src/main/java/com/ai/da/model/dto/CollectionLikeUpdateDTO.java +++ b/src/main/java/com/ai/da/model/dto/CollectionLikeUpdateDTO.java @@ -4,7 +4,7 @@ import lombok.Data; @Data public class CollectionLikeUpdateDTO { - private Long userLikeSortId; + private Long oldRelationId; private Long relationId; private String relationType; } 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 6af6892f..ee5d8354 100644 --- a/src/main/java/com/ai/da/service/impl/UserLikeGroupServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/UserLikeGroupServiceImpl.java @@ -2470,22 +2470,25 @@ public class UserLikeGroupServiceImpl extends ServiceImpl qw = new QueryWrapper<>(); + qw.lambda().eq(CollectionSort::getRelationId, collectionLikeUpdateDTO.getOldRelationId()); + qw.lambda().eq(CollectionSort::getRelationType, collectionLikeUpdateDTO.getRelationType()); + CollectionSort collectionSort = collectionSortMapper.selectOne(qw); +// Long relationIdOld = collectionSort.getRelationId(); collectionSort.setRelationId(collectionLikeUpdateDTO.getRelationId()); collectionSortMapper.updateById(collectionSort); if (collectionLikeUpdateDTO.getRelationType().equals(CollectionType.TO_PRODUCT_IMAGE.getValue()) || collectionLikeUpdateDTO.getRelationType().equals(CollectionType.RELIGHT.getValue())) { ToProductImageResult toProductImageResult = toProductImageResultMapper.selectById(collectionLikeUpdateDTO.getRelationId()); toProductImageResult.setIsLike(1); toProductImageResultMapper.updateById(toProductImageResult); - ToProductImageResult toProductImageResultOld = toProductImageResultMapper.selectById(relationIdOld); + ToProductImageResult toProductImageResultOld = toProductImageResultMapper.selectById(collectionLikeUpdateDTO.getOldRelationId()); toProductImageResultOld.setIsLike(0); toProductImageResultMapper.updateById(toProductImageResultOld); }else if (collectionLikeUpdateDTO.getRelationType().equals(CollectionType.POSE_TRANSFORM.getValue())) { PoseTransformation poseTransformation = poseTransformationMapper.selectById(collectionLikeUpdateDTO.getRelationId()); poseTransformation.setIsLiked((byte) 1); poseTransformationMapper.updateById(poseTransformation); - PoseTransformation poseTransformationOld = poseTransformationMapper.selectById(relationIdOld); + PoseTransformation poseTransformationOld = poseTransformationMapper.selectById(collectionLikeUpdateDTO.getOldRelationId()); poseTransformationOld.setIsLiked((byte) 0); poseTransformationMapper.updateById(poseTransformationOld); }