增加获取数据提供程序方法

dev
嵇文龙 4 days ago
parent 59a9384a4f
commit b645766827

@ -1,5 +1,4 @@
using System.ComponentModel;
using SqlSugar;
using SqlSugar;
namespace DS.WMS.Core.TaskInteraction.Entity
{

@ -28,6 +28,13 @@ namespace DS.WMS.Core.TaskInteraction.Interface
///// <returns></returns>
//Task<DataResult<Tuple<string, string>>> GetMailContentAsync(string customerNO, DocumentType docType, string? templateName = null);
/// <summary>
/// 获取数据提供程序
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
Task<DataResult<List<BusinessDataProvider>>> GetProvidersAsync(string? query);
/// <summary>
/// 获取分页列表
/// </summary>

@ -1,9 +1,11 @@
using DS.Module.Core;
using System.Reflection;
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.Module.Core.Extensions;
using DS.WMS.Core.TaskInteraction.Entity;
using DS.WMS.Core.TaskInteraction.Interface;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
namespace DS.WMS.Core.TaskInteraction.Method
{
@ -74,6 +76,29 @@ namespace DS.WMS.Core.TaskInteraction.Method
// return DataResult<Tuple<string, string>>.Success(new Tuple<string, string>(title, content));
//}
/// <summary>
/// 获取数据提供程序
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public async Task<DataResult<List<BusinessDataProvider>>> GetProvidersAsync(string? query)
{
List<IConditionalModel> conditionals = [];
if (!string.IsNullOrEmpty(query))
conditionals = Db.Utilities.JsonToConditionalModels(query);
var list = await TenantDb.Queryable<BusinessDataProvider>()
.Where(conditionals).ToListAsync();
var result = DataResult<List<BusinessDataProvider>>.Success(list);
result.AdditionalData ??= [];
var types = Array.FindAll(Assembly.GetExecutingAssembly().GetTypes(),
x => x.IsClass && typeof(IDataProvider).IsAssignableFrom(x));
result.AdditionalData["AvailableTypes"] = types.Select(x => x.FullName);
return result;
}
/// <summary>
/// 获取分页列表
/// </summary>

@ -1,6 +1,7 @@
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.Module.Core.Extensions;
using DS.WMS.Core.Invoice.Dtos;
using DS.WMS.Core.Sys.Entity;
using DS.WMS.Core.TaskInteraction.Entity;
using DS.WMS.Core.TaskInteraction.Interface;
@ -70,6 +71,17 @@ namespace DS.WMS.OpApi.Controllers
// return File(Encoding.UTF8.GetBytes(result.Data.Item2), "application/octet-stream", customerNO + ".htm");
//}
/// <summary>
/// 获取数据提供程序
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
[HttpGet, HttpPost, Route("GetProviders")]
public async Task<DataResult<List<BusinessDataProvider>>> GetProvidersAsync(string? query)
{
return await service.GetProvidersAsync(query);
}
/// <summary>
/// 获取分页列表
/// </summary>

Loading…
Cancel
Save