新增关注博主-支持删除

This commit is contained in:
jianzhichu
2025-12-02 13:00:05 +08:00
parent de5813a874
commit 4b2f9aaa7c
12 changed files with 318 additions and 96 deletions
+16
View File
@@ -14,6 +14,22 @@ namespace dy.net.repository
}
public async Task<List<DouyinFollowGroupDto>> GetDouyinFollowGroup()
{
var data = this.Db.Queryable<DouyinFollowed>()
.LeftJoin<DouyinCookie>((f, u) => f.mySelfId == u.MyUserId)
.Where((f, u) => u.Status == 1) // 注意:LeftJoin+u.Status==1 等价于 InnerJoinu必须存在)
.GroupBy((f, u) => f.mySelfId) // 按 mySelfId 分组
.Select((f, u) => new DouyinFollowGroupDto
{
Key = f.mySelfId, // 分组键(mySelfId
Name = u.UserName, // 取每组的 UserName(因分组唯一,用 First() 兼容 SQL
Total = SqlFunc.AggregateCount(f.Id) // 统计每组的记录数(用主表主键避免 null 影响)
})
.ToList(); // 执行查询
return data;
}
/// <summary>
/// 分页查询收藏视频