| | |
| | | return db; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 创建数据库连接对象 |
| | | /// </summary> |
| | | public ISqlSugarClient Db => _db; |
| | | |
| | | public RepositoryBase(IUnitOfWorkManage unitOfWorkManage) |
| | |
| | | public virtual int AddData(List<TEntity> listEntity) |
| | | { |
| | | IInsertable<TEntity> insert = _db.Insertable(listEntity); |
| | | return insert.ExecuteReturnIdentity(); |
| | | return insert.ExecuteCommand(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | orderByModels.Add(orderByModel); |
| | | } |
| | | int totalCount = 0; |
| | | List<TEntity> list = _db.Queryable<TEntity>() |
| | | .WhereIF(!string.IsNullOrEmpty(where), where).OrderBy(orderByModels).ToPageList(pageIndex, pageSize, ref totalCount); |
| | | List<TEntity> list = _db.Queryable<TEntity>().OrderBy(orderByModels) |
| | | .WhereIF(!string.IsNullOrEmpty(where), where).ToPageList(pageIndex, pageSize, ref totalCount); |
| | | |
| | | return new PageGridData<TEntity>(totalCount, list); |
| | | } |
| | |
| | | public virtual List<TResult> QueryTabs<T, T2, TResult>( |
| | | Expression<Func<T, T2, object[]>> joinExpression, |
| | | Expression<Func<T, T2, TResult>> selectExpression, |
| | | Expression<Func<T,T2, bool>> whereExpressionT1, |
| | | Expression<Func<TResult, bool>> whereExpression) |
| | | { |
| | | List<TResult> list = _db.Queryable(joinExpression) |
| | | List<TResult> list = _db.Queryable(joinExpression).WhereIF(whereExpressionT1 != null, whereExpressionT1) |
| | | .Select(selectExpression) |
| | | .WhereIF(whereExpression != null, whereExpression).ToList(); |
| | | return list; |