|
@@ -510,6 +510,42 @@ namespace GxPress.Repository.Implement
|
|
}
|
|
}
|
|
return items;
|
|
return items;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 或者最近使用的小组
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="userId"></param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ public async Task<IEnumerable<LatelyGroupDetailResult>> GetLatelyGroupDetailResultAsync(int userId)
|
|
|
|
+ {
|
|
|
|
+ string sql = $@"
|
|
|
|
+ SELECT
|
|
|
|
+ a.Id,
|
|
|
|
+ a.Name,
|
|
|
|
+ a.AvatarUrl,
|
|
|
|
+ (SELECT
|
|
|
|
+ COUNT(1)
|
|
|
|
+ FROM
|
|
|
|
+ tede_group_user
|
|
|
|
+ WHERE
|
|
|
|
+ GroupId = a.Id) AS UserCount
|
|
|
|
+ FROM
|
|
|
|
+ tede_group a
|
|
|
|
+ WHERE
|
|
|
|
+ a.Id IN (SELECT
|
|
|
|
+ GroupId
|
|
|
|
+ FROM
|
|
|
|
+ tede_topic
|
|
|
|
+ WHERE
|
|
|
|
+ GroupId > 0 AND UserId ={userId}
|
|
|
|
+ ORDER BY CreatedDate DESC)";
|
|
|
|
+ var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
|
|
|
|
+ var database = new Database(databaseType, _connectionString);
|
|
|
|
+ var connection = database.GetConnection();
|
|
|
|
+ var items = await connection
|
|
|
|
+ .QueryAsync<LatelyGroupDetailResult>(sql);
|
|
|
|
+ foreach (var item in items)
|
|
|
|
+ item.AvatarUrl = StringUtils.AddDomain(item.AvatarUrl);
|
|
|
|
+ return items;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|