using JiepeiWMS.Model;
|
using SqlSugar;
|
using System;
|
using System.Collections.Generic;
|
using System.Data;
|
using System.Linq.Expressions;
|
using System.Threading.Tasks;
|
|
namespace JiepeiWMS.IServices.BASE
|
{
|
public interface IBaseServices<TEntity> where TEntity : class
|
{
|
|
Task<TEntity> QueryById(object objId);
|
Task<TEntity> QueryById(object objId, bool blnUseCache = false);
|
Task<List<TEntity>> QueryByIDs(object[] lstIds);
|
|
Task<int> Add(TEntity model);
|
|
|
/// <summary>
|
/// 返回一个模型
|
/// </summary>
|
/// <param name="departId"></param>
|
/// <returns></returns>
|
Task<TEntity> GetModel(Expression<Func<TEntity, bool>> where);
|
|
Task<int> Add(List<TEntity> listEntity);
|
|
Task<bool> DeleteById(object id);
|
|
Task<bool> Delete(TEntity model);
|
|
Task<bool> DeleteByIds(object[] ids);
|
|
Task<bool> Update(params TEntity[] models);
|
Task<bool> Update(TEntity entity, string strWhere);
|
|
Task<bool> Update(object operateAnonymousObjects);
|
|
Task<bool> Update(TEntity entity, List<string> lstColumns = null, List<string> lstIgnoreColumns = null, string strWhere = "");
|
|
Task<List<TEntity>> Query();
|
Task<List<TEntity>> Query(string strWhere);
|
Task<List<TEntity>> Query(Expression<Func<TEntity, bool>> whereExpression);
|
Task<List<TEntity>> Query(Expression<Func<TEntity, bool>> whereExpression, string strOrderByFileds);
|
Task<List<TEntity>> Query(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, object>> orderByExpression, bool isAsc = true);
|
Task<List<TEntity>> Query(string strWhere, string strOrderByFileds);
|
Task<List<TEntity>> QuerySql(string strSql, SugarParameter[] parameters = null);
|
Task<DataTable> QueryTable(string strSql, SugarParameter[] parameters = null);
|
|
/// <summary>
|
/// 根据sql语句查询DataSet集合
|
/// </summary>
|
/// <param name="strSql">完整的sql语句</param>
|
/// <param name="parameters">参数</param>
|
/// <returns>DataTable</returns>
|
Task<DataSet> QueryTableSet(string strSql, SugarParameter[] parameters = null);
|
|
Task<List<TEntity>> Query(Expression<Func<TEntity, bool>> whereExpression, int intTop, string strOrderByFileds);
|
Task<List<TEntity>> Query(string strWhere, int intTop, string strOrderByFileds);
|
|
Task<List<TEntity>> Query(
|
Expression<Func<TEntity, bool>> whereExpression, int intPageIndex, int intPageSize, string strOrderByFileds);
|
Task<List<TEntity>> Query(string strWhere, int intPageIndex, int intPageSize, string strOrderByFileds);
|
|
|
Task<PageModel<TEntity>> QueryPage(Expression<Func<TEntity, bool>> whereExpression, int intPageIndex = 1, int intPageSize = 20, string strOrderByFileds = null);
|
#region 2表关联查询
|
Task<PageModel<T>> QueryPage<T, T2>(Expression<Func<T, T2, object[]>> joinExpression,
|
Expression<Func<T, T2, T>> selectExpression,
|
Expression<Func<T, T2, bool>> whereExpression,
|
int intPageIndex = 1, int intPageSize = 20, string strOrderByFileds = null) where T : class, new();
|
#endregion
|
#region 5表关联查询
|
Task<PageModel<TResult>> QueryPage<T, T2, T3, T4, T5, TResult>(
|
Expression<Func<T, T2, T3, T4, T5, object[]>> joinExpression,
|
Expression<Func<T, T2, T3, T4, T5, TResult>> selectExpression,
|
Expression<Func<T, T2, T3, T4, T5, bool>> whereExpression,
|
int intPageIndex = 1,
|
int intPageSize = 20,
|
string strOrderByFileds = null);
|
#endregion
|
#region 6表关联查询
|
/// <summary>
|
/// 六表联合查询-分页
|
/// </summary>
|
/// <typeparam name="T">实体1</typeparam>
|
/// <typeparam name="T2">实体1</typeparam>
|
/// <typeparam name="T3">实体1</typeparam>
|
/// <typeparam name="T4">实体1</typeparam>
|
/// <typeparam name="T5">实体1</typeparam>
|
/// <typeparam name="T6">实体1</typeparam>
|
/// <typeparam name="TResult">返回对象</typeparam>
|
/// <param name="JoinExpression">关联表达式</param>
|
/// <param name="SelectExpression">返回表达式</param>
|
/// <param name="WhereExpression">查询表达式</param>
|
/// <param name="PageIndex">页码</param>
|
/// <param name="PageSize">页大小</param>
|
/// <param name="OrderByFileds">排序字段</param>
|
/// <returns></returns>
|
Task<PageModel<TResult>> QueryPage<T, T2, T3, T4, T5, T6, TResult>(
|
Expression<Func<T, T2, T3, T4, T5, T6, object[]>> JoinExpression,
|
Expression<Func<T, T2, T3, T4, T5, T6, TResult>> SelectExpression,
|
Expression<Func<T, T2, T3, T4, T5, T6, bool>> WhereExpression,
|
int PageIndex = 1,
|
int PageSize = 20,
|
string OrderByFileds = null);
|
#endregion
|
/// <summary>
|
/// 两表联合查询-分页
|
/// </summary>
|
/// <typeparam name="T">实体1</typeparam>
|
/// <typeparam name="T2">实体1</typeparam>
|
/// <typeparam name="TResult">返回对象</typeparam>
|
/// <param name="joinExpression">关联表达式</param>
|
/// <param name="selectExpression">返回表达式</param>
|
/// <param name="whereExpression">查询表达式</param>
|
/// <param name="intPageIndex">页码</param>
|
/// <param name="intPageSize">页大小</param>
|
/// <param name="strOrderByFileds">排序字段</param>
|
/// <returns></returns>
|
Task<PageModel<TResult>> QueryTabsPage<T, T2, TResult>(
|
Expression<Func<T, T2, object[]>> joinExpression,
|
Expression<Func<T, T2, TResult>> selectExpression,
|
Expression<Func<TResult, bool>> whereExpression,
|
int intPageIndex = 1,
|
int intPageSize = 20,
|
string strOrderByFileds = null);
|
|
/// <summary>
|
/// 三表联合查询-分页
|
/// </summary>
|
/// <typeparam name="T">实体</typeparam>
|
/// <typeparam name="T2">实体</typeparam>
|
/// <typeparam name="T3">实体</typeparam>
|
/// <typeparam name="TResult">返回对象</typeparam>
|
/// <param name="joinExpression">关联表达式</param>
|
/// <param name="selectExpression">返回表达式</param>
|
/// <param name="whereExpression">查询表达式</param>
|
/// <param name="intPageIndex">页码</param>
|
/// <param name="intPageSize">页大小</param>
|
/// <param name="strOrderByFileds">排序字段</param>
|
/// <returns></returns>
|
Task<PageModel<TResult>> QueryTabsPage<T, T2, T3, TResult>(
|
Expression<Func<T, T2, T3, object[]>> joinExpression,
|
Expression<Func<T, T2, T3, TResult>> selectExpression,
|
Expression<Func<TResult, bool>> whereExpression,
|
int intPageIndex = 1,
|
int intPageSize = 20,
|
string strOrderByFileds = null);
|
/// <summary>
|
/// 四表联合查询-分页
|
/// </summary>
|
/// <typeparam name="T">实体1</typeparam>
|
/// <typeparam name="T2">实体1</typeparam>
|
/// <typeparam name="T3">实体1</typeparam>
|
/// <typeparam name="T4">实体1</typeparam>
|
/// <typeparam name="TResult">返回对象</typeparam>
|
/// <param name="joinExpression">关联表达式</param>
|
/// <param name="selectExpression">返回表达式</param>
|
/// <param name="whereExpression">查询表达式</param>
|
/// <param name="intPageIndex">页码</param>
|
/// <param name="intPageSize">页大小</param>
|
/// <param name="strOrderByFileds">排序字段</param>
|
/// <returns></returns>
|
Task<PageModel<TResult>> QueryTabsPage<T, T2, T3, T4, TResult>(
|
Expression<Func<T, T2, T3, T4, object[]>> joinExpression,
|
Expression<Func<T, T2, T3, T4, TResult>> selectExpression,
|
Expression<Func<TResult, bool>> whereExpression,
|
int intPageIndex = 1,
|
int intPageSize = 20,
|
string strOrderByFileds = null);
|
/// <summary>
|
/// 五表联合查询-分页
|
/// </summary>
|
/// <typeparam name="T">实体1</typeparam>
|
/// <typeparam name="T2">实体1</typeparam>
|
/// <typeparam name="T3">实体1</typeparam>
|
/// <typeparam name="T4">实体1</typeparam>
|
/// <typeparam name="T5">实体1</typeparam>
|
/// <typeparam name="TResult">返回对象</typeparam>
|
/// <param name="joinExpression">关联表达式</param>
|
/// <param name="selectExpression">返回表达式</param>
|
/// <param name="whereExpression">查询表达式</param>
|
/// <param name="intPageIndex">页码</param>
|
/// <param name="intPageSize">页大小</param>
|
/// <param name="strOrderByFileds">排序字段</param>
|
/// <returns></returns>
|
Task<PageModel<TResult>> QueryTabsPage<T, T2, T3, T4, T5, TResult>(
|
Expression<Func<T, T2, T3, T4, T5, object[]>> joinExpression,
|
Expression<Func<T, T2, T3, T4, T5, TResult>> selectExpression,
|
Expression<Func<TResult, bool>> whereExpression,
|
int intPageIndex = 1,
|
int intPageSize = 20,
|
string strOrderByFileds = null);
|
|
Task<List<TResult>> QueryMuch<T, T2, T3, TResult>(
|
Expression<Func<T, T2, T3, object[]>> joinExpression,
|
Expression<Func<T, T2, T3, TResult>> selectExpression,
|
Expression<Func<T, T2, T3, bool>> whereLambda = null) where T : class, new();
|
|
/// <summary>
|
/// 更新关联表信息(存在则保留,不存在则新增,符合删除条件则删除,且FieldNames中未指定的字段必须为存在默认值)
|
/// </summary>
|
/// <param name="TableName">关联表表名</param>
|
/// <param name="FieldNames">字段名列表,例如:[UserId(用户Id),RoleId(角色Id)...]</param>
|
/// <param name="Values">值列表:[{UserId:1,RoleId:2,...},{UserId:1,RoleId:3,...},{UserId:1,RoleId:5,...}]</param>
|
/// <param name="DelWhereFieldNames">字段名列表,例如:[UserId(用户Id)...]</param>
|
/// <param name="DelWhereValues">值列表:[{UserId:1,...},{UserId:2,...}]</param>
|
/// <returns>错误信息,空则成功</returns>
|
string UpdateJoinInfo(string TableName, IList<string> FieldNames, IList<object> Values, IList<string> DelWhereFieldNames = null, IList<object> DelWhereValues = null);
|
}
|
|
}
|