protected int queryRowCount(ParamQuery param, dynamic rows) { if (rows != null) { if (null == param || param.GetData().PagingItemsPerPage == 0) { return(rows.Count); } } var RowCountParam = param; var sql = BuilderParse(RowCountParam.Paging(1, 0).OrderBy(string.Empty)).GetSql(); return(db.Sql(@"select count(*) from ( " + sql + " ) tb_temp").QuerySingle <int>()); }
//最大值加一 public static string maxplus(IDbContext db, string table, string field, ParamQuery pQuery) { //var where = pQuery.GetData().WhereSql; var sqlWhere = " where 1 = 1 "; if (pQuery != null) { sqlWhere += " and " + pQuery.GetData().WhereSql; } var dbkey = db.Sql(String.Format("select isnull(max({0}),0) from {1} {2}", field, table, sqlWhere)).QuerySingle <string>(); var cachedKeys = getCacheKey(table, field); var currentKey = maxOfAllKey(cachedKeys, ZConvert.ToString(dbkey)); var key = ZConvert.ToString(currentKey + 1); SetCacheKey(table, field, key); return(key); }