public long GetListCount(List <DataFilter> filters) { var strFilter = HqlstrByExtFilter.GetHqlstrByExtFilter(filters, "o"); var query = _Session.CreateQuery(@"select count(o) from WxAccount as o" + (string.IsNullOrEmpty(strFilter) ? string.Empty : " where " + strFilter)) .UniqueResult <long>(); return(query); }
public IList <WxAccount> GetPageList(int page, int rows, string sort, string order, List <DataFilter> filters, string recordTime, out long total) { var strFilter = HqlstrByExtFilter.GetHqlstrByExtFilter(filters, "o"); var query = _Session.CreateQuery(@"select o from WxAccount as o" + " where o.CreateTime<='" + recordTime + "'" + (string.IsNullOrEmpty(strFilter) ? string.Empty : " and " + strFilter) + " order by o." + sort + " " + order) .SetFirstResult(page) .SetMaxResults(rows); total = _Session.CreateQuery(@"select count(o) from WxAccount as o" + " where o.CreateTime<='" + recordTime + "'" + (string.IsNullOrEmpty(strFilter) ? string.Empty : " and " + strFilter)) .UniqueResult <long>(); return(query.List <WxAccount>()); }