lihao 4 years ago
parent
commit
e4b90e2316

+ 2 - 2
gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminGroupController.cs

@@ -24,9 +24,9 @@ namespace GxPress.Api.AdminControllers
         /// </summary>
         /// <returns></returns>
         [HttpGet("list")]
-        public async Task<IEnumerable<GroupDetailResult>> GetGroupDetailResults()
+        public async Task<IEnumerable<GroupDetailResult>> GetGroupDetailResults([FromQuery]string keyWord)
         {
-            return await groupRepository.GetGroupDetailResults();
+            return await groupRepository.GetGroupDetailResults(keyWord);
         }
         /// <summary>
         /// 修改小组

+ 6 - 3
gx_api/GxPress/Repository/GxPress.Repository.Implement/GroupRepository.cs

@@ -606,16 +606,19 @@ namespace GxPress.Repository.Implement
         /// 获取小组列表
         /// </summary>
         /// <returns></returns>
-        public async Task<IEnumerable<GroupDetailResult>> GetGroupDetailResults()
+        public async Task<IEnumerable<GroupDetailResult>> GetGroupDetailResults(string keyWord)
         {
-            string sql = @"SELECT 
+            string sqlStr = string.Empty;
+            if (!string.IsNullOrWhiteSpace(keyWord))
+                sqlStr += $" and a.Name like '%{keyWord}%'";
+            string sql = $@"SELECT 
                                 a.*, b.PiazzaName AS CategroyName, c.Name AS UserName
                             FROM
                                 tede_group a
                                     INNER JOIN
                                 tede_user c ON a.UserId = c.Id
                                     LEFT JOIN
-                                tede_group_piazza b ON a.GroupCategroyId = b.Id
+                                tede_group_piazza b ON a.GroupCategroyId = b.Id Where 1=1 {sqlStr}
                             ORDER BY a.Sort DESC , a.CreatedDate DESC";
             var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
             var database = new Database(databaseType, _connectionString);

+ 1 - 1
gx_api/GxPress/Repository/GxPress.Repository.Interface/IGroupRepository.cs

@@ -113,6 +113,6 @@ namespace GxPress.Repository.Interface
         /// 获取小组列表
         /// </summary>
         /// <returns></returns>
-        Task<IEnumerable<GroupDetailResult>> GetGroupDetailResults();
+        Task<IEnumerable<GroupDetailResult>> GetGroupDetailResults(string keyWor);
     }
 }

+ 1 - 1
gx_api/GxPress/Service/GxPress.Service.Implement/Middle/MiddleService.cs

@@ -841,7 +841,7 @@ namespace GxPress.Service.Implement.Middle
             var connection = database.GetConnection();
             var middles = await connection.QueryAsync<Entity.Middle.Middle>(sql);
             List<MiddleSearchFolderResult> result = new List<MiddleSearchFolderResult>();
-            if (request.TypeId == AllTypeConst.TopicNote.GetHashCode() && request.ParentId == 0)
+            if (request.TypeId == AllTypeConst.TopicNote.GetHashCode() && request.ParentId == 0&&string.IsNullOrWhiteSpace(request.KeyWord))
             {
                 result.Add(new MiddleSearchFolderResult
                 {