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("喜欢或取消喜欢姿势变换生成的图片")
@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) {
return Response.success(generateService.disOrLikePose(transformedId, likeOrDislike, projectId, 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, collectionSortParentId));
}
@ApiOperation(value = "修改模特比例")

View File

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

View File

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

View File

@@ -1255,17 +1255,17 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
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);
Long collectionSortId = null;
if (Objects.nonNull(poseTransformation)){
if (likeOrDislike.equals("like")){
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();
}else if (likeOrDislike.equals("dislike")){
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());
poseTransformationMapper.updateById(poseTransformation);

View File

@@ -618,10 +618,10 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
ToProductImageResult toProductImageResult1 = toProductImageResultMapper.selectById(toProductImageResultId.get(0));
Long collectionSortId = null;
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();
}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();
}
return collectionSortId;
@@ -860,9 +860,9 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
toProductImageResult.setIsLike(0);
toProductImageResultMapper.updateById(toProductImageResult);
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 {
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;