|
|
@@ -1015,7 +1015,6 @@ namespace SiteCore
|
|
|
if (dStruct.isExport)
|
|
|
{
|
|
|
string where = CommonHelper.CombineWhere(dStruct.MainWhere, dStruct.SecondWhere);
|
|
|
- //string sql;
|
|
|
StringBuilder sql = new StringBuilder();
|
|
|
if (dStruct.PageSize != 100000)
|
|
|
{
|
|
|
@@ -1027,29 +1026,43 @@ namespace SiteCore
|
|
|
}
|
|
|
if (where.Length > 0) sql.AppendFormat(" where {0}", where);
|
|
|
if (dStruct.Order.Length > 0) sql.AppendFormat(" order by {0}", dStruct.Order);
|
|
|
- //if (where.Length > 0) sql = string.Format("select top {0} {1} from {2} where {3}", dStruct.PageSize, dStruct.Fileds, tableName, where);
|
|
|
- //else sql = string.Format("select top {0} {1} from {2} ", dStruct.PageSize, dStruct.Fileds, tableName);
|
|
|
DataTable dt = DbHelper.DbConn.ExecuteDataset(sql.ToString()).Tables[0];
|
|
|
return dt;
|
|
|
- /*int pageSize = 1000;
|
|
|
+ /*int pageSize = 0;
|
|
|
int pageIndex = 1;
|
|
|
DataTable dt = new DataTable();
|
|
|
- while (true)
|
|
|
+
|
|
|
+ StringBuilder sql = new StringBuilder();
|
|
|
+ sql.AppendFormat("SELECT tid FROM CE_ErpTrade WITH ( NOLOCK ) ");
|
|
|
+
|
|
|
+ if (where.Length > 0) sql.AppendFormat(" where {0}", where);
|
|
|
+
|
|
|
+ DataTable dt_tid = DbHelper.DbConn.ExecuteDataset(sql.ToString()).Tables[0];
|
|
|
+ List<string> tids = new List<string>();
|
|
|
+ foreach (DataRow item in dt_tid.Rows)
|
|
|
{
|
|
|
- StringBuilder sql = new StringBuilder();
|
|
|
- if (dStruct.PageSize != 100000)
|
|
|
- {
|
|
|
- sql.AppendFormat("select top {0} {1} from {2}", dStruct.PageSize, dStruct.Fileds, tableName);
|
|
|
- }
|
|
|
- else
|
|
|
+ tids.Add("'" + item["tid"] + "'");
|
|
|
+ if (pageSize == 1000)
|
|
|
{
|
|
|
- sql.AppendFormat("SELECT TOP {2} * FROM (SELECT row_number() OVER(ORDER BY ID) AS rownumber, {0} FROM {1} WITH(NOLOCK) ", dStruct.Fileds, tableName, pageSize);
|
|
|
- }
|
|
|
-
|
|
|
- if (where.Length > 0) sql.AppendFormat(" where {0}", where);
|
|
|
+ DataTable dt_temp = DbHelper.DbConn.ExecuteDataset(string.Format("select * from view_orderlist where tid in ({0})", string.Join(",", tids))).Tables[0];
|
|
|
+ if (pageIndex == 1)
|
|
|
+ {
|
|
|
+ dt = dt_temp.Clone();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ dt.Merge(dt_temp);
|
|
|
+ }
|
|
|
|
|
|
- sql.AppendFormat(" ) temp_row where rownumber > (({0} - 1) * {1}); ", pageIndex, pageSize);
|
|
|
- DataTable dt_temp = DbHelper.DbConn.ExecuteDataset(sql.ToString()).Tables[0];
|
|
|
+ pageIndex++;
|
|
|
+ pageSize = 0;
|
|
|
+ tids = new List<string>();
|
|
|
+ }
|
|
|
+ pageSize++;
|
|
|
+ }
|
|
|
+ if (tids.Count > 0)
|
|
|
+ {
|
|
|
+ DataTable dt_temp = DbHelper.DbConn.ExecuteDataset(string.Format("select * from view_orderlist where tid in ({0})", string.Join(",", tids))).Tables[0];
|
|
|
if (pageIndex == 1)
|
|
|
{
|
|
|
dt = dt_temp.Clone();
|
|
|
@@ -1058,19 +1071,14 @@ namespace SiteCore
|
|
|
{
|
|
|
dt.Merge(dt_temp);
|
|
|
}
|
|
|
- if (dt_temp.Rows.Count < pageSize)
|
|
|
- {
|
|
|
- break;
|
|
|
- }
|
|
|
- pageIndex++;
|
|
|
+ }*/
|
|
|
|
|
|
- }
|
|
|
|
|
|
//if (dStruct.Order.Length > 0) sql.AppendFormat(" order by {0}", dStruct.Order);
|
|
|
//if (where.Length > 0) sql = string.Format("select top {0} {1} from {2} where {3}", dStruct.PageSize, dStruct.Fileds, tableName, where);
|
|
|
//else sql = string.Format("select top {0} {1} from {2} ", dStruct.PageSize, dStruct.Fileds, tableName);
|
|
|
|
|
|
- return dt;*/
|
|
|
+ //return dt;
|
|
|
}
|
|
|
|
|
|
SqlParameter[] sqlParameter ={
|