打印模块查询问题处理

dev
cjy 2 months ago
parent 0a70e89391
commit 13ff64f8b3

2
.gitignore vendored

@ -81,3 +81,5 @@ LinkAttach
/ds-wms-service/DS.WMS.MainApi/wwwroot/LinkAttach/1800840199861833728.png
/ds-wms-service/DS.WMS.MainApi/wwwroot/LinkAttach/1800846562843299840.txt
/ds-wms-service/DS.WMS.CheckApi/Logs/internal-nlog.txt
/ds-wms-service/DS.WMS.FinanceApi/.config/dotnet-tools.json
/ds-wms-service/DS.WMS.FinanceApi/Properties/PublishProfiles/FolderProfile.pubxml

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<DeleteExistingFiles>false</DeleteExistingFiles>
<ExcludeApp_Data>false</ExcludeApp_Data>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>D:\Code\PublishCopy\ds8-financeapi</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
<_TargetId>Folder</_TargetId>
</PropertyGroup>
</Project>

@ -18,7 +18,7 @@
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NLog" Version="5.2.7" />
<PackageReference Include="SqlSugarCore" Version="5.1.4.166" />
<PackageReference Include="SqlSugarCore" Version="5.1.4.169" />
<PackageReference Include="Autofac" Version="6.4.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="11.0.0" />

@ -90,22 +90,6 @@ namespace DS.WMS.PrintApi.Middleware
Console.WriteLine("执行的SQL" + Environment.NewLine + sqlStr);
};
//数据处理事件
dbProvider.Aop.OnExecutingChangeSql = (sql, pars) => //可以修改SQL和参数的值
{
//sql = sql.Replace('[', ' ').Replace(']', ' ');
//sql=newsql
foreach (var p in pars) //修改
{
if (p.Value.ToString().Contains("["))
{
var temp = JsonConvert.DeserializeObject<List<string>>(p.Value.ToString());
p.Value = string.Join(", ", temp);
}
//p.Value = p.Value.ToString().Replace('[', ' ').Replace(']', ' ').Replace('&', ',');
}
return new KeyValuePair<string, SugarParameter[]>(sql, pars);
};
//数据处理事件
dbProvider.Aop.DataExecuting = (oldValue, entityInfo) =>
{
};
@ -114,8 +98,6 @@ namespace DS.WMS.PrintApi.Middleware
{
//执行完了可以输出SQL执行时间 (OnLogExecutedDelegate)
Console.Write("time:" + db.Ado.SqlExecutionTime.ToString());
Console.Write("time:" + db.Ado.Connection.ConnectionString);
Console.Write("time:" + db.Ado.SqlStackTrace.SugarStackTraceList);
};
dbProvider.Aop.OnDiffLogEvent = it =>
{

@ -16,6 +16,9 @@ using Microsoft.Extensions.DependencyInjection;
using DS.WMS.PrintApi.Middleware;
using Newtonsoft.Json.Schema;
using Microsoft.AspNetCore.Mvc;
using System.Linq;
using System.Data;
using System.Dynamic;
namespace DS.WMS.PrintApi.Service
{
@ -346,9 +349,19 @@ namespace DS.WMS.PrintApi.Service
{
var param = JsonHelper.Instance.Deserialize<Dictionary<string, dynamic>>(req.ParamJsonStr);
foreach (var p in param)
{
if (p.Key == "ids")
{
var temp = JsonConvert.DeserializeObject<List<string>>(p.Value.ToString());
sugarParams.Add(new SugarParameter($"@{p.Key}", temp.ToArray()));
}
else
{
sugarParams.Add(new SugarParameter($"@{p.Key}", p.Value));
}
}
}
if (template.SourceSql.Contains(';'))
@ -546,10 +559,20 @@ namespace DS.WMS.PrintApi.Service
{
var param = JsonHelper.Instance.Deserialize<Dictionary<string, dynamic>>(req.ParamJsonStr);
foreach (var p in param)
{
//sugarParams.Add(new SugarParameter($"@{p.Key}", p.Value));
if (p.Key == "ids")
{
var temp = JsonConvert.DeserializeObject<List<string>>(p.Value.ToString());
sugarParams.Add(new SugarParameter($"@{p.Key}", temp.ToArray()));
}
else
{
sugarParams.Add(new SugarParameter($"@{p.Key}", p.Value));
}
}
}
if (template.SourceSql.Contains(';'))
{

Loading…
Cancel
Save