Explorar el Código

增加“获取行政区域树”方法

Signed-off-by: Lzh666 <422235757@qq.com>
Lzh666 hace 10 meses
padre
commit
c21837bb0c
Se han modificado 1 ficheros con 10 adiciones y 0 borrados
  1. 10 0
      Admin.NET/Admin.NET.Core/Service/Region/SysRegionService.cs

+ 10 - 0
Admin.NET/Admin.NET.Core/Service/Region/SysRegionService.cs

@@ -50,6 +50,16 @@ public class SysRegionService : IDynamicApiController, ITransient
         return await _sysRegionRep.GetListAsync(u => u.Pid == input.Id);
     }
 
+    /// <summary>
+    /// 获取行政区域树 🔖
+    /// </summary>
+    /// <returns></returns>
+    [DisplayName("获取行政区域树")]
+    public async Task<List<SysRegion>> GetTree()
+    {
+        return await _sysRegionRep.AsQueryable().ToTreeAsync(u => u.Children, u => u.Pid, null);
+    }
+
     /// <summary>
     /// 增加行政区域 🔖
     /// </summary>