Пример #1
0
        /// <summary>
        /// 获取分页数据
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public async Task <JqGridModel <PlanModel> > GetList(PlanParam param)
        {
            string sql     = "select Plan.* {0} from Plan {1} where 1=1 {2} {3}";
            string orderBy = " ORDER BY Id ";

            string where = string.Empty;
            string join   = "";
            string select = "";

            //条件
            if (!string.IsNullOrEmpty(param.SearchKey))
            {
                where += string.Format(" and( Title like '%{0}%')", param.SearchKey);
            }
            //排序
            if (!string.IsNullOrEmpty(param.sidx) && !string.IsNullOrEmpty(param.sord))
            {
                orderBy = string.Format(" order by {0} {1} ", param.sidx, param.sord);
            }

            sql = string.Format(sql, select, join, where, orderBy);

            var list = await planRepository.FindListPager <PlanModel>(sql, param);

            return(list);
        }