src/main/java/cc/mrbird/febs/mall/controller/clothes/ApiClothesSocialController.java
@@ -94,6 +94,13 @@ return apiClothesSocialService.addCollect(dto); } @ApiOperation(value = "是否收藏点赞收藏", notes = "是否收藏点赞收藏") @PostMapping(value = "/followState") public FebsResponse followState(@RequestBody @Validated ApiSocialCollectFollowStateDto dto) { return apiClothesSocialService.followState(dto); } @ApiOperation(value = "我的社区收藏", notes = "我的社区收藏") @ApiResponses({ @ApiResponse(code = 200, message = "success", response = ApiSocialMyCollectVo.class) src/main/java/cc/mrbird/febs/mall/dto/clothes/ApiSocialCollectFollowStateDto.java
New file @@ -0,0 +1,16 @@ package cc.mrbird.febs.mall.dto.clothes; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import javax.validation.constraints.NotNull; @Data @ApiModel(value = "ApiSocialCollectFollowStateDto", description = "参数") public class ApiSocialCollectFollowStateDto { @NotNull(message = "社区不能为空") @ApiModelProperty(value = "社区ID") private Long socialId; } src/main/java/cc/mrbird/febs/mall/service/ApiClothesSocialService.java
@@ -32,4 +32,6 @@ FebsResponse allComment(ApiAllCommentDto dto); FebsResponse delCollection(ApiColletDelDto dto); FebsResponse followState(ApiSocialCollectFollowStateDto dto); } src/main/java/cc/mrbird/febs/mall/service/impl/ApiClothesSocialServiceImpl.java
@@ -669,6 +669,32 @@ return new FebsResponse().success().message("操作成功"); } @Override public FebsResponse followState(ApiSocialCollectFollowStateDto dto) { Long memberId = LoginUserUtil.getLoginUser().getId(); HashMap<String, Object> stringObjectHashMap = new HashMap<>(); Integer collectState = clothesSocialFollowMapper.selectCount( Wrappers.lambdaQuery(ClothesSocialFollow.class) .eq(ClothesSocialFollow::getMemberId, memberId) .eq(ClothesSocialFollow::getSourceType, SocialSourceTypeEnum.SOCIAL.getValue()) .eq(ClothesSocialFollow::getSourceId, dto.getSocialId()) .eq(ClothesSocialFollow::getType, SocialTypeEnum.COLLECT.getValue()) ); stringObjectHashMap.put("collectState", collectState); Integer likeState = clothesSocialFollowMapper.selectCount( Wrappers.lambdaQuery(ClothesSocialFollow.class) .eq(ClothesSocialFollow::getMemberId, memberId) .eq(ClothesSocialFollow::getSourceType, SocialSourceTypeEnum.SOCIAL.getValue()) .eq(ClothesSocialFollow::getSourceId, dto.getSocialId()) .eq(ClothesSocialFollow::getType, SocialTypeEnum.LIKE.getValue()) ); stringObjectHashMap.put("likeState", likeState); return new FebsResponse().success().data(stringObjectHashMap); } public static void main(String[] args) { JSONObject jsonObject = new JSONObject(); jsonObject.putByPath("text", "123");