zoukankan      html  css  js  c++  java
  • 多条件分页存储过程控制器写法

    public PageList<StudentsInfo> Page(string Name, string Start_Time, string End_Time, int Grade_TypeId, int id = 0)
            {
                ViewBag.Grade_Id = new SelectList(studentsbll.Grade_TypeList(), "Grade_Id", "Grade_Name");

                StringBuilder strb = new StringBuilder();
                strb.Append(" 1=1 ");
                if (!string.IsNullOrEmpty(Name))
                {
                    strb.Append(" and Name like '%" + Name + "%'");
                }
                if (!string.IsNullOrEmpty(Start_Time) && !string.IsNullOrEmpty(End_Time))
                {
                    strb.Append(" and(Start_Time between'" + Start_Time + "'and'" + End_Time + "')");
                }
                if (Grade_TypeId != 0)
                {
                    strb.Append(" and a.Grade_Id=" + Grade_TypeId);
                }
                ParamModel parammodel = new ParamModel()
                {
                    TableName = "StudentsInfo a inner join Grade_Type b on a.Grade_Id=b.Grade_Id",
                    IndexCol = "Id",
                    PageSize = 3,
                    PageIndex = id,
                    OrderCol = "Id desc",
                    StrWhere = strb.ToString(),
                    Columns = "*"
                };
                var list = studentsbll.GetStudentInfos(parammodel);
                ViewBag.PageIndex = id;
                ViewBag.TotalPage = list.TotalCount % parammodel.PageSize != 0 ? list.TotalCount / parammodel.PageSize + 1 : parammodel.PageSize;
                return list;
            }

  • 相关阅读:
    rz/sz yum install
    MyEclipse使用总结——MyEclipse10安装SVN插件
    报错:1130-host ... is not allowed to connect to this MySql server
    linux(centos)搭建svn
    eclipse Ctrl +左键查看源代码Source not found
    win7环境下配置Java环境
    运行phpize失败排查
    lamp环境centos5.10,phpprotobuf模块安装,及简单应用
    阿里云服务器centos5.10安装lamp环境
    php 面向对象知识点
  • 原文地址:https://www.cnblogs.com/jcy1/p/9524113.html
Copyright © 2011-2022 走看看