jt
2021-06-10 5d0d028456874576560552f5a5c4e8b801786f11
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
using HH.WMS.DAL;
using HH.WMS.Entitys;
using HH.WMS.Entitys.Common;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace HH.WMS.BLL
{
    public class DapperBLL<T> : BaseBLL where T : new()
    {
        #region 新增
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="trans"></param>
        /// <returns></returns>
        public OperateResult Add(T entity, IDbTransaction trans = null)
        {
            return CreateDAL<DapperDAL<T>>().Add(entity, trans);
        }
        #endregion
 
        #region 批量新增
        /// <summary>
        /// 批量新增
        /// </summary>
        /// <param name="list"></param>
        /// <param name="trans"></param>
        /// <returns></returns>
        public OperateResult AddRange(List<T> list)
        {
            return CreateDAL<DapperDAL<T>>().AddRange(list);
        }
        #endregion
 
        #region 修改
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="where"></param>
        /// <param name="trans"></param>
        /// <returns></returns>
        public OperateResult Update(T entity, object where)
        {
            return CreateDAL<DapperDAL<T>>().UpdateAll(entity, where);
        }
        #endregion
 
        #region 单表分页
        /// <summary>
        /// 单表分页
        /// </summary>
        /// <param name="where"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="orderBy"></param>
        /// <returns></returns>
        public OperateResult GetPagingResult(int pageIndex, int pageSize, object where = null, string orderBy = "")
        {
            return CreateDAL<DapperDAL<T>>().GetPagingResult(pageIndex, pageSize, where, orderBy);
        }
        public OperateResult GetPagingResult(List<SearchWhere> whereColumn,int pageIndex, int pageSize,bool isParamQuery, object where = null, string orderBy = "")
        {
            return CreateDAL<DapperDAL<T>>().GetPagingResult(whereColumn,pageIndex, pageSize,isParamQuery, where, orderBy);
        }
        #endregion
 
        #region 分页
        /// <summary>
        /// 分页
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="total"></param>
        /// <param name="where"></param>
        /// <param name="orderBy"></param>
        /// <returns></returns>
        public DataTable GetPagingData(int pageIndex, int pageSize, out long total, object where = null, string orderBy = "")
        {
            return CreateDAL<DapperDAL<T>>().GetPagingData(pageIndex, pageSize, out total, where, orderBy);
        }
 
        public DataTable GetPagingData(List<SearchWhere> whereColumn, int pageIndex, int pageSize, out long total, bool isParamQuery, object where, string orderBy = "")
        {
            return CreateDAL<DapperDAL<T>>().GetPagingData(pageIndex, pageSize, out total, whereColumn, isParamQuery, where, orderBy);
        }
        
        public DataTable GetDataTable(object where = null, string orderBy = "")
        {
            return CreateDAL<DapperDAL<T>>().GetDataTable(where, orderBy);
        }
 
        public DataTable GetData(List<SearchWhere> whereColumn, bool isParamQuery, object where = null, string orderBy = "")
        {
            return CreateDAL<DapperDAL<T>>().GetData(whereColumn, isParamQuery, where, orderBy);
        }
        #endregion
 
        #region 动态修改单表
        /// <summary>
        /// 动态修改
        /// </summary>
        /// <param name="updateFields"></param>
        /// <param name="where"></param>
        /// <param name="trans"></param>
        /// <returns></returns>
        public OperateResult Update(object updateFields, object where)
        {
            return CreateDAL<DapperDAL<T>>().Update(updateFields, where);
        }
        #endregion
 
        #region 批量修改
        /// <summary>
        /// 批量修改
        /// </summary>
        /// <param name="list"></param>
        /// <param name="where"></param>
        /// <param name="trans"></param>
        /// <returns></returns>
        public OperateResult UpdateRange(IList<T> list, object where)
        {
            return CreateDAL<DapperDAL<T>>().UpdateRange(list, where);
        }
        #endregion
 
        #region 查询-返回List
        /// <summary>
        ///  查询-返回List
        /// </summary>
        /// <param name="where"></param>
        /// <returns></returns>
        public List<T> GetList(object where = null, string orderBy = "")
        {
            return CreateDAL<DapperDAL<T>>().GetList(where, orderBy);
        }
        #endregion
 
        #region 查询-返回entity
        /// <summary>
        /// 查询-返回entity
        /// </summary>
        /// <param name="sql"></param>
        /// <param name="where"></param>
        /// <returns></returns>
        public T GetSingleEntity(object where = null, string orderBy = "")
        {
            return CreateDAL<DapperDAL<T>>().GetSingleEntity(where, orderBy);
        }
        #endregion
 
        #region 删除
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="where"></param>
        /// <returns></returns>
        public OperateResult Delete(object where)
        {
            return CreateDAL<DapperDAL<T>>().Delete(where);
        }
        #endregion
 
        public List<T> GetList(List<SearchWhere> whereColumn, object where, bool isParamQuery)
        {
            return CreateDAL<DapperDAL<T>>().GetList(whereColumn, where, isParamQuery);
        }
        #region 获取top条
        /// <summary>
        /// 获取top条
        /// </summary>
        /// <param name="top"></param>
        /// <param name="where"></param>
        /// <param name="orderBy"></param>
        /// <returns></returns>
        public List<T> GetTopList(int top, object where = null, string orderBy = "")
        {
            return CreateDAL<DapperDAL<T>>().GetTopList(top, where, orderBy);
        }
        #endregion
    }
}