李昊 4 年之前
父节点
当前提交
5f5f2ec0d0

+ 1 - 1
gx_api/GxPress/Model/GxPress.EnumConst/AllTypeConst.cs

@@ -19,7 +19,7 @@ namespace GxPress.EnumConst
         Collect = 3,
         [Description("笔记")]
         Note = 4,
-        [Description("话题")]
+        [Description("话题")]
         TopicNote = -4,
         [Description("通知")]
         Notice = 5,

+ 8 - 13
gx_api/GxPress/Repository/GxPress.Repository.Implement/GroupRepository.cs

@@ -480,34 +480,29 @@ namespace GxPress.Repository.Implement
         /// <returns></returns>
         public async Task<IEnumerable<UserGroupList>> GetAllByUserIdAsync(int userId)
         {
+            var groupConstValue = AllTypeConst.Group.GetHashCode();
             string sql = $@"SELECT 
-                                Id,
-                                Name,
-                                AvatarUrl,
+                                b.*,
                                 (SELECT 
                                         COUNT(1)
                                     FROM
                                         tede_group_user
                                     WHERE
-                                        GroupId = a.Id) AS UserCount
+                                        GroupId = a.MiddleId) AS UserCount
                             FROM
-                                tede_group a
+                                tede_middle a
+                                    INNER JOIN
+                                tede_group b ON a.MiddleId = b.Id
                             WHERE
-                                a.id IN (SELECT 
-                                        GroupId
-                                    FROM
-                                        ccpph_tede.tede_group_user
-                                    WHERE
-                                        UserId = {userId}) ORDER BY a.CreatedDate DESC";
+                                a.FolderType ={groupConstValue} AND a.UserId ={userId}
+                                    AND a.IsDelete = 0";
             var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
             var database = new Database(databaseType, _connectionString);
             var connection = database.GetConnection();
             var items = await connection
                 .QueryAsync<UserGroupList>(sql);
             foreach (var item in items)
-            {
                 item.AvatarUrl = StringUtils.AddDomain(item.AvatarUrl);
-            }
             return items;
         }
         /// <summary>

+ 1 - 1
gx_api/GxPress/Service/GxPress.Service.Implement/Note/NoteService.cs

@@ -452,7 +452,7 @@ namespace GxPress.Service.Implement.Note
         {
             var note = await _noteRepository.GetAsync(id);
             if (note == null || note.IsDelete)
-                throw new BusinessException("笔记删除!");
+                throw new BusinessException("已删除!");
             var result = _mapper.Map<NoteDetailResult>(note);
             var user = await _userRepository.GetAsync(result.UserId);
             result.Name = user.Name;