WYB
2021-03-22 91b8cdad021ab052e4991f3d41834a6f0ddc36b8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
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();
    }
}