You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.1 KiB
C#

using DS.WMS.Core.TaskInteraction.Dtos;
using DS.WMS.Core.TaskInteraction.Interface;
using SqlSugar;
namespace DS.WMS.Core.TaskInteraction.Method.DataProvider
{
/// <summary>
/// 默认数据库提供程序
/// </summary>
public class DefaultDatabaseProvider : ServiceBase, IDataProvider
{
/// <summary>
/// 初始化
/// </summary>
/// <param name="provider"></param>
public DefaultDatabaseProvider(IServiceProvider provider) : base(provider)
{
}
/// <summary>
/// 执行数据库查询
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public async Task FetchDataAsync(DataFetchContext context)
{
SugarParameter[] sugarParams = [
new SugarParameter(nameof(context.BusinessId), context.BusinessId, System.Data.DbType.Int64),
new SugarParameter(nameof(context.BusinessType), context.BusinessType, System.Data.DbType.Int32),
];
context.Data = await TenantDb.Ado.SqlQueryAsync<dynamic>(context.Content, sugarParams);
}
}
}