diff --git a/src/main/java/com/ai/da/controller/GenerateController.java b/src/main/java/com/ai/da/controller/GenerateController.java index 2853debc..9ead554e 100644 --- a/src/main/java/com/ai/da/controller/GenerateController.java +++ b/src/main/java/com/ai/da/controller/GenerateController.java @@ -114,7 +114,7 @@ public class GenerateController { @ApiOperation("喜欢或取消喜欢姿势变换生成的图片") @PostMapping("/likeOrDislike") - public Response likeOrDislike(@ApiParam("id") @RequestParam Long transformedId, @ApiParam("like || dislike") @RequestParam String likeOrDislike, @RequestParam("projectId") Long projectId, @RequestParam("collectionSortParentId") Long collectionSortParentId) { + public Response likeOrDislike(@ApiParam("id") @RequestParam Long transformedId, @ApiParam("like || dislike") @RequestParam String likeOrDislike, @RequestParam("projectId") Long projectId, @RequestParam(value = "collectionSortParentId", required = false) Long collectionSortParentId) { return Response.success(generateService.disOrLikePose(transformedId, likeOrDislike, projectId, collectionSortParentId)); } diff --git a/src/main/java/com/ai/da/service/impl/GenerateServiceImpl.java b/src/main/java/com/ai/da/service/impl/GenerateServiceImpl.java index 06461ee4..b1010857 100644 --- a/src/main/java/com/ai/da/service/impl/GenerateServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/GenerateServiceImpl.java @@ -1276,11 +1276,15 @@ public class GenerateServiceImpl extends ServiceImpl i if (Objects.nonNull(poseTransformation)){ if (likeOrDislike.equals("like")){ poseTransformation.setIsLiked((byte)1); - CollectionSort collectionSort = designService.addCollectionSort(poseTransformation.getId(), CollectionType.POSE_TRANSFORM.getValue(), projectId, collectionSortParentId); - collectionSortId = collectionSort.getId(); + if (null != collectionSortParentId) { + CollectionSort collectionSort = designService.addCollectionSort(poseTransformation.getId(), CollectionType.POSE_TRANSFORM.getValue(), projectId, collectionSortParentId); + collectionSortId = collectionSort.getId(); + } }else if (likeOrDislike.equals("dislike")){ poseTransformation.setIsLiked((byte)0); - designService.deleteCollectionSort(poseTransformation.getId(), CollectionType.POSE_TRANSFORM.getValue(), projectId, collectionSortParentId); + if (null != collectionSortParentId) { + designService.deleteCollectionSort(poseTransformation.getId(), CollectionType.POSE_TRANSFORM.getValue(), projectId, collectionSortParentId); + } } poseTransformation.setUpdateTime(LocalDateTime.now()); poseTransformationMapper.updateById(poseTransformation); 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 584032a2..0a44be5a 100644 --- a/src/main/java/com/ai/da/service/impl/UserLikeGroupServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/UserLikeGroupServiceImpl.java @@ -635,11 +635,15 @@ public class UserLikeGroupServiceImpl extends ServiceImpl