diff --git a/04.系统编码/App/Controllers/ConfigManagementController.cs b/04.系统编码/App/Controllers/ConfigManagementController.cs index b26fca1..1e219b5 100644 --- a/04.系统编码/App/Controllers/ConfigManagementController.cs +++ b/04.系统编码/App/Controllers/ConfigManagementController.cs @@ -1,5 +1,6 @@ using PetaPoco; using System.Web.Mvc; +using System.Collections.Generic; using Pingchuan.BeijingSafeguard.BLL; using Pingchuan.BeijingSafeguard.Model; @@ -19,7 +20,7 @@ namespace Pingchuan.BeijingSafeguard.App.Controllers return ConfigBLL.Update(config); } - public static Page Query(int pageIndex, int pageSize) + public static List Query(int pageIndex, int pageSize) { return ConfigBLL.Query(pageIndex, pageSize); } diff --git a/04.系统编码/App/Controllers/OrgManagementController.cs b/04.系统编码/App/Controllers/OrgManagementController.cs index 0a687cf..1100148 100644 --- a/04.系统编码/App/Controllers/OrgManagementController.cs +++ b/04.系统编码/App/Controllers/OrgManagementController.cs @@ -38,7 +38,7 @@ namespace Pingchuan.BeijingSafeguard.App.Controllers [HttpPost] public JsonResult Query(int pageIndex, int pageSize) { - Page orgs = OrgBLL.Query(pageIndex, pageSize); + Pagination orgs = OrgBLL.Query(pageIndex, pageSize); return Json(orgs); } } diff --git a/04.系统编码/App/Controllers/StatisticAnalysisController.cs b/04.系统编码/App/Controllers/StatisticAnalysisController.cs index aa7d31c..e7400f0 100644 --- a/04.系统编码/App/Controllers/StatisticAnalysisController.cs +++ b/04.系统编码/App/Controllers/StatisticAnalysisController.cs @@ -1,4 +1,4 @@ -using PetaPoco; +using System; using System.Web.Mvc; using Pingchuan.BeijingSafeguard.BLL; @@ -17,7 +17,7 @@ namespace Pingchuan.BeijingSafeguard.App.Controllers [HttpPost] public JsonResult Query(int pageIndex, int pageSize) { - Page users = UserBLL.Query(pageIndex, pageSize); + Pagination users = UserBLL.Query(pageIndex, pageSize); return Json(users); } } diff --git a/04.系统编码/App/Controllers/UserManagementController.cs b/04.系统编码/App/Controllers/UserManagementController.cs index 6b2f880..389481b 100644 --- a/04.系统编码/App/Controllers/UserManagementController.cs +++ b/04.系统编码/App/Controllers/UserManagementController.cs @@ -38,7 +38,7 @@ namespace Pingchuan.BeijingSafeguard.App.Controllers [HttpPost] public JsonResult Query(int pageIndex, int pageSize) { - Page users = UserBLL.Query(pageIndex, pageSize); + Pagination users = UserBLL.Query(pageIndex, pageSize); return Json(users); } } diff --git a/04.系统编码/BLL/BLL.csproj b/04.系统编码/BLL/BLL.csproj index ef3a03e..282e602 100644 --- a/04.系统编码/BLL/BLL.csproj +++ b/04.系统编码/BLL/BLL.csproj @@ -68,8 +68,5 @@ Utility - - - \ No newline at end of file diff --git a/04.系统编码/BLL/ConfigBLL.cs b/04.系统编码/BLL/ConfigBLL.cs index 5e502fe..070afd7 100644 --- a/04.系统编码/BLL/ConfigBLL.cs +++ b/04.系统编码/BLL/ConfigBLL.cs @@ -1,5 +1,5 @@ using System; -using PetaPoco; +using System.Collections.Generic; using Pingchuan.BeijingSafeguard.DAL; using Pingchuan.BeijingSafeguard.Model; @@ -13,7 +13,7 @@ namespace Pingchuan.BeijingSafeguard.BLL return ConfigDAL.Update(config); } - public static Page Query(int pageIndex, int pageSize) + public static List Query(int pageIndex, int pageSize) { return ConfigDAL.Query(pageIndex, pageSize); } diff --git a/04.系统编码/BLL/OrgBLL.cs b/04.系统编码/BLL/OrgBLL.cs index 34a913d..b79cd1e 100644 --- a/04.系统编码/BLL/OrgBLL.cs +++ b/04.系统编码/BLL/OrgBLL.cs @@ -25,7 +25,7 @@ namespace Pingchuan.BeijingSafeguard.BLL return OrgDAL.Delete(id); } - public static Page Query(int pageIndex, int pageSize) + public static Pagination Query(int pageIndex, int pageSize) { return OrgDAL.Query(pageIndex, pageSize); } diff --git a/04.系统编码/BLL/UserBLL.cs b/04.系统编码/BLL/UserBLL.cs index 27f0beb..41fd277 100644 --- a/04.系统编码/BLL/UserBLL.cs +++ b/04.系统编码/BLL/UserBLL.cs @@ -38,7 +38,7 @@ namespace Pingchuan.BeijingSafeguard.BLL return UserDAL.Delete(id); } - public static Page Query(int pageIndex, int pageSize) + public static Pagination Query(int pageIndex, int pageSize) { return UserDAL.Query(pageIndex, pageSize); } diff --git a/04.系统编码/DAL/ConfigDAL.cs b/04.系统编码/DAL/ConfigDAL.cs index d47cb73..9e58322 100644 --- a/04.系统编码/DAL/ConfigDAL.cs +++ b/04.系统编码/DAL/ConfigDAL.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using PetaPoco; using Pingchuan.BeijingSafeguard.Model; @@ -11,10 +12,11 @@ namespace Pingchuan.BeijingSafeguard.DAL return db.Update(config); } - public static Page Query(int pageIndex, int pageSize) + public static List Query(int pageIndex, int pageSize) { string sql = $@"select * from configs order by id desc"; - return db.Page(pageIndex, pageSize, sql); + Page page = db.Page(pageIndex, pageSize, sql); + return page.Items; } } } \ No newline at end of file diff --git a/04.系统编码/DAL/DAL.csproj b/04.系统编码/DAL/DAL.csproj index 3b12b87..8bf2b30 100644 --- a/04.系统编码/DAL/DAL.csproj +++ b/04.系统编码/DAL/DAL.csproj @@ -68,8 +68,5 @@ Utility - - - \ No newline at end of file diff --git a/04.系统编码/DAL/OrgDAL.cs b/04.系统编码/DAL/OrgDAL.cs index a56a82e..4b0b253 100644 --- a/04.系统编码/DAL/OrgDAL.cs +++ b/04.系统编码/DAL/OrgDAL.cs @@ -27,10 +27,11 @@ namespace Pingchuan.BeijingSafeguard.DAL return db.Execute(sql); } - public static Page Query(int pageIndex, int pageSize) + public static Pagination Query(int pageIndex, int pageSize) { string sql = $@"select * from orgs order by create_time desc"; - return db.Page(pageIndex, pageSize, sql); + Page orgs = db.Page(pageIndex, pageSize, sql); + return Pagination.FromPage(orgs); } } } diff --git a/04.系统编码/DAL/UserDAL.cs b/04.系统编码/DAL/UserDAL.cs index ef71312..6bd0984 100644 --- a/04.系统编码/DAL/UserDAL.cs +++ b/04.系统编码/DAL/UserDAL.cs @@ -1,4 +1,5 @@ -using PetaPoco; +using System; +using PetaPoco; using Pingchuan.BeijingSafeguard.Model; namespace Pingchuan.BeijingSafeguard.DAL @@ -42,10 +43,11 @@ namespace Pingchuan.BeijingSafeguard.DAL return db.Execute(sql); } - public static Page Query(int pageIndex, int pageSize) + public static Pagination Query(int pageIndex, int pageSize) { string sql = $@"select * from users order by create_time desc"; - return db.Page(pageIndex, pageSize, sql); + Page users = db.Page(pageIndex, pageSize, sql); + return Pagination.FromPage(users); } } } \ No newline at end of file diff --git a/04.系统编码/Model/Model.csproj b/04.系统编码/Model/Model.csproj index c9a13a7..5f77f3b 100644 --- a/04.系统编码/Model/Model.csproj +++ b/04.系统编码/Model/Model.csproj @@ -49,6 +49,7 @@ + @@ -61,8 +62,5 @@ Utility - - - \ No newline at end of file diff --git a/04.系统编码/Model/Pagination.cs b/04.系统编码/Model/Pagination.cs new file mode 100644 index 0000000..8cf74ea --- /dev/null +++ b/04.系统编码/Model/Pagination.cs @@ -0,0 +1,20 @@ +using System; +using PetaPoco; +using System.Collections.Generic; + +namespace Pingchuan.BeijingSafeguard.Model +{ + public class Pagination + { + public long total { get; set; } + public List rows { get; set; } + + public static Pagination FromPage(Page page) + { + Pagination pagination = new Pagination(); + pagination.total = page.TotalItems; + pagination.rows = page.Items; + return pagination; + } + } +} \ No newline at end of file