From c7c6de51f730e7c15ee23682acc432af839a5bac Mon Sep 17 00:00:00 2001 From: Administrator <15274802129@163.com> Date: Tue, 06 May 2025 10:20:31 +0800 Subject: [PATCH] feat(mall): 为社交圈信息添加互动统计 --- src/main/resources/mapper/modules/HappySocialCircleMapper.xml | 3 +++ src/main/java/cc/mrbird/febs/mall/service/impl/ApiHappySocialCircleServiceImpl.java | 7 +++++++ src/main/java/cc/mrbird/febs/mall/vo/activity/ApiScInfoVo.java | 9 +++++++++ 3 files changed, 19 insertions(+), 0 deletions(-) diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiHappySocialCircleServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiHappySocialCircleServiceImpl.java index 02a33f8..f2c5f5f 100644 --- a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiHappySocialCircleServiceImpl.java +++ b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiHappySocialCircleServiceImpl.java @@ -3,9 +3,11 @@ import cc.mrbird.febs.common.entity.FebsResponse; import cc.mrbird.febs.common.enumerates.StateUpDownEnum; import cc.mrbird.febs.mall.dto.activity.ApiScInfoDto; +import cc.mrbird.febs.mall.entity.HappyFollow; import cc.mrbird.febs.mall.entity.HappySocialCircle; import cc.mrbird.febs.mall.entity.HappySocialCircleCategory; import cc.mrbird.febs.mall.entity.MallMember; +import cc.mrbird.febs.mall.mapper.HappyFollowMapper; import cc.mrbird.febs.mall.mapper.HappySocialCircleCategoryMapper; import cc.mrbird.febs.mall.mapper.HappySocialCircleMapper; import cc.mrbird.febs.mall.mapper.MallMemberMapper; @@ -14,6 +16,7 @@ import cc.mrbird.febs.mall.vo.activity.ApiScCategoryInfoVo; import cc.mrbird.febs.mall.vo.activity.ApiScInfoVo; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -23,6 +26,9 @@ import java.util.ArrayList; import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; @Slf4j @Service @@ -30,6 +36,7 @@ public class ApiHappySocialCircleServiceImpl extends ServiceImpl<HappySocialCircleMapper, HappySocialCircle> implements ApiHappySocialCircleService { private final HappySocialCircleCategoryMapper happySocialCircleCategoryMapper; + private final HappyFollowMapper happyFollowMapper; private final MallMemberMapper mallMemberMapper; @Override public FebsResponse allCategory() { diff --git a/src/main/java/cc/mrbird/febs/mall/vo/activity/ApiScInfoVo.java b/src/main/java/cc/mrbird/febs/mall/vo/activity/ApiScInfoVo.java index 48ac6e6..30e5bdb 100644 --- a/src/main/java/cc/mrbird/febs/mall/vo/activity/ApiScInfoVo.java +++ b/src/main/java/cc/mrbird/febs/mall/vo/activity/ApiScInfoVo.java @@ -33,4 +33,13 @@ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date createdTime; + @ApiModelProperty(value = "点赞数") + private Integer zanCnt; + + @ApiModelProperty(value = "关注数") + private Integer followCnt; + + @ApiModelProperty(value = "转发数") + private Integer sendCnt; + } diff --git a/src/main/resources/mapper/modules/HappySocialCircleMapper.xml b/src/main/resources/mapper/modules/HappySocialCircleMapper.xml index 44b2a40..029ef3c 100644 --- a/src/main/resources/mapper/modules/HappySocialCircleMapper.xml +++ b/src/main/resources/mapper/modules/HappySocialCircleMapper.xml @@ -9,6 +9,9 @@ b.name as memberName, a.name as name, a.CREATED_TIME as createdTime, + (select count(*) from happy_follow where source_type = 2 and DELETE_FLAG = 0 and source_id = a.id and type = 1) as followCnt, + (select count(*) from happy_follow where source_type = 2 and DELETE_FLAG = 0 and source_id = a.id and type = 2) as zanCnt, + (select count(*) from happy_follow where source_type = 2 and DELETE_FLAG = 0 and source_id = a.id and type = 3) as sendCnt, a.index_file as indexFile from happy_social_circle a left join mall_member b on a.member_id = b.id -- Gitblit v1.9.1