李昊 4 år sedan
förälder
incheckning
4ad00313f1

+ 11 - 0
gx_api/GxPress/Api/GxPress.Api/WebControllers/WebGroupController.cs

@@ -1,3 +1,4 @@
+using System.Collections.Generic;
 using System.Threading.Tasks;
 using GxPress.Auth;
 using GxPress.Repository.Interface;
@@ -61,5 +62,15 @@ namespace GxPress.Api.WebControllers
             }
             return result;
         }
+        /// <summary>
+        /// 根据广场类别查询小组
+        /// </summary>
+        /// <param name="categoryId"></param>
+        /// <returns></returns>
+        [HttpGet("list/{categoryId}")]
+        public async Task<IEnumerable<Entity.Group>> GetAllAsync(int categoryId)
+        {
+            return await _groupService.GetAllAsync(categoryId);
+        }
     }
 }

+ 9 - 0
gx_api/GxPress/Repository/GxPress.Repository.Implement/GroupRepository.cs

@@ -399,6 +399,15 @@ namespace GxPress.Repository.Implement
                     splitOn: "Id,Id,Name");
             return items.ToList();
         }
+        /// <summary>
+        /// 根据广场类别查询小组
+        /// </summary>
+        /// <param name="categoryId"></param>
+        /// <returns></returns>
+        public async Task<IEnumerable<Entity.Group>> GetAllAsync(int categoryId)
+        {
+            return await _repository.GetAllAsync(Q.Where(nameof(Entity.Group.GroupCategroyId), categoryId));
+        }
 
     }
 }

+ 8 - 2
gx_api/GxPress/Repository/GxPress.Repository.Interface/IGroupRepository.cs

@@ -57,14 +57,14 @@ namespace GxPress.Repository.Interface
         /// </summary>
         /// <param name="groupId"></param>
         /// <returns></returns>
-       Task<bool> SetGroupIsWordsAsync(int groupId);
+        Task<bool> SetGroupIsWordsAsync(int groupId);
 
         /// <summary>
         /// 获取小组详情
         /// </summary>
         /// <param name="guId"></param>
         /// <returns></returns>
-        Task<GroupDetailResult> GroupDetailByGuIdAsync(string guId,int userId);
+        Task<GroupDetailResult> GroupDetailByGuIdAsync(string guId, int userId);
 
 
         Task<IEnumerable<GroupUser>> GetAllAsync(SqlKata.Query query);
@@ -78,5 +78,11 @@ namespace GxPress.Repository.Interface
         Task<IEnumerable<GroupUserListResult>> SearchGroupUserAsync(TopicDetailListRequest request);
 
         Task<List<JobGroupResult>> ElasticSearchGroup();
+        /// <summary>
+        /// 根据广场类别查询小组
+        /// </summary>
+        /// <param name="categoryId"></param>
+        /// <returns></returns>
+        Task<IEnumerable<Entity.Group>> GetAllAsync(int categoryId);
     }
 }

+ 19 - 0
gx_api/GxPress/Service/GxPress.Service.Implement/Group/GroupService.Category.cs

@@ -0,0 +1,19 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace GxPress.Service.Implement.Group
+{
+    public partial class GroupService
+    {
+
+        /// <summary>
+        /// 根据广场类别查询小组
+        /// </summary>
+        /// <param name="categoryId"></param>
+        /// <returns></returns>
+        public async Task<IEnumerable<Entity.Group>> GetAllAsync(int categoryId)
+        {
+            return await _groupRepository.GetAllAsync(categoryId);
+        }
+    }
+}

+ 14 - 8
gx_api/GxPress/Service/GxPress.Service.Interface/Group/IGroupService.cs

@@ -38,14 +38,20 @@ namespace GxPress.Service.Interface.Group
         /// <returns></returns>
         Task<bool> DeleteAsync(int userId, int groupId);
 
-         Task<GroupDetailResult> GroupDetailAsync(GroupDetailRequest request);
+        Task<GroupDetailResult> GroupDetailAsync(GroupDetailRequest request);
 
-         /// <summary>
-         /// 获取小组详情
-         /// </summary>
-         /// <param name="guId"></param>
-         /// <param name="userId"></param>
-         /// <returns></returns>
-         Task<GroupDetailResult> GroupDetailByGuIdAsync(string guId,int userId);
+        /// <summary>
+        /// 获取小组详情
+        /// </summary>
+        /// <param name="guId"></param>
+        /// <param name="userId"></param>
+        /// <returns></returns>
+        Task<GroupDetailResult> GroupDetailByGuIdAsync(string guId, int userId);
+        /// <summary>
+        /// 根据广场类别查询小组
+        /// </summary>
+        /// <param name="categoryId"></param>
+        /// <returns></returns>
+        Task<IEnumerable<Entity.Group>> GetAllAsync(int categoryId);
     }
 }