李昊 4 年之前
父节点
当前提交
6483b8189e

+ 10 - 0
gx_api/GxPress/Api/GxPress.Api/WebControllers/WebNoteController.cs

@@ -136,5 +136,15 @@ namespace GxPress.Api.WebControllers
             request.UserId = _loginContext.AccountId;
             return await _noteService.GetNoteNotFolderPageResult(request);
         }
+        /// <summary>
+        /// 笔记设置置顶
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        [HttpPut("{id}")]
+        public async Task<bool> SetIsTopAsync(int id)
+        {
+            return await noteRepository.SetIsTopAsync(id);
+        }
     }
 }

+ 5 - 0
gx_api/GxPress/Model/GxPress.Entity/GroupChat.cs

@@ -61,5 +61,10 @@ namespace GxPress.Entity
         /// </summary>
         [DataColumn]
         public bool IsOpenQrCoder { get; set; }
+        /// <summary>
+        /// 人数
+        /// </summary>
+        /// <value></value>
+        public int UserCount { get; set; }
     }
 }

+ 12 - 2
gx_api/GxPress/Repository/GxPress.Repository.Implement/GroupChatRepository.cs

@@ -439,8 +439,18 @@ namespace GxPress.Repository.Implement
         /// <returns></returns>
         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 database = new Database(databaseType, _connectionString);
             var connection = database.GetConnection();