|
@@ -439,8 +439,18 @@ namespace GxPress.Repository.Implement
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
public async Task<IEnumerable<GroupChat>> GetGroupChatsAsync(int userId)
|
|
public async Task<IEnumerable<GroupChat>> GetGroupChatsAsync(int userId)
|
|
{
|
|
{
|
|
- string sql = $@"SELECT * FROM ccpph_tede.tede_group_chat where id in(
|
|
|
|
- select GroupChatId from tede_group_chat_user where UserId={userId}) order by CreatedDate desc";
|
|
|
|
|
|
+ string sql = $@"SELECT
|
|
|
|
+ *,(select count(1) from tede_group_chat_user where GroupChatId=a.Id) as UserCount
|
|
|
|
+ FROM
|
|
|
|
+ tede_group_chat a
|
|
|
|
+ WHERE
|
|
|
|
+ a.id IN (SELECT
|
|
|
|
+ GroupChatId
|
|
|
|
+ FROM
|
|
|
|
+ tede_group_chat_user
|
|
|
|
+ WHERE
|
|
|
|
+ UserId = {userId})
|
|
|
|
+ ORDER BY a.CreatedDate DESC";
|
|
var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
|
|
var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
|
|
var database = new Database(databaseType, _connectionString);
|
|
var database = new Database(databaseType, _connectionString);
|
|
var connection = database.GetConnection();
|
|
var connection = database.GetConnection();
|