|
@@ -435,21 +435,24 @@ namespace GxPress.Repository.Implement
|
|
|
/// <summary>
|
|
|
/// 获取用户加入的群
|
|
|
/// </summary>
|
|
|
- /// <param name="userId"></param>
|
|
|
+ /// <param name="request"></param>
|
|
|
/// <returns></returns>
|
|
|
- public async Task<IEnumerable<GroupChat>> GetGroupChatsAsync(int userId)
|
|
|
+ public async Task<IEnumerable<GroupChat>> GetGroupChatsAsync(GroupChatSearchRequest request)
|
|
|
{
|
|
|
+ var sqlStr = string.Empty;
|
|
|
+ if (!string.IsNullOrEmpty(request.KeyWord))
|
|
|
+ sqlStr = $" and a.Name like '%{request.KeyWord}%'";
|
|
|
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
|
|
|
+ 1=1 {sqlStr} and a.id IN (SELECT
|
|
|
GroupChatId
|
|
|
FROM
|
|
|
tede_group_chat_user
|
|
|
WHERE
|
|
|
- UserId = {userId})
|
|
|
+ UserId = {request.UserId})
|
|
|
ORDER BY a.CreatedDate DESC";
|
|
|
var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
|
|
|
var database = new Database(databaseType, _connectionString);
|