/// <summary> /// 异步获取列表 /// </summary> /// <typeparam name="TReturn"></typeparam> /// <param name="connection"></param> /// <param name="selectPreSql"></param> /// <param name="criteria"></param> /// <returns></returns> public static async Task <IEnumerable <TReturn> > GetListAsync <TReturn>(this IDbConnection connection, string selectPreSql, ICriteria criteria) { string strSql = criteria.FormatSql(selectPreSql); return(await connection.QueryAsync <TReturn>(strSql, criteria.GetSafeParameters())); }
/// <summary> /// 异步获取分页数据 /// </summary> /// <typeparam name="TReturn">结果集数据类型/实体</typeparam> /// <param name="connection">数据库连接</param> /// <param name="pageIndex">分页索引</param> /// <param name="pageSize">分页大小</param> /// <param name="selectPreSql">查询语句(前部分,不带参数)</param> /// <param name="criteria">附加条件</param> /// <returns></returns> public static async Task <PagerData <TReturn> > GetPagerDataAsync <TReturn>(this IDbConnection connection, int pageIndex, int pageSize, string selectPreSql, ICriteria criteria) { string strSql = criteria.FormatSql(selectPreSql); return(await connection.GetPagerDataAsync <TReturn>(pageIndex, pageSize, strSql, criteria.GetSafeParameters())); }