using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Threading.Tasks;
using APT.Infrastructure.Core;
namespace APT.Infrastructure.Api
{
///
/// 通用接口,可以调用基类方法
///
///
public partial interface ICommonService : IDomainService
{
IUnitOfWork UnitWork();
#region 实体
///
/// 查询实体
///
///
///
///
///
T GetEntity(string id, params string[] paths) where T : MesEntityBase, new();
///
/// 查询实体
///
///
///
///
///
T GetEntity(Guid id, params string[] paths) where T : MesEntityBase, new();
///
/// 查询实体
///
///
///
///
///
T GetEntity(Expression> expression, params string[] paths) where T : MesEntityBase, new();
///
/// 查询实体
///
///
///
///
///
T GetEntity(Expression> expression, BaseFilter fiter, params string[] paths) where T : MesEntityBase, new();
///
/// 查询实体
///
///
///
///
///
T GetEntity(Expression> expression, BaseFilter fiter, bool isTracking = false, params string[] paths) where T : MesEntityBase, new();
T GetEntityByRedis(string key, Guid orgid)
where T : MesEntityBase, new();
T GetEntityByRedis(Guid key, Guid orgid)
where T : MesEntityBase, new();
List GetEntitiesByRedis(BaseFilter filter) where T : MesEntityBase, new();
List GetEntitiesByGroupRedis(BaseFilter filter, string groupValue) where T : MesEntityBase, new();
List GetEntitiesByRedis(Expression> expression, BaseFilter filter) where T : MesEntityBase, new();
List GetEntitiesTableByRedis(Expression> expression, BaseFilter filter,
params string[] paths) where T : MesEntityBase, new();
List GetEntitiesByRedis(Expression> expression, BaseFilter filter, string groupValue,
params string[] paths) where T : MesEntityBase, new();
PagedResultDto GetOrderPageByRedis(Expression> expression, BasePageFilter pageFilter,
params string[] paths) where T : MesEntityBase, new();
IEnumerable GetEntities(Expression> expression,
params string[] paths) where T : MesEntityBase, new();
IEnumerable GetEntities(Expression> expression,
bool isTracking = false, params string[] paths) where T : MesEntityBase, new();
IEnumerable GetEntities(Expression> expression, BaseFilter filter,
bool isTracking = false, params string[] paths) where T : MesEntityBase, new();
///
/// 获取所有数据
///
///
///
///
///
///
IEnumerable GetEntities(Expression> expression, BaseFilter filter, params string[] paths) where T : MesEntityBase, new();
///
/// 获取所有数据
///
/// 类型
/// 排序
/// lambd表达式
/// 过滤器
/// 需要关联查询的数据
///
///
/// 获取所有数据
///
/// 类型
/// 排序
/// lambd表达式
/// 过滤器
/// 需要关联查询的数据
///
IEnumerable GetOrderEntities(Expression> expression,
BaseFilter filter, Action> orderBy, params string[] paths) where T : MesEntityBase, new();
///
/// 获取所有数据
///
/// 类型
/// lambd表达式
/// 过滤器
/// 需要关联查询的数据
///
IEnumerable GetOrderEntities(Expression> expression, BaseFilter filter, params string[] paths) where T : MesEntityBase, new();
///
/// 排序获取数据
///
///
///
///
///
///
///
///
IEnumerable GetOrderEntities(Expression> expression, BaseFilter filter, string sort, string order, params string[] paths) where T : MesEntityBase, new();
///
/// 排序获取数据
///
///
///
///
///
///
///
///
IEnumerable GetOrderEntities(Expression> expression, BaseFilter filter, Dictionary orders, params string[] paths) where T : MesEntityBase, new();
IEnumerable GetOrderEntities(Expression> expression, BaseFilter filter,
bool isTracking = false, params string[] paths) where T : MesEntityBase, new();
IEnumerable GetOrderEntities(Expression> expression,
BaseFilter filter, Action> orderBy, bool isTracking = false, params string[] paths) where T : MesEntityBase, new();
IEnumerable GetOrderEntities(Expression> expression,
BaseFilter filter, Dictionary orders, Action> orderBy, bool isTracking = false, params string[] paths) where T : MesEntityBase, new();
PagedResultDto GetPageEntities(Expression> expression, BasePageFilter pageFilter,
params string[] paths) where T : MesEntityBase, new();
IEnumerable> GetTreeOrderEntities(Expression> expression, BaseFilter filter, bool isTracking,
params string[] paths) where T : TreeEntityBase, new();
PagedResultDto GetOrderPageEntities(Expression> expression, BasePageFilter pageFilter,
params string[] paths) where T : MesEntityBase, new();
PagedResultDto GetOrderPageEntities(Expression> expression, BasePageFilter pageFilter,
int pageSize, int startIndex,
params string[] paths) where T : MesEntityBase, new();
PagedResultDto GetOrderPageEntities(Expression> expression, BasePageFilter pageFilter,
int pageSize, int startIndex, bool isTracking = false,
params string[] paths) where T : MesEntityBase, new();
PagedResultDto GetOrderPageEntities(Expression> expression, BasePageFilter pageFilter,
Dictionary orders,
int pageSize, int startIndex, bool isTracking = false,
params string[] paths) where T : MesEntityBase, new();
IEnumerable GetTree(string id, bool containCurrent = true, BaseFilter filter = null,
params string[] paths) where T : TreeEntityBase, new();
PagedResultDto GetOrderPageEntities(Expression> expression, BasePageFilter pageFilter,
Dictionary orders,
int pageSize, int startIndex, Action> orderBy, bool isTracking = false,
params string[] paths) where T : MesEntityBase, new();
PagedResultDto GetOrderPageEntities(Expression> expression, BasePageFilter pageFilter, string[] selectField,
params string[] paths) where T : MesEntityBase, new();
//
Task> GetOrderPageEntitiesSync(Expression> expression, BasePageFilter pageFilter,
params string[] paths) where T : MesEntityBase, new();
Task> GetOrderPageEntitiesSync(Expression> expression, BasePageFilter pageFilter,
int pageSize, int startIndex,
params string[] paths) where T : MesEntityBase, new();
Task> GetOrderPageEntitiesSync(Expression> expression, BasePageFilter pageFilter,
int pageSize, int startIndex, bool isTracking = false,
params string[] paths) where T : MesEntityBase, new();
Task> GetOrderPageEntitiesSync(Expression> expression, BasePageFilter pageFilter,
Dictionary orders,
int pageSize, int startIndex, bool isTracking = false,
params string[] paths) where T : MesEntityBase, new();
Task> GetOrderPageEntitiesSync(Expression> expression, BasePageFilter pageFilter,
Dictionary orders,
int pageSize, int startIndex, Action> orderBy, bool isTracking = false,
params string[] paths) where T : MesEntityBase, new();
int Count(Expression> expression, BaseFilter filter) where T : MesEntityBase, new();
bool IsAny(Expression> expression, BaseFilter filter) where T : MesEntityBase, new();
int Count(Expression> expression) where T : MesEntityBase, new();
#endregion
///
/// 添加实体
///
///
///
bool AddEntity(T entity) where T : MesEntityBase, new();
T AddAndGetEntity(T entity) where T : MesEntityBase, new();
///
/// 删除实体
///
///
///
bool DeleteEntity(Guid id) where T : MesEntityBase, new();
///
/// 删除实体
///
///
///
bool DeleteEntity(Expression> expression) where T : MesEntityBase, new();
///
/// 删除实体
///
///
///
bool DeleteEntity(IEnumerable entity) where T : MesEntityBase, new();
///
/// 删除实体
///
///
///
///
bool DeleteEntity(T entity) where T : MesEntityBase, new();
///
/// 逻辑批量删除
///
///
///
///
bool BantchDeleteEntity(List ids) where T : MesEntityBase, new();
/// 更新实体
///
///
///
bool UpdateEntity(T entity) where T : MesEntityBase, new();
///
/// 按字段更新数据
///
///
///
///
///
bool UpdateEntity(T entity, params string[] updateField) where T : MesEntityBase, new();
///
///根据字段批量更新实体
///
///
///
///
///
bool BantchUpdateEntity(IEnumerable entities, params string[] updateField) where T : MesEntityBase, new();
///
/// 批量添加实体
///
/// 实体集合
///
bool BantchAddEntity(IEnumerable entities) where T : MesEntityBase, new();
///
/// 批量更新实体
///
/// 实体集
///
bool BantchUpdateEntity(IEnumerable entities) where T : MesEntityBase, new();
///
/// 批量保存实体
///
/// 批量保存
///
bool BantchSaveEntity(IEnumerable entities) where T : MesEntityBase, new();
#region 树实体
///
/// 添加实体
///
///
///
bool TreeAddEntity(T entity) where T : TreeEntityBase, new();
T TreeAddAndGetEntity(T entity) where T : MesEntityBase, new();
///
/// 删除实体
///
///
///
bool TreeDeleteEntity(Guid id) where T : TreeEntityBase, new();
///
/// 删除实体
///
///
///
bool TreeDeleteEntity(Expression> expression) where T : TreeEntityBase, new();
///
/// 删除实体
///
///
///
bool TreeDeleteEntity(IEnumerable entity) where T : TreeEntityBase, new();
///
/// 删除实体
///
///
///
///
bool TreeDeleteEntity(T entity) where T : TreeEntityBase, new();
///
/// 逻辑批量删除
///
///
///
///
bool TreeBantchDeleteEntity(List ids) where T : TreeEntityBase, new();
///
/// 更新实体
///
///
///
bool TreeUpdateEntity(T entity) where T : TreeEntityBase, new();
///
/// 批量添加实体
///
/// 实体集合
///
bool TreeBantchAddEntity(IEnumerable entities) where T : TreeEntityBase, new();
///
/// 批量更新实体
///
/// 实体集
///
bool TreeBantchUpdateEntity(IEnumerable entities) where T : TreeEntityBase, new();
///
/// 批量保存实体
///
/// 批量保存
///
bool TreeBantchSaveEntity(IEnumerable entities) where T : TreeEntityBase, new();
///
/// 批量添加实体
///
/// 实体集合
///
public bool TreeBantchAddEntityNoCommit(IEnumerable entities) where T : TreeEntityBase, new()
{
return this.BantchAddEntityNoCommit(entities);
}
///
/// 添加实体
///
///
///
public bool TreeAddEntityNoCommit(T entity) where T : TreeEntityBase, new()
{
return this.AddEntityNoCommit(entity);
}
public T TreeAddAndGetEntityNoCommit(T entity) where T : MesEntityBase, new()
{
return this.AddAndGetEntityNoCommit(entity);
}
T AddAndGetEntityNoCommit(T entity) where T : MesEntityBase, new();
///
/// 删除实体
///
///
///
bool TreeDeleteEntityNoCommit(Guid id) where T : TreeEntityBase, new();
///
/// 删除实体
///
///
///
bool TreeDeleteEntityNoCommit(Expression> expression) where T : TreeEntityBase, new();
///
/// 删除实体
///
///
///
bool TreeDeleteEntityNoCommit(IEnumerable entity) where T : TreeEntityBase, new();
///
/// 删除实体
///
///
///
///
bool TreeDeleteEntityNoCommit(T entity) where T : TreeEntityBase, new();
///
/// 逻辑批量删除
///
///
///
///
bool TreeBantchDeleteEntityNoCommit(List ids) where T : TreeEntityBase, new();
///
/// 更新实体
///
///
///
bool TreeUpdateEntityNoCommit(T entity) where T : TreeEntityBase, new();
///
/// 批量更新实体
///
/// 实体集
///
bool TreeBantchUpdateEntityNoCommit(IEnumerable entities) where T : TreeEntityBase, new();
///
/// 批量保存实体
///
/// 批量保存
///
bool TreeBantchSaveEntityNoCommit(IEnumerable entities) where T : TreeEntityBase, new();
#endregion
T AddAndGetEntity_noneBase(T entity) where T : class;
void AddEntities_noneBase(IEnumerable entities) where T : class;
void UpdateEntities_noneBase(IEnumerable entities) where T : class;
T GetEntity_noneBase(Expression> expressions) where T : class;
List GetEntities_noneBase(Expression> expressions) where T : class;
bool DeleteEntity_noneBase(Expression> expression) where T : class;
bool AddEntityNoCommit(T entity) where T : MesEntityBase, new();
bool BantchAddEntityNoCommit(IEnumerable entities) where T : MesEntityBase, new();
///
/// 逻辑删除
///
///
///
bool DeleteEntityNoCommit(Guid id) where T : MesEntityBase, new();
///
/// 逻辑删除
///
///
///
bool DeleteEntityNoCommit(Expression> predicate) where T : MesEntityBase, new();
///
/// 逻辑删除
///
///
///
bool DeleteEntityNoCommit(IEnumerable entities) where T : MesEntityBase, new();
///
/// 逻辑批量删除
///
///
///
///
bool BantchDeleteEntityNoCommit(List ids) where T : MesEntityBase, new();
///
/// 逻辑删除
///
///
///
bool DeleteEntityNoCommit(T entity) where T : MesEntityBase, new();
///
/// 更新
///
/// 实体
/// 是否成功
bool UpdateEntityNoCommit(T entity) where T : MesEntityBase, new();
///
/// 批量更新
///
/// 实体集合
/// 是否成功
bool BantchUpdateEntityNoCommit(IEnumerable entities) where T : MesEntityBase, new();
///
/// 更新
///
/// 实体
/// 是否成功
bool UpdateEntityNoCommit(T entity, params string[] updateField) where T : MesEntityBase, new();
///
/// 批量更新
///
/// 实体集合
/// 是否成功
bool BantchUpdateEntityNoCommit(IEnumerable entities, params string[] updateField) where T : MesEntityBase, new();
///
/// 批量更新(新增和保存一起)速度慢
///
/// 实体集合
/// 是否成功
bool BantchSaveEntityNoCommit(IEnumerable entities) where T : MesEntityBase, new();
///
/// 统一提交
///
/// 数据库方法
void UnifiedCommit(Action comitAction);
#region 根据Db连接提交
void AddEntityByConn(T entity, string conn) where T : MesEntityBase, new();
void UpdateEntitiesByConn(IEnumerable entities, string conn) where T : MesEntityBase, new();
void UpdateEntityByConn(T entity, string conn, params string[] updateField) where T : MesEntityBase, new();
void DeleteEntityByConn(Expression> expression, string conn) where T : MesEntityBase, new();
void DeleteEntityByConn(T entity, string conn) where T : MesEntityBase, new();
void DeleteEntityByConn(Guid id, string conn) where T : MesEntityBase, new();
void DeleteEntitiesByConn(IEnumerable entities, string conn) where T : MesEntityBase, new();
void AddEntitiesByConn(IEnumerable entities, string conn) where T : MesEntityBase, new();
void UpdateEntitiesByConn(IEnumerable entities, string conn, params string[] updateField) where T : MesEntityBase, new();
#endregion
#region 根据租户提交
void AddEntityByTenant(T entity, string Tenant) where T : MesEntityBase, new();
void UpdateEntitiesByTenant(IEnumerable entities, string Tenant) where T : MesEntityBase, new();
void UpdateEntityByTenant(T entity, string Tenant, params string[] updateField) where T : MesEntityBase, new();
void DeleteEntityByTenant(Expression> expression, string Tenant) where T : MesEntityBase, new();
void DeleteEntityByTenant(T entity, string Tenant) where T : MesEntityBase, new();
void DeleteEntityByTenant(Guid id, string Tenant) where T : MesEntityBase, new();
void DeleteEntitiesByTenant(IEnumerable entities, string Tenant) where T : MesEntityBase, new();
void AddEntitiesByTenant(IEnumerable entities, string Tenant) where T : MesEntityBase, new();
void UpdateEntitiesByTenant