TASK:collection sort;
This commit is contained in:
@@ -4,7 +4,7 @@ import lombok.Data;
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class CollectionLikeUpdateDTO {
|
public class CollectionLikeUpdateDTO {
|
||||||
private Long userLikeSortId;
|
private Long oldRelationId;
|
||||||
private Long relationId;
|
private Long relationId;
|
||||||
private String relationType;
|
private String relationType;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2470,22 +2470,25 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
|||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public Boolean collectionLikeUpdate(CollectionLikeUpdateDTO collectionLikeUpdateDTO) {
|
public Boolean collectionLikeUpdate(CollectionLikeUpdateDTO collectionLikeUpdateDTO) {
|
||||||
CollectionSort collectionSort = collectionSortMapper.selectById(collectionLikeUpdateDTO.getUserLikeSortId());
|
QueryWrapper<CollectionSort> qw = new QueryWrapper<>();
|
||||||
Long relationIdOld = collectionSort.getRelationId();
|
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());
|
collectionSort.setRelationId(collectionLikeUpdateDTO.getRelationId());
|
||||||
collectionSortMapper.updateById(collectionSort);
|
collectionSortMapper.updateById(collectionSort);
|
||||||
if (collectionLikeUpdateDTO.getRelationType().equals(CollectionType.TO_PRODUCT_IMAGE.getValue()) || collectionLikeUpdateDTO.getRelationType().equals(CollectionType.RELIGHT.getValue())) {
|
if (collectionLikeUpdateDTO.getRelationType().equals(CollectionType.TO_PRODUCT_IMAGE.getValue()) || collectionLikeUpdateDTO.getRelationType().equals(CollectionType.RELIGHT.getValue())) {
|
||||||
ToProductImageResult toProductImageResult = toProductImageResultMapper.selectById(collectionLikeUpdateDTO.getRelationId());
|
ToProductImageResult toProductImageResult = toProductImageResultMapper.selectById(collectionLikeUpdateDTO.getRelationId());
|
||||||
toProductImageResult.setIsLike(1);
|
toProductImageResult.setIsLike(1);
|
||||||
toProductImageResultMapper.updateById(toProductImageResult);
|
toProductImageResultMapper.updateById(toProductImageResult);
|
||||||
ToProductImageResult toProductImageResultOld = toProductImageResultMapper.selectById(relationIdOld);
|
ToProductImageResult toProductImageResultOld = toProductImageResultMapper.selectById(collectionLikeUpdateDTO.getOldRelationId());
|
||||||
toProductImageResultOld.setIsLike(0);
|
toProductImageResultOld.setIsLike(0);
|
||||||
toProductImageResultMapper.updateById(toProductImageResultOld);
|
toProductImageResultMapper.updateById(toProductImageResultOld);
|
||||||
}else if (collectionLikeUpdateDTO.getRelationType().equals(CollectionType.POSE_TRANSFORM.getValue())) {
|
}else if (collectionLikeUpdateDTO.getRelationType().equals(CollectionType.POSE_TRANSFORM.getValue())) {
|
||||||
PoseTransformation poseTransformation = poseTransformationMapper.selectById(collectionLikeUpdateDTO.getRelationId());
|
PoseTransformation poseTransformation = poseTransformationMapper.selectById(collectionLikeUpdateDTO.getRelationId());
|
||||||
poseTransformation.setIsLiked((byte) 1);
|
poseTransformation.setIsLiked((byte) 1);
|
||||||
poseTransformationMapper.updateById(poseTransformation);
|
poseTransformationMapper.updateById(poseTransformation);
|
||||||
PoseTransformation poseTransformationOld = poseTransformationMapper.selectById(relationIdOld);
|
PoseTransformation poseTransformationOld = poseTransformationMapper.selectById(collectionLikeUpdateDTO.getOldRelationId());
|
||||||
poseTransformationOld.setIsLiked((byte) 0);
|
poseTransformationOld.setIsLiked((byte) 0);
|
||||||
poseTransformationMapper.updateById(poseTransformationOld);
|
poseTransformationMapper.updateById(poseTransformationOld);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user