李昊 4 years ago
parent
commit
4eb0deea37

+ 5 - 0
gx_api/GxPress/Model/GxPress.Result/App/Middle/MiddleSearchFolderResult.cs

@@ -45,5 +45,10 @@ namespace GxPress.Result.App.Middle
         /// </summary>
         /// <value></value>
         public int FileCount { get; set; }
+        /// <summary>
+        /// 是否系统默认
+        /// </summary>
+        /// <value></value>
+        public bool IsSystemDefault { get; set; }
     }
 }

+ 21 - 5
gx_api/GxPress/Repository/GxPress.Repository.Implement/TopicRepository.cs

@@ -429,6 +429,12 @@ namespace GxPress.Repository.Implement
             var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
             var database = new Database(databaseType, _connectionString);
             var connection = database.GetConnection();
+            // var userIds = new List<int>();
+            // if (request.TopicGroupIds != null && request.TopicGroupIds.Contains(-1))
+            // {
+            //     //获取部门下面的员工
+            //     var users = await _userRepository.GetUserByDepartmentIdAsync(department.Id);
+            // }
             result.Items = await connection.QueryAsync<TopicListPageResult, User, TopicListPageResult>(AssembleSql(request), (topicListPageResult, user) =>
               {
                   topicListPageResult.UserName = user != null ? user.Name : "";
@@ -444,7 +450,7 @@ namespace GxPress.Repository.Implement
 
         public async Task<PagedList<TopicListPageResult>> GetTopicByGroupAsync(TopicPageSearchRequest request)
         {
-            var topicConstValue=AllTypeConst.Topic.GetHashCode();
+            var topicConstValue = AllTypeConst.Topic.GetHashCode();
             var sql = $@"SELECT 
                                 a.*,
                                 (SELECT 
@@ -693,15 +699,20 @@ namespace GxPress.Repository.Implement
                 var topicGroupId = "";
                 foreach (var item in request.TopicGroupIds)
                 {
+                    if (item <= 0)
+                        continue;
                     topicGroupId += $"{item},";
                 }
-                topicGroupId = topicGroupId.Remove(topicGroupId.Length - 1, 1);
-                sql += $@" AND a.UserId IN (SELECT 
+                if (!string.IsNullOrEmpty(topicGroupId))
+                {
+                    topicGroupId = topicGroupId.Remove(topicGroupId.Length - 1, 1);
+                    sql += $@" AND a.UserId IN (SELECT 
                                         UserId
                                     FROM
                                         tede_topic_group_user
                                     WHERE
                                         TopicGroupId IN ({topicGroupId}))";
+                }
             }
             if (!string.IsNullOrWhiteSpace(request.Keyword))
             {
@@ -747,15 +758,20 @@ namespace GxPress.Repository.Implement
                 var topicGroupId = "";
                 foreach (var item in request.TopicGroupIds)
                 {
+                    if (item <= 0)
+                        continue;
                     topicGroupId += $"{item},";
                 }
-                topicGroupId = topicGroupId.Remove(topicGroupId.Length - 1, 1);
-                sql += $@" AND a.UserId IN (SELECT 
+                if (!string.IsNullOrEmpty(topicGroupId))
+                {
+                    topicGroupId = topicGroupId.Remove(topicGroupId.Length - 1, 1);
+                    sql += $@" AND a.UserId IN (SELECT 
                                         UserId
                                     FROM
                                         tede_topic_group_user
                                     WHERE
                                         TopicGroupId IN ({topicGroupId}))";
+                }
             }
             if (!string.IsNullOrWhiteSpace(request.Keyword))
             {

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

@@ -684,7 +684,8 @@ namespace GxPress.Service.Implement.Middle
                     RoleId = item.RoleId,
                     IsFolder = await _middleRepository.IsFolderAsync(item.Id),
                     IsTop = item.IsTop,
-                    FileCount=await _middleRepository.CountAsync(Q.Where(nameof(Entity.Middle.Middle.ParentId),item.Id))
+                    FileCount = await _middleRepository.CountAsync(Q.Where(nameof(Entity.Middle.Middle.ParentId), item.Id)),
+                    IsSystemDefault = item.IsSystemDefault
                 };
                 if (item.RoleId == 3)
                 {