Lyyyi преди 1 ден
родител
ревизия
83d1e23b0a
променени са 2 файла, в които са добавени 15 реда и са изтрити 9 реда
  1. 2 2
      OASystem/OASystem.Api/Controllers/GroupsController.cs
  2. 13 7
      OASystem/OASystem.Api/Program.cs

+ 2 - 2
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -1178,7 +1178,7 @@ namespace OASystem.API.Controllers
         /// <returns></returns>
         [HttpGet]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
-        public async Task<IActionResult> GroupItemKeywordSearch(string keyword)
+        public async Task<IActionResult> GroupItemKeywordSearch1(string keyword)
         {
             var jw = JsonView(true, "暂无数据");
             if (string.IsNullOrEmpty(keyword)) return Ok(jw);
@@ -1224,7 +1224,7 @@ namespace OASystem.API.Controllers
         /// <returns></returns>
         [HttpGet]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
-        public async Task<IActionResult> GroupItemNativeKeywordSearch(string keyword)
+        public async Task<IActionResult> GroupItemKeywordSearch(string keyword)
         {
             try
             {

+ 13 - 7
OASystem/OASystem.Api/Program.cs

@@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Http.Features;
 using Microsoft.AspNetCore.ResponseCompression;
 using Microsoft.AspNetCore.Server.Kestrel.Core;
 using Microsoft.Extensions.DependencyInjection.Extensions;
+using Microsoft.IdentityModel.Tokens;
 using OASystem.API.Middlewares;
 using OASystem.API.OAMethodLib;
 using OASystem.API.OAMethodLib.AMapApi;
@@ -223,14 +224,19 @@ builder.Services.AddScoped(options =>
 
                 foreach (var param in pars)
                 {
-                    var formattedValue = param.Value switch
+                    var par = param.Value;
+                    if (par != null)
                     {
-                        string str => $"'{str.Replace("'", "''")}'",
-                        DateTime date => $"'{date:yyyy-MM-dd HH:mm:ss}'",
-                        bool b => b ? "1" : "0",
-                        _ => param.Value.ToString()
-                    };
-                    resultSql = resultSql.Replace(param.ParameterName, formattedValue);
+                        var formattedValue = par switch
+                        {
+                            string str => $"'{str.Replace("'", "''")}'",
+                            DateTime date => $"'{date:yyyy-MM-dd HH:mm:ss}'",
+                            bool b => b ? "1" : "0",
+                            _ => par.ToString()
+                        };
+                        resultSql = resultSql.Replace(param.ParameterName, formattedValue);
+                    }
+                    
                 }
                 Console.WriteLine(resultSql);
                 Console.WriteLine("=====================================");