zoukankan      html  css  js  c++  java
  • DAL分页

    using System;
    using System.Collections.Generic;
    using LModel.DTO;
    using Newtonsoft.Json;
    using System.Data.SqlClient;
    using System.Data;
    using DBHelper;
     
    namespace DAL
    {
        public class PageCommon
        {
            public static PageInfo<T> GetPageInfo<T>(ParamModel model)
            {
                SqlParameter[] parms =
                {
                    new SqlParameter("@tableName",model.tableName),
                    new SqlParameter("@indexCol",model.IndexCol),
                    new SqlParameter("@pageSize",model.PageSize),
                    new SqlParameter("@pageIndex",model.PageIndex),
                    new SqlParameter("@orderCol",model.OrderCol),
                    new SqlParameter("@where",model.StrWhere),
                    new SqlParameter("@columns",model.Columns),
                };
                ///调用存储过程
                DataSet ds = DbHelperSQL.ExecuteDataset(DbHelperSQL.ConnB2c,CommandType.StoredProcedure, "p_paging",parms);
                //转换类型
                var list = JsonConvert.DeserializeObject<List<T>>(JsonConvert.SerializeObject(ds.Tables[0]));
                //实例分页参数类
                PageInfo<T> pageinfo = new PageInfo<T>();
                pageinfo.listData = list;
                pageinfo.tCount = Convert.ToInt32(ds.Tables[1].Rows[0][0]);
     
                return pageinfo;
            }
        }
    }
  • 相关阅读:
    axios 封装
    Git 常用命令行
    React Native 开发环境搭建
    React Native 组件分类
    日期插件rolldate.js的使用
    单图片上传
    使用css完成物流进度的样式
    搜索过滤 以及排序
    v-for的使用方法
    v-if 和v-show 用法
  • 原文地址:https://www.cnblogs.com/BoKeYuan259/p/9520308.html
Copyright © 2011-2022 走看看