using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PeterPage.Common;
using PeterPage.DAL.Pages;

namespace PeterPage.DAL
{
    public class UserList
    {
        #region 搜索列表

        /// <summary>
        /// 分页获取数据列表（用户信息表）
        /// </summary>
        public PeterPages GetSearch(Model.UserList UserList, int PageIndex, int PageSize)
        {
            PeterPages fy = null;
            string sqlwhere = " 1=1 ";

            /* 如果存在查询则可以如下去写
            if (!string.IsNullOrEmpty(UserList.userName))
            {
                sqlwhere = sqlwhere + " and userName like '%" + UserList.userName + "%' ";
            }
            if (UserList.userState != -1)
            {
                sqlwhere = sqlwhere + " and userState=" + UserList.userState + " ";
            }
             * */

            PageInfoNew entity = new PageInfoNew();
            entity.Sqlwhere = sqlwhere.Trim();
            entity.Tablename = "[UserList]";  //用户表，注意如果是多表可以写成视图进行查询，这里就为视图名称
            entity.PageSize = PageSize;
            entity.Fieldkey = "id";  //主键
            entity.Orderfield = " AddTime desc";  //排序字段
            entity.PageIndex = PageIndex;
            entity.Fields = "*";


            fy = SqlPageList.GetPageLists(entity);
            return fy;
        }
        #endregion
    }
}
