lihao 4 年之前
父節點
當前提交
eac313f3ca

+ 12 - 0
gx_api/GxPress/Model/GxPress.EnumConst/AllTypeConst.cs

@@ -144,4 +144,16 @@ namespace GxPress.EnumConst
         [Description("服务器异常")]
         ErrorMsg = -1,
     }
+    /// <summary>
+    /// 权限
+    /// </summary>
+    public enum MiddleRoleConst
+    {
+        [Description("公开")]
+        Publicity = 1,
+        [Description("私有")]
+        PrivatelyOwned = 2,
+        [Description("共享")]
+        Share = 3
+    }
 }

+ 0 - 1
gx_api/GxPress/Model/GxPress.Result/App/GroupUser/GroupUserListResult.cs

@@ -53,6 +53,5 @@ namespace GxPress.Result.App.GroupUser
         /// </summary>
         /// <value></value>
         public string Email { get; set; }
-    
     }
 }

+ 1 - 1
gx_api/GxPress/Repository/GxPress.Repository.Implement/NoticeRepository.cs

@@ -537,7 +537,7 @@ namespace GxPress.Repository.Implement
                                     tede_flow
                                 WHERE
                                     id = b.SourceId)) as UserName
-                                    ,(select count(1) from tede_flow where id=b.SourceId and UserId={request.UserId}) as IsFlowAdmin,b.UserId
+                                    ,(select count(1) from tede_flow where id=b.SourceId and UserId={request.UserId}) as IsFlowAdmin,b.UserId,a.IsTop
                                     FROM
                                         tede_middle a
                                             left   JOIN

+ 5 - 47
gx_api/GxPress/Repository/GxPress.Repository.Implement/UserRepository.cs

@@ -1106,48 +1106,7 @@ namespace GxPress.Repository.Implement
         /// <returns></returns>
         public async Task<IEnumerable<GroupUserListResult>> GetGroupUserAsync(GroupUserFindRequest request)
         {
-            string sqlStr = string.Empty;
-            if (!string.IsNullOrEmpty(request.KeyWord))
-            {
-                sqlStr += $@" AND (b.Name LIKE '%{request.KeyWord}%'
-               OR b.Phone LIKE '%{request.KeyWord}%'
-               OR b.Email LIKE '%{request.KeyWord}%')";
-            }
-            if (request.TypeId == 1)
-                sqlStr += " AND a.GroupUserRoleId IN (1,2)";
-            if (request.TypeId == 2)
-                sqlStr += " AND a.GroupUserRoleId=3";
-            string sql = $@"SELECT 
-                            a.Id,
-                            a.GroupUserRoleId,
-                            a.CreatedDate,
-                            a.GroupId,
-                            b.Id AS UserId,
-                            b.Name,
-                            b.AvatarUrl,
-                            b.Email,
-                            b.ImId,
-                            c.Name AS DepartmentName
-                        FROM
-                            tede_group_user a
-                                INNER JOIN
-                            tede_user b ON a.UserId = b.Id
-                                INNER JOIN
-                            tede_department c ON b.DepartmentId = c.Id
-                        WHERE
-                            a.GroupId = {request.GroupId}
-                               {sqlStr}
-                        ORDER BY a.GroupUserRoleId";
-            var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
-            var database = new Database(databaseType, _connectionString);
-            var connection = database.GetConnection();
-            var result = await connection.QueryAsync<GroupUserListResult>(sql);
-            foreach (var item in result)
-            {
-                item.AvatarUrl = StringUtils.AddDomainMin(item.AvatarUrl);
-                item.Email = string.IsNullOrEmpty(item.Email) ? string.Empty : item.Email;
-            }
-            return result;
+            return await GetGroupUsersAsync(request);
         }
 
         /// <summary>
@@ -1157,10 +1116,9 @@ namespace GxPress.Repository.Implement
         /// <returns></returns>
         public async Task<IEnumerable<GroupUserListResult>> GetGroupUsersAsync(GroupUserFindRequest request)
         {
-            var enjoy = new SqlKata.Query("tede_user_middle");
-            enjoy.Where("MiddleType", 10);
-            enjoy.Where("SourceId", 855);
-            enjoy.ForMySql(n => n.SelectRaw("GROUP_CONCAT(SourceName Separator'、')"));
+            // var enjoy = new SqlKata.Query("tede_user_middle");
+            // enjoy.Where("MiddleType", 10);
+            // enjoy.SelectRaw("GROUP_CONCAT(SourceName Separator'、')");
             var userCount = new SqlKata.Query("tede_user");
             userCount.Where("Id", ">", 0).AsCount("Id");
             var query = new SqlKata.Query("tede_user");
@@ -1178,7 +1136,7 @@ namespace GxPress.Repository.Implement
                      "tede_user.{Id AS UserId, Name, AvatarUrl,Email,ImId}",
                      "a.{Name AS DepartmentName}");
             query.Select(userCount, "UserCount");
-            query.Select(enjoy, "EnjoyName");
+            //query.Select(enjoy, "EnjoyName");
             var result = await _repository.GetAllAsync<GroupUserListResult>(query);
             foreach (var item in result)
             {

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

@@ -874,7 +874,7 @@ namespace GxPress.Service.Implement.Middle
                             WHERE
                                 FolderType ={request.TypeId} AND AttributeValue = 2 {sqlStr} 
                                     AND UserId = {request.UserId}
-                                    AND RoleId IN (1 , 3)
+                                    AND RoleId IN ({MiddleRoleConst.Publicity.GetHashCode()} , {MiddleRoleConst.Share.GetHashCode()})
                                     AND IsDelete = 0
                                     AND ParentId ={request.ParentId}
                             ORDER BY IsSystemDefault DESC,AttributeValue desc , IsTop DESC ,  {nameof(Entity.Middle.Middle.LastModifiedDate)} DESC,Sort DESC";
@@ -910,7 +910,7 @@ namespace GxPress.Service.Implement.Middle
                     FileCount = await _middleRepository.CountAsync(Q.Where(nameof(Entity.Middle.Middle.ParentId), item.Id).Where(nameof(Entity.Middle.Middle.IsDelete), false).Where(nameof(Entity.Middle.Middle.FolderType), request.TypeId)),
                     IsSystemDefault = item.IsSystemDefault
                 };
-                if (item.RoleId == 3)
+                if (item.RoleId == MiddleRoleConst.Share.GetHashCode())
                 {
                     var sourceId = item.Id;
                     if (item.ParentId != 0)