李昊 4 роки тому
батько
коміт
6d4d937006

+ 5 - 8
gx_api/GxPress/Repository/GxPress.Repository.Implement/DepartmentRepository.cs

@@ -416,7 +416,7 @@ namespace GxPress.Repository.Implement
                     Item = await GetDepartmentByPid(departmentId, new List<Entity.Department>(), allDepartment.ToList())
                 });
             }
-            if (departmentIds.Count() <= 2)
+            if (departmentIds.Count() == 1)
                 departmentIdsList.AddRange(departmentIds);
             for (int i = 0; i < result.Result.Count; i++)
             {
@@ -429,13 +429,13 @@ namespace GxPress.Repository.Implement
                     else if (result.Result[k].Item.Any(n => n.Id == result.Result[i].DepartmentId))
                     {
                         departmentIdsList.Add(result.Result[k].DepartmentId);
-                        // result.Result[i].DepartmentId = result.Result[k].DepartmentId;
-                        // result.Result[i].Item = result.Result[k].Item;
+                        result.Result[i].DepartmentId = result.Result[k].DepartmentId;
+                        result.Result[i].Item = result.Result[k].Item;
                     }
                     else
                     {
                         //departmentIdsList.Add(result.Result[i].DepartmentId);
-                        departmentIdsList.Add(result.Result[i].DepartmentId);
+                        departmentIdsList.Add(result.Result[k].DepartmentId);
                     }
                 }
             }
@@ -458,7 +458,7 @@ namespace GxPress.Repository.Implement
                     Item = await GetDepartmentByPid(departmentId, new List<Entity.Department>(), allDepartment.ToList())
                 });
             }
-            if (departmentIds.Count() == 1)
+             if (departmentIds.Count() <= 2)
                 departmentIdsList.AddRange(departmentIds);
             for (int i = 0; i < result.Result.Count; i++)
             {
@@ -471,13 +471,10 @@ namespace GxPress.Repository.Implement
                     else if (result.Result[k].Item.Any(n => n.Id == result.Result[i].DepartmentId))
                     {
                         departmentIdsList.Add(result.Result[k].DepartmentId);
-                        result.Result[i].DepartmentId = result.Result[k].DepartmentId;
-                        result.Result[i].Item = result.Result[k].Item;
                     }
                     else
                     {
                         departmentIdsList.Add(result.Result[i].DepartmentId);
-                        departmentIdsList.Add(result.Result[k].DepartmentId);
                     }
                 }
             }