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