lihao 4 年之前
父節點
當前提交
dc5f6b8134

+ 4 - 2
gx_api/GxPress/Repository/GxPress.Repository.Implement/AddressBookGroupUserRepository.cs

@@ -70,7 +70,9 @@ namespace GxPress.Repository.Implement
         {
             var result = new AddressBookGroupUserListResult();
             //sql
-            var sql = $"select b.Id,b.AddressBookGroupId,a.Id as UserId,a.Name as UserName,a.AvatarUrl,a.ImId from tede_user a inner join tede_address_book_group_user b on a.Id=b.UserId where b. AddressBookGroupId={request.AddressBookGroupId} order by b.Sort desc";
+            var sql = $@"select b.Id,b.AddressBookGroupId,a.Id as UserId,a.Name as UserName,a.AvatarUrl,a.ImId from tede_user a 
+                        inner join tede_address_book_group_user b on a.Id=b.UserId 
+                        where b. AddressBookGroupId={request.AddressBookGroupId}";
             var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
             var database = new Database(databaseType, _connectionString);
             var connection = database.GetConnection();
@@ -91,7 +93,7 @@ namespace GxPress.Repository.Implement
             result.AddressBookGroupUsers = userlist;
             result.AddressBookGroups =
                 await _addressBookGroupRepository.GetAllAsync(Q.Where(nameof(AddressBookGroup.ParentId),
-                    request.AddressBookGroupId).Where(nameof(AddressBookGroup.UserId), userId));
+                    request.AddressBookGroupId).Where(nameof(AddressBookGroup.UserId), userId).OrderByDesc(nameof(AddressBookGroup.Sort)));
             return result;
         }