From 0dbc8273bdfbcabcc4b770546245f6b17d787de9 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期五, 13 三月 2026 14:44:50 +0800
Subject: [PATCH] fix: 修复API控制器依赖注入和路由配置

---
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Filter/AutoMapperSetup.cs |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Filter/AutoMapperSetup.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Filter/AutoMapperSetup.cs
index d1ac9d1..c6cac5f 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Filter/AutoMapperSetup.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Filter/AutoMapperSetup.cs
@@ -1,16 +1,22 @@
-锘縩amespace WIDESEAWCS_WCSServer.Filter
+锘縰sing Mapster;
+using MapsterMapper;
+
+namespace WIDESEAWCS_WCSServer.Filter
 {
     /// <summary>
-    /// Automapper 鍚姩鏈嶅姟
+    /// Mapster 鍚姩鏈嶅姟
     /// </summary>
-    public static class AutoMapperSetup
+    public static class MapsterSetup
     {
-        public static void AddAutoMapperSetup(this IServiceCollection services)
+        public static void AddMapsterSetup(this IServiceCollection services)
         {
             if (services == null) throw new ArgumentNullException(nameof(services));
 
-            services.AddAutoMapper(typeof(AutoMapperConfig));
-            AutoMapperConfig.RegisterMappings();
+            TypeAdapterConfig typeAdapterConfig = new TypeAdapterConfig();
+            MapsterConfig.RegisterMappings(typeAdapterConfig);
+
+            services.AddSingleton(typeAdapterConfig);
+            services.AddScoped<IMapper, ServiceMapper>();
         }
     }
 }

--
Gitblit v1.9.3