TASK: collection sort;

This commit is contained in:
shahaibo
2025-06-17 10:10:00 +08:00
parent 93bb8d2f31
commit 0970127f68
5 changed files with 14 additions and 14 deletions

View File

@@ -114,8 +114,8 @@ public class GenerateController {
@ApiOperation("喜欢或取消喜欢姿势变换生成的图片") @ApiOperation("喜欢或取消喜欢姿势变换生成的图片")
@PostMapping("/likeOrDislike") @PostMapping("/likeOrDislike")
public Response<Object> likeOrDislike(@ApiParam("id") @RequestParam Long transformedId, @ApiParam("like || dislike") @RequestParam String likeOrDislike, @RequestParam("projectId") Long projectId, @RequestParam("sortLikeParentId") Long sortLikeParentId) { public Response<Object> likeOrDislike(@ApiParam("id") @RequestParam Long transformedId, @ApiParam("like || dislike") @RequestParam String likeOrDislike, @RequestParam("projectId") Long projectId, @RequestParam("collectionSortParentId") Long collectionSortParentId) {
return Response.success(generateService.disOrLikePose(transformedId, likeOrDislike, projectId, sortLikeParentId)); return Response.success(generateService.disOrLikePose(transformedId, likeOrDislike, projectId, collectionSortParentId));
} }
@ApiOperation(value = "修改模特比例") @ApiOperation(value = "修改模特比例")

View File

@@ -9,5 +9,5 @@ public class ProductImageLikeDTO {
private List<Long> toProductImageResultId; private List<Long> toProductImageResultId;
private Long projectId; private Long projectId;
private Long sortLikeParentId; private Long collectionSortParentId;
} }

View File

@@ -1247,8 +1247,8 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
} }
@Override @Override
public CollectionSort addCollectionSort(Long relationId, String relationType, Long projectId, Long sortParentId) { public CollectionSort addCollectionSort(Long relationId, String relationType, Long projectId, Long collectionSortParentId) {
int sort = getNextSort(projectId, sortParentId); int sort = getNextSort(projectId, collectionSortParentId);
CollectionSort userLikeSort = new CollectionSort(); CollectionSort userLikeSort = new CollectionSort();
// userLikeSort.setUserLikeGroupId(userGroupId); // userLikeSort.setUserLikeGroupId(userGroupId);
// userLikeSort.setUserLikeId(relationId); // userLikeSort.setUserLikeId(relationId);
@@ -1256,8 +1256,8 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
userLikeSort.setRelationId(relationId); userLikeSort.setRelationId(relationId);
userLikeSort.setRelationType(relationType); userLikeSort.setRelationType(relationType);
userLikeSort.setSort(sort); userLikeSort.setSort(sort);
if (null != sortParentId) { if (null != collectionSortParentId) {
userLikeSort.setParentId(sortParentId); userLikeSort.setParentId(collectionSortParentId);
} }
collectionSortMapper.insert(userLikeSort); collectionSortMapper.insert(userLikeSort);
return userLikeSort; return userLikeSort;

View File

@@ -1255,17 +1255,17 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
return vos; return vos;
} }
public Object disOrLikePose(Long transformedId, String likeOrDislike, Long projectId, Long sortLikeParentId){ public Object disOrLikePose(Long transformedId, String likeOrDislike, Long projectId, Long collectionSortParentId){
PoseTransformation poseTransformation = poseTransformationMapper.selectById(transformedId); PoseTransformation poseTransformation = poseTransformationMapper.selectById(transformedId);
Long collectionSortId = null; Long collectionSortId = null;
if (Objects.nonNull(poseTransformation)){ if (Objects.nonNull(poseTransformation)){
if (likeOrDislike.equals("like")){ if (likeOrDislike.equals("like")){
poseTransformation.setIsLiked((byte)1); poseTransformation.setIsLiked((byte)1);
CollectionSort collectionSort = designService.addCollectionSort(poseTransformation.getId(), CollectionType.POSE_TRANSFORM.getValue(), projectId, sortLikeParentId); CollectionSort collectionSort = designService.addCollectionSort(poseTransformation.getId(), CollectionType.POSE_TRANSFORM.getValue(), projectId, collectionSortParentId);
collectionSortId = collectionSort.getId(); collectionSortId = collectionSort.getId();
}else if (likeOrDislike.equals("dislike")){ }else if (likeOrDislike.equals("dislike")){
poseTransformation.setIsLiked((byte)0); poseTransformation.setIsLiked((byte)0);
designService.deleteCollectionSort(poseTransformation.getId(), CollectionType.POSE_TRANSFORM.getValue(), projectId, sortLikeParentId); designService.deleteCollectionSort(poseTransformation.getId(), CollectionType.POSE_TRANSFORM.getValue(), projectId, collectionSortParentId);
} }
poseTransformation.setUpdateTime(LocalDateTime.now()); poseTransformation.setUpdateTime(LocalDateTime.now());
poseTransformationMapper.updateById(poseTransformation); poseTransformationMapper.updateById(poseTransformation);

View File

@@ -618,10 +618,10 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
ToProductImageResult toProductImageResult1 = toProductImageResultMapper.selectById(toProductImageResultId.get(0)); ToProductImageResult toProductImageResult1 = toProductImageResultMapper.selectById(toProductImageResultId.get(0));
Long collectionSortId = null; Long collectionSortId = null;
if (toProductImageResult1.getResultType().equals("Relight")) { if (toProductImageResult1.getResultType().equals("Relight")) {
CollectionSort collectionSort = designService.addCollectionSort(toProductImageResult1.getId(), CollectionType.RELIGHT.getValue(), productImageLikeDTO.getProjectId(), productImageLikeDTO.getSortLikeParentId()); CollectionSort collectionSort = designService.addCollectionSort(toProductImageResult1.getId(), CollectionType.RELIGHT.getValue(), productImageLikeDTO.getProjectId(), productImageLikeDTO.getCollectionSortParentId());
collectionSortId = collectionSort.getId(); collectionSortId = collectionSort.getId();
}else { }else {
CollectionSort collectionSort = designService.addCollectionSort(toProductImageResult1.getId(), CollectionType.TO_PRODUCT_IMAGE.getValue(), productImageLikeDTO.getProjectId(), productImageLikeDTO.getSortLikeParentId()); CollectionSort collectionSort = designService.addCollectionSort(toProductImageResult1.getId(), CollectionType.TO_PRODUCT_IMAGE.getValue(), productImageLikeDTO.getProjectId(), productImageLikeDTO.getCollectionSortParentId());
collectionSortId = collectionSort.getId(); collectionSortId = collectionSort.getId();
} }
return collectionSortId; return collectionSortId;
@@ -860,9 +860,9 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
toProductImageResult.setIsLike(0); toProductImageResult.setIsLike(0);
toProductImageResultMapper.updateById(toProductImageResult); toProductImageResultMapper.updateById(toProductImageResult);
if (toProductImageResult.getResultType().equals("Relight")) { if (toProductImageResult.getResultType().equals("Relight")) {
designService.deleteCollectionSort(toProductImageResult.getId(), CollectionType.RELIGHT.getValue(), productImageLikeDTO.getProjectId(), productImageLikeDTO.getSortLikeParentId()); designService.deleteCollectionSort(toProductImageResult.getId(), CollectionType.RELIGHT.getValue(), productImageLikeDTO.getProjectId(), productImageLikeDTO.getCollectionSortParentId());
}else { }else {
designService.deleteCollectionSort(toProductImageResult.getId(), CollectionType.TO_PRODUCT_IMAGE.getValue(), productImageLikeDTO.getProjectId(), productImageLikeDTO.getSortLikeParentId()); designService.deleteCollectionSort(toProductImageResult.getId(), CollectionType.TO_PRODUCT_IMAGE.getValue(), productImageLikeDTO.getProjectId(), productImageLikeDTO.getCollectionSortParentId());
} }
} }
return Boolean.TRUE; return Boolean.TRUE;