From 08d4252c79d088d7bf97a08d314ec8577d96e2d2 Mon Sep 17 00:00:00 2001 From: 刘磊 <1161824510@qq.com> Date: 星期六, 14 六月 2025 19:57:47 +0800 Subject: [PATCH] 火警 --- Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/RepositoryBase.cs | 43 ++++++++++++++++++++++++++++++++++++------- 1 files changed, 36 insertions(+), 7 deletions(-) diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/RepositoryBase.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/RepositoryBase.cs index 539c96b..ee96461 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/RepositoryBase.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/RepositoryBase.cs @@ -15,6 +15,9 @@ using WIDESEA_Core.DB; using WIDESEA_Core.Const; using WIDESEA_Core.AOP; +using AngleSharp.Dom; +using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; +using SharpCompress.Common; namespace WIDESEA_Core.BaseRepository { @@ -33,7 +36,7 @@ var mta = typeof(TEntity).GetCustomAttribute<MultiTenantAttribute>(); if (mta is { TenantType: TenantTypeEnum.Db }) { - //鑾峰彇绉熸埛淇℃伅 绉熸埛淇℃伅鍙互鎻愬墠缂撳瓨涓嬫潵 + //鑾峰彇绉熸埛淇℃伅 绉熸埛淇℃伅鍙互鎻愬墠缂撳瓨涓嬫潵 if (App.User is { TenantId: > 0 }) { dynamic tenant = db.Queryable(MainDb.TenantTableName, "x").Where(MainDb.TenantId, "=", App.User.TenantId).First(); @@ -392,7 +395,7 @@ /// <returns></returns> public virtual List<TEntity> QueryData(Expression<Func<TEntity, bool>> whereExpression, int top, string orderByFields) { - return _db.Queryable<TEntity>().OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields).WhereIF(whereExpression != null, whereExpression).Take(top).ToList(); + return _db.Queryable<TEntity>().OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields).WhereIF(whereExpression != null, whereExpression).Take(top).IncludesAllFirstLayer().ToList(); } /// <summary> @@ -404,7 +407,7 @@ /// <returns></returns> public virtual List<TEntity> QueryData(string where, int top, string orderByFields) { - return _db.Queryable<TEntity>().OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields).WhereIF(!string.IsNullOrEmpty(where), where).Take(top).ToList(); + return _db.Queryable<TEntity>().OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields).WhereIF(!string.IsNullOrEmpty(where), where).Take(top).IncludesAllFirstLayer().ToList(); } /// <summary> @@ -432,7 +435,7 @@ public virtual List<TEntity> QueryData(string where, int pageIndex, int pageSize, string orderByFields) { return _db.Queryable<TEntity>().OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields) - .WhereIF(!string.IsNullOrEmpty(where), where).ToPageList(pageIndex, pageSize); + .WhereIF(!string.IsNullOrEmpty(where), where).IncludesAllFirstLayer().ToPageList(pageIndex, pageSize); } /// <summary> @@ -449,6 +452,7 @@ var list = _db.Queryable<TEntity>() .OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields) .WhereIF(whereExpression != null, whereExpression) + .IncludesAllFirstLayer() .ToPageList(pageIndex, pageSize, ref totalCount); return new PageGridData<TEntity> { Rows = list, Total = totalCount }; @@ -478,6 +482,7 @@ List<TEntity> list = _db.Queryable<TEntity>() .OrderBy(orderByModels) .WhereIF(whereExpression != null, whereExpression) + .IncludesAllFirstLayer() .ToPageList(pageIndex, pageSize, ref totalCount); return new PageGridData<TEntity>(totalCount, list); @@ -505,7 +510,7 @@ } int totalCount = 0; List<TEntity> list = _db.Queryable<TEntity>() - .WhereIF(!string.IsNullOrEmpty(where), where).OrderBy(orderByModels).ToPageList(pageIndex, pageSize, ref totalCount); + .WhereIF(!string.IsNullOrEmpty(where), where).OrderBy(orderByModels).IncludesAllFirstLayer().ToPageList(pageIndex, pageSize, ref totalCount); return new PageGridData<TEntity>(totalCount, list); } @@ -586,7 +591,6 @@ // Expression<Func<T, T2, T3, bool>> whereLambda = null) where T : class, new(){throw new NotImplementedException();} //Task<PageModel<TEntity>> QueryPage(PaginationModel pagination){throw new NotImplementedException();} - public Task<TEntity> QureyDataByIdAsync(object id) { return _db.Queryable<TEntity>().In(id).SingleAsync(); @@ -606,6 +610,16 @@ { IInsertable<TEntity> insert = _db.Insertable(entity); return insert.ExecuteReturnIdentityAsync(); + } + + /// <summary> + /// 瀵艰埅鎻掑叆鏁版嵁(鍙敮鎸�2绾�) + /// </summary> + /// <param name="Entity"></param> + /// <returns></returns> + public async Task<bool> AddDataNavAsync(TEntity Entity) + { + return await _db.InsertNav(Entity).IncludesAllFirstLayer().ExecuteCommandAsync(); } public Task<int> AddDataAsync(List<TEntity> listEntity) @@ -679,6 +693,11 @@ public Task<TEntity> QueryFirstAsync(Expression<Func<TEntity, bool>> whereExpression) { return _db.Queryable<TEntity>().WhereIF(whereExpression != null, whereExpression).FirstAsync(); + } + + public Task<TEntity> QueryFirstNavAsync(Expression<Func<TEntity, bool>> whereExpression) + { + return _db.Queryable<TEntity>().WhereIF(whereExpression != null, whereExpression).IncludesAllFirstLayer().FirstAsync(); } public Task<TResult> QueryFirstAsync<TResult>(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, TResult>> expression) @@ -861,10 +880,20 @@ return _db.Queryable<TEntity>().WhereIF(whereExpression != null, whereExpression).OrderBy(orderByModels).ToList(); } + public Task<bool> UpdateDataNavAsync(TEntity Entity) + { + return _db.UpdateNav(Entity).IncludesAllFirstLayer().ExecuteCommandAsync(); + } + + public bool UpdateDataNav(TEntity Entity) + { + return _db.UpdateNav(Entity).IncludesAllFirstLayer().ExecuteCommand(); + } + //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(){throw new NotImplementedException();} //Task<PageModel<TEntity>> QueryPage(PaginationModel pagination){throw new NotImplementedException();} } -} +} \ No newline at end of file -- Gitblit v1.9.3