feat:朋友圈我喜欢的、喜欢我的等总数统计

This commit is contained in:
dzc committed 2025-11-26 16:21:43 +08:00
1 parent 1aa8a2213e
commit 6c125d87b5
6 files changed
+52 -1

No files matched your search

@@ -16,6 +16,12 @@ public class OperationTotalGroupRecentRespVO {
@Schema(description = "朋友圈点赞总数")
private Integer likeTotal = 0;
@Schema(description = "朋友圈我点赞总数")
private Integer likeItTotal = 0;
@Schema(description = "朋友圈点赞我总数")
private Integer likeMeTotal = 0;
@Schema(description = "朋友圈举报总数")
private Integer reportTotal = 0;
@@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.member.controller.admin.recent.vo.OperationRespVO;
import cn.iocoder.yudao.module.member.controller.admin.recent.vo.OperationTotalGroupRecentRespVO;
import cn.iocoder.yudao.module.member.controller.admin.recent.vo.RecentPageResVo;
import cn.iocoder.yudao.module.member.controller.admin.recent.vo.RecentSaveReqVO;
import cn.iocoder.yudao.module.member.controller.app.recent.vo.*;
@@ -93,4 +94,10 @@ public class AppRecentController {
return success(recentService.evaluatePage(dto));
}
@GetMapping("/total")
@Operation(summary = "朋友圈我喜欢的、喜欢我的等总数统计")
public CommonResult<OperationTotalGroupRecentRespVO> total() {
return success(recentService.total(getLoginUserId()));
}
}
@@ -45,4 +45,6 @@ public interface OperationMapper extends BaseMapperX<OperationDO> {
}
List<OperationTotalGroupRecentRespVO> totalGroupRecent(@Param("dto") OperationPageReqVO dto);
OperationTotalGroupRecentRespVO totalGroupRecentByUser(@Param("userId") Long userId);
}
@@ -78,4 +78,9 @@ public interface RecentService {
* 我的评价
*/
PageResult<OperationRespVO> evaluatePage(@Valid AppRecentLikeReqVo dto);
/**
* 朋友圈我喜欢的、喜欢我的等总数统计
*/
OperationTotalGroupRecentRespVO total(Long userId);
}
@@ -359,6 +359,18 @@ public class RecentServiceImpl implements RecentService {
return new PageResult<>(resultList, pageList.getTotal());
}
/**
* 朋友圈我喜欢的、喜欢我的等总数统计
*/
@Override
public OperationTotalGroupRecentRespVO total(Long userId) {
OperationTotalGroupRecentRespVO total = operationMapper.totalGroupRecentByUser(userId);
if (ObjectUtil.isNotEmpty(total)) {
return total;
}
return new OperationTotalGroupRecentRespVO();
}
private void validateRecentExists(Long id) {
if (recentMapper.selectById(id) == null) {
throw exception(MemberErrorCode.RECENT_NOT_EXISTS);
@@ -26,7 +26,10 @@
<select id="totalGroupRecent"
resultType="cn.iocoder.yudao.module.member.controller.admin.recent.vo.OperationTotalGroupRecentRespVO">
select sum(if(a.biz_type = '1', 1, 0)) as likeTotal,
select
sum(if(a.biz_type = '1', 1, 0)) as likeTotal,
sum(if(a.biz_type = '1' and a.operator_member_id = #{userId}, 1, 0)) as likeItTotal,
sum(if(a.biz_type = '1' and a.member_id = #{userId}, 1, 0)) as likeMeTotal,
sum(if(a.biz_type = '2', 1, 0)) as reportTotal,
sum(if(a.biz_type = '3', 1, 0)) as shieldTotal,
sum(if(a.biz_type = '4', 1, 0)) as collectTotal,
@@ -38,4 +41,20 @@
</where>
group by a.biz_type, a.member_recent_id
</select>
<select id="totalGroupRecentByUser"
resultType="cn.iocoder.yudao.module.member.controller.admin.recent.vo.OperationTotalGroupRecentRespVO">
select sum(if(a.biz_type = '1', 1, 0)) as likeTotal,
sum(if(a.biz_type = '1' and a.operator_member_id = #{userId}, 1, 0)) as likeItTotal,
sum(if(a.biz_type = '1' and a.member_id = #{userId}, 1, 0)) as likeMeTotal,
sum(if(a.biz_type = '2', 1, 0)) as reportTotal,
sum(if(a.biz_type = '3', 1, 0)) as shieldTotal,
sum(if(a.biz_type = '4', 1, 0)) as collectTotal,
a.biz_type as bizType,
a.member_recent_id as memberRecentId
from member_operation a
where a.deleted = 0
and (a.operator_member_id = #{userId} or a.member_id = #{userId})
</select>
</mapper>