using ce.autofac.extension;
using learun.iapplication;
using learun.util;
using System.Collections.Generic;
using System.Data;
using System.Threading.Tasks;
namespace learun.application
{
///
/// 版 本 EasyCode EC管理后台
/// Copyright (c) 2019-present EC管理有限公司
/// 创建人:tobin
/// 日 期:2019.09.19
/// 描 述:数据源
///
public class DataSourceBLL : BLLBase, DataSourceIBLL, BLL
{
private readonly DataSourceService dataSourceService = new DataSourceService();
#region 获取数据
///
/// 获取分页数据
///
/// 分页参数
/// 关键字
///
public Task> GetPageList(Pagination pagination, string keyword)
{
return dataSourceService.GetPageList(pagination, keyword);
}
///
/// 获取列表数据
///
///
public Task> GetList()
{
return dataSourceService.GetList();
}
///
/// 获取实体
///
/// 编号
///
public Task GetEntityByCode(string code)
{
return dataSourceService.GetEntityByCode(code);
}
#endregion 获取数据
#region 提交数据
///
/// 删除数据源
///
/// 主键
public async Task DeleteEntity(string keyValue)
{
await dataSourceService.DeleteEntity(keyValue);
}
///
/// 保存(新增、修改)
///
/// 主键值
/// 数据源实体
///
public async Task SaveEntity(string keyValue, DataSourceEntity dataSourceEntity)
{
return await dataSourceService.SaveEntity(keyValue, dataSourceEntity);
}
#endregion 提交数据
#region 扩展方法
///
/// 获取数据源的数据
///
/// 数据源编码
/// 查询条件
///
public async Task GetDataTable(string code, string queryJson = "{}")
{
var userInfo = await this.CurrentUser();
return await dataSourceService.GetDataTable(code, userInfo, queryJson);
}
///
/// 获取数据源的数据(分页)
///
/// 数据源编码
/// 分页参数
/// 查询条件
///
public async Task GetDataTable(string code, Pagination pagination, string queryJson = "{}")
{
var userInfo = await this.CurrentUser();
return await dataSourceService.GetDataTable(code, pagination, userInfo, queryJson);
}
///
/// 获取树形数据
///
/// 编码
/// 父级ID
/// ID
/// 显示ID
///
public Task> GetTree(string code, string parentId, string Id, string showId)
{
return dataSourceService.GetTree(code, parentId, Id, showId);
}
///
/// 获取数据
///
/// 数据库连接编码
/// sql
///
public Task GetDataTableBySql(string code, string strSql)
{
return dataSourceService.GetDataTableBySql(code, strSql);
}
///
/// 获取sql的列
///
/// 编码
///
public Task> GetDataColName(string code)
{
return dataSourceService.GetDataColName(code);
}
#endregion 扩展方法
}
}