public PageModel Get(int PageIndex = 1, int PageSize = 5, int Pid = 0, int Tid = 0, int Gid = 0) { DynamicParameters sp = new DynamicParameters(); sp.Add("@PageIndex", PageIndex); sp.Add("@PageSize", PageSize); sp.Add("@Pid", Pid); sp.Add("@Tid", Tid); sp.Add("@TotalCount", dbType: DbType.Int32, direction: ParameterDirection.Output); PageModel model = new PageModel() { data = conn.Query<GoodsModel>("G_Page", sp, commandType: CommandType.StoredProcedure).ToList(), TotalCount = sp.Get<int>("@TotalCount") }; if (Gid!=0) { model.data= model.data.Where(s=>s.Gid==Gid).ToList(); } return model; }
原文地址:https://www.cnblogs.com/ly-03-04/p/12178908.html
时间: 2024-10-11 00:49:15