Beispiel #1
0
        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="search">查询实体</param>
        /// <returns></returns>
        public Page <ComApiAccountEntity> GetSearchResult(ComApiAccountEntity search)
        {
            var sbWhere = new StringBuilder();
            var args    = new List <object>();

            sbWhere.Append(Database.GetFormatSql <ComApiAccountEntity>("Where {0}=1 ", u => u.ROWSTATUS));
            if (!string.IsNullOrEmpty(search.ACCOUNTNAME))
            {
                sbWhere.Append(Database.GetFormatSql <ComApiAccountEntity>(" and {0} LIKE '%'+@p1+'%'",
                                                                           t => t.ACCOUNTNAME));
                args.Add(new { p1 = search.ACCOUNTNAME });
            }
            //排序
            sbWhere.Append(Database.GetFormatSql <ComApiAccountEntity>(" order by  {0} desc", t => t.ID));
            WriteDatabase.Comment = new StringExtension.SqlComment
            {
                Author   = "",
                FileName = "ComApiAccountDal.cs",
                ForUse   = "查询",
                FunName  = "GetSearchResult"
            };
            return(WriteDatabase.Page <ComApiAccountEntity>(search.page.CurrentPage, search.page.PageSize,
                                                            sbWhere.ToString(),
                                                            args.ToArray()));
        }
        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="search">查询实体</param>
        /// <returns></returns>
        public Page <ComVersionManagementEntity> GetSearchResult(ComVersionManagementEntity search)
        {
            var args    = new List <object>();
            var sbWhere = new StringBuilder();

            sbWhere.AppendFormat(" Where RowStatus=1 ");
            if (search.MobileType > 0)
            {
                sbWhere.Append(Database.GetFormatSql <ComVersionManagementEntity>(" and {0}=@MobileType ",
                                                                                  t => t.MobileType));
                args.Add(new { MobileType = search.MobileType });
            }
            //排序
            sbWhere.AppendFormat(" order by Id desc");
            WriteDatabase.Comment = new StringExtension.SqlComment
            {
                Author   = "",
                FileName = "ComVersionManagementDal.cs",
                ForUse   = "查询",
                FunName  = "GetSearchResult"
            };
            return(WriteDatabase.Page <ComVersionManagementEntity>(search.page.CurrentPage, search.page.PageSize,
                                                                   sbWhere.ToString(),
                                                                   args.ToArray()));
        }
Beispiel #3
0
        /// <summary>
        /// 公文管理表
        /// 分页查询
        /// add by lpl
        /// 2019-1-2
        /// 效率为什么这么慢???
        /// </summary>
        /// <param name="page"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public Page <GongGaoMangerEntity> Query(long page, long pageSize)
        {
            try
            {
                var args   = new List <object>();
                var strSql = new StringBuilder();
                strSql.Append(Database.GetFormatSql <GongGaoMangerEntity>(" Where {0} = @p1", t => t.RowStatus));
                args.Add(new { p1 = 1 });

                return(WriteDatabase.Page <GongGaoMangerEntity>(page, pageSize, strSql.ToString(), args.ToArray()));
            }
            catch (Exception e)
            {
                throw e;
            }
        }