perf: 优化全部模块程序集
This commit is contained in:
@@ -9,7 +9,6 @@ using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.AspNetCore.CurrentUser;
|
||||
using Yi.Framework.Core.Const;
|
||||
using Yi.Framework.Core.CurrentUsers;
|
||||
using Yi.Framework.Core.CurrentUsers.Accessor;
|
||||
|
||||
@@ -7,7 +7,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.AspNetCore.CurrentUser;
|
||||
using Yi.Framework.Core.CurrentUsers.Accessor;
|
||||
using Yi.Framework.Core.CurrentUsers;
|
||||
|
||||
|
||||
@@ -45,6 +45,29 @@ namespace Yi.Framework.Core.Sqlsugar.Repositories
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public async Task<List<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, int pageNum,int pageSize)
|
||||
{
|
||||
return await base.GetPageListAsync(whereExpression, new PageModel { PageIndex = pageNum, PageSize = pageSize });
|
||||
}
|
||||
|
||||
public async Task<List<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, int pageNum, int pageSize, Expression<Func<T, object>>? orderByExpression = null, OrderByEnum orderByType = OrderByEnum.Asc)
|
||||
{
|
||||
return await base.GetPageListAsync(whereExpression, new PageModel { PageIndex = pageNum, PageSize = pageSize }, orderByExpression, orderByType.EnumToEnum<OrderByType>());
|
||||
}
|
||||
|
||||
public async Task<List<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, int pageNum, int pageSize, string? orderBy, OrderByEnum orderByType = OrderByEnum.Asc)
|
||||
{
|
||||
return await _DbQueryable.Where(whereExpression).OrderByIF(orderBy is not null, orderBy + " " + orderByType.ToString().ToLower()).ToPageListAsync(pageNum, pageSize);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public async Task<bool> UpdateIgnoreNullAsync(T updateObj)
|
||||
{
|
||||
return await _Db.Updateable(updateObj).IgnoreColumns(true).ExecuteCommandAsync() > 0;
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.Core.Module
|
||||
{
|
||||
public class ModuleAssembly
|
||||
{
|
||||
private static HashSet<Assembly> assemblies=new HashSet<Assembly>();
|
||||
public static Assembly[] Assemblies { get=> assemblies.ToArray();}
|
||||
|
||||
public static void Add(Assembly assembly)
|
||||
{
|
||||
assemblies.Add(assembly);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,8 @@ namespace Yi.Framework.Core.Module
|
||||
|
||||
foreach (var r in result)
|
||||
{
|
||||
|
||||
//添加全局模块程序集
|
||||
ModuleAssembly.Add(r.Assembly);
|
||||
Console.WriteLine($"意框架正在加载模块:{r.Name}");
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -29,6 +29,9 @@ namespace Yi.Framework.Ddd.Repositories
|
||||
Task<List<T>> GetListAsync(Expression<Func<T, bool>> whereExpression);
|
||||
|
||||
//分页查
|
||||
Task<List<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, int pageNum, int pageSize);
|
||||
Task<List<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, int pageNum, int pageSize, Expression<Func<T, object>>? orderByExpression = null, OrderByEnum orderByType = OrderByEnum.Asc);
|
||||
Task<List<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, int pageNum, int pageSize, string? orderBy, OrderByEnum orderByType = OrderByEnum.Asc);
|
||||
Task<List<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, IPagedAndSortedResultRequestDto page);
|
||||
Task<List<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, IPagedAndSortedResultRequestDto page, Expression<Func<T, object>>? orderByExpression = null, OrderByEnum orderByType = OrderByEnum.Asc);
|
||||
Task<List<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, IPagedAndSortedResultRequestDto page, string? orderBy, OrderByEnum orderByType = OrderByEnum.Asc);
|
||||
@@ -55,5 +58,6 @@ namespace Yi.Framework.Ddd.Repositories
|
||||
Task<bool> DeleteAsync(Expression<Func<T, bool>> whereExpression);
|
||||
Task<bool> DeleteByIdAsync(dynamic id);
|
||||
Task<bool> DeleteByIdsAsync(dynamic[] ids);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user