新增关注博主-支持删除
This commit is contained in:
@@ -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 等价于 InnerJoin(u必须存在)
|
||||
.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>
|
||||
/// 分页查询收藏视频
|
||||
|
||||
Reference in New Issue
Block a user