zhontai 2 éve
szülő
commit
be3e73dd2b

+ 1 - 1
build/pkg.props

@@ -1,6 +1,6 @@
 <Project>
   <PropertyGroup>
-    <Version>3.2.0</Version>
+    <Version>3.3.0</Version>
 	<TargetFramework>net7.0</TargetFramework>
 	<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
 	<GenerateDocumentationFile>true</GenerateDocumentationFile>

+ 1 - 1
src/hosts/ZhonTai.Host/Configs/appconfig.json

@@ -30,7 +30,7 @@
       {
         "name": "中台Admin",
         "code": "admin",
-        "version": "v3.2.0",
+        "version": "v3.3.0",
         "description": ""
       }
     ]

+ 13 - 2
src/platform/ZhonTai.Admin/Services/Api/ApiService.cs

@@ -10,6 +10,7 @@ using ZhonTai.Admin.Domain.Api.Dto;
 using ZhonTai.DynamicApi;
 using ZhonTai.DynamicApi.Attributes;
 using ZhonTai.Admin.Core.Consts;
+using SixLabors.ImageSharp.Drawing;
 
 namespace ZhonTai.Admin.Services.Api;
 
@@ -174,8 +175,18 @@ public class ApiService : BaseService, IApiService, IDynamicApi
     {
         if (!(input?.Apis?.Count > 0)) return;
 
-        //查询所有api
-        var apis = await _apiRepository.Select.DisableGlobalFilter(FilterNames.Delete).ToListAsync();
+        //查询分组下所有模块的api
+        var groupPaths = input.Apis.FindAll(a => a.ParentPath.IsNull()).Select(a => a.Path);
+        var groups = await _apiRepository.Select.DisableGlobalFilter(FilterNames.Delete)
+            .Where(a => a.ParentId == 0 && groupPaths.Contains(a.Path)).ToListAsync();
+        var groupIds = groups.Select(a => a.Id);
+        var modules = await _apiRepository.Select.DisableGlobalFilter(FilterNames.Delete)
+            .Where(a => groupIds.Contains(a.ParentId)).ToListAsync();
+        var moduleIds = modules.Select(a => a.Id);
+        var apis = await _apiRepository.Select.DisableGlobalFilter(FilterNames.Delete)
+            .Where(a=> moduleIds.Contains(a.ParentId)).ToListAsync();
+
+        apis = groups.Concat(modules).Concat(apis).ToList();
         var paths = apis.Select(a => a.Path).ToList();
 
         //path处理