using JiepeiWMS.Model;
|
using SqlSugar;
|
using System;
|
using System.Collections.Generic;
|
using System.Data;
|
using System.Linq.Expressions;
|
using System.Threading.Tasks;
|
|
namespace JiepeiWMS.IRepository.Base
|
{
|
public interface IBaseRepository<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);
|
|
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<TEntity> GetModel(Expression<Func<TEntity, bool>> where);
|
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>> Query(Expression<Func<TEntity, bool>> whereExpression, int intTop, string strOrderByFileds);
|
Task<List<TEntity>> Query(string strWhere, int intTop, string strOrderByFileds);
|
Task<List<TEntity>> QuerySql(string strSql, SugarParameter[] parameters = null);
|
Task<DataTable> QueryTable(string strSql, SugarParameter[] parameters = null);
|
|
int ExecuteSqlCommand(string strSql, SugarParameter[] parameters = null);
|
/// <summary>
|
/// 根据sql语句查询DataSet集合
|
/// </summary>
|
/// <param name="strSql"></param>
|
/// <param name="parameters"></param>
|
/// <returns></returns>
|
Task<DataSet> QueryTableSet(string strSql, SugarParameter[] parameters = null);
|
|
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);
|
|
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();
|
|
#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);
|
|
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);
|
|
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);
|
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();
|
Task<List<TResult>> QueryMuch<T, T2, T3, T4, TResult>(
|
Expression<Func<T, T2, T3, T4, object[]>> joinExpression,
|
Expression<Func<T, T2, T3, T4, TResult>> selectExpression,
|
Expression<Func<T, T2, T3, T4, bool>> whereLambda = null) where T : class, new();
|
}
|
}
|