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; }