diff --git a/HybirdFrameworkCore/Entity/IPage.cs b/HybirdFrameworkCore/Entity/IPage.cs index b9a8d4a..69bcb57 100644 --- a/HybirdFrameworkCore/Entity/IPage.cs +++ b/HybirdFrameworkCore/Entity/IPage.cs @@ -13,7 +13,7 @@ public class IPage public IPage(int total, QueryPageModel page, List? rows) { Total = total; - PageNum = page.Page; + PageNum = page.PageNum; PageSize = page.PageSize; Rows = rows; } diff --git a/HybirdFrameworkCore/Entity/QueryPageModel.cs b/HybirdFrameworkCore/Entity/QueryPageModel.cs index b8bfd4a..48cc3b6 100644 --- a/HybirdFrameworkCore/Entity/QueryPageModel.cs +++ b/HybirdFrameworkCore/Entity/QueryPageModel.cs @@ -5,9 +5,9 @@ public class QueryPageModel /// ///页码 /// - public int Page { get; set; } = 1; + public int PageNum { get; set; } = 1; /// /// 页数 /// public int PageSize { get; set; } = 10; -} \ No newline at end of file +} diff --git a/Repository/BaseRepository.cs b/Repository/BaseRepository.cs index 770092e..97f2c93 100644 --- a/Repository/BaseRepository.cs +++ b/Repository/BaseRepository.cs @@ -29,6 +29,12 @@ public abstract class BaseRepository where T : class, new() .InSingle(pkValue); } + public ISugarQueryable Queryable(bool blUseNoLock = false) + { + return DbBaseClient + .Queryable().WithNoLockOrNot(blUseNoLock); + } + /// /// 根据主值查询单条数据 /// @@ -109,7 +115,7 @@ public abstract class BaseRepository where T : class, new() .Queryable() .Where(predicate) .WithNoLockOrNot(false) - .ToPageList(page.Page, page.PageSize, ref totalCount); + .ToPageList(page.PageNum, page.PageSize, ref totalCount); @@ -135,7 +141,7 @@ public abstract class BaseRepository where T : class, new() .Queryable() .Where(predicate) .WithNoLockOrNot(false) - .ToPageListAsync(page.Page, page.PageSize, totalCount); + .ToPageListAsync(page.PageNum, page.PageSize, totalCount); @@ -159,7 +165,7 @@ public abstract class BaseRepository where T : class, new() List pageList = DbBaseClient .Queryable() .WithNoLockOrNot(false) - .ToPageList(page.Page, page.PageSize, ref totalCount); + .ToPageList(page.PageNum, page.PageSize, ref totalCount); return new IPage(totalCount, page, pageList); } @@ -176,7 +182,7 @@ public abstract class BaseRepository where T : class, new() List pageList = await DbBaseClient .Queryable() .WithNoLockOrNot(false) - .ToPageListAsync(page.Page, page.PageSize, totalCount); + .ToPageListAsync(page.PageNum, page.PageSize, totalCount); return new IPage(totalCount, page, pageList); } @@ -725,7 +731,7 @@ public abstract class BaseRepository where T : class, new() .ToList(); } /// - /// + /// /// /// /// @@ -779,7 +785,7 @@ public abstract class BaseRepository where T : class, new() .Insertable(entity) .ExecuteReturnEntity(); } - + /// /// 写入或者更新实体数据 /// @@ -1704,4 +1710,4 @@ public abstract class BaseRepository where T : class, new() -} \ No newline at end of file +}