Commit a0f0d78d by 泽锋 李

fix

parent 9a900beb
......@@ -389,7 +389,7 @@ namespace AutoTurnOver.DB
Console.WriteLine($" 开始写入第 {page} 页数据 , 预计 写入 {addList.Count} 条 , 更新 {updateList.Count} 条, 最大id {updateList.Max(s=>s.item_no)}, 最小id {updateList.Min(s => s.item_no)} ");
if (addList != null && addList.Count >= 1)
{
conn.BatchInsert(addList, "dc_report_cash_flow_log");
BatchInsertDatas(conn,addList);
}
if (updateList != null && updateList.Count >= 1)
{
......@@ -414,7 +414,21 @@ namespace AutoTurnOver.DB
watch.Start();//开始计时
var res = conn.Execute(sql, datas);
Console.WriteLine($" 更新 {datas.Count} 条数据,耗时 {watch.ElapsedMilliseconds} 毫秒 ");
}
public static void BatchInsertDatas(MySqlConnection conn, List<dc_report_cash_flow_log> datas)
{
System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
watch.Start();//开始计时
StringBuilder sqlSb = new StringBuilder(@" insert into dc_report_cash_flow_log(`warehouse_code`,`platform_type`,`bailun_sku`,`data_type`,`pay_type`,`val`,`occur_time`,`pay_time`,`no`,`item`,`item_no`,`remarks`,`is_delete`,`update_time`,`occur_time_year_month_no`,`pay_time_year_month_no`) value ");
foreach (var item in datas)
{
sqlSb.Append($"( '{item.warehouse_code}','{item.platform_type}','{item.bailun_sku}',{item.data_type},{item.pay_type},{item.val},'{item.occur_time}','{item.pay_time}','{item.no}','{item.item}','{item.item_no}','{item.remarks}',{(item.is_delete)},'{item.update_time}','{item.occur_time_year_month_no}','{item.pay_time_year_month_no}' ),");
}
var sql = sqlSb.ToString();
sql = sql.Substring(0, sql.Length-1);
var res = conn.Execute(sql.ToString());
Console.WriteLine($" 新增 {datas.Count} 条数据,耗时 {watch.ElapsedMilliseconds} 毫秒 ");
}
/// <summary>
......@@ -517,7 +531,7 @@ namespace AutoTurnOver.DB
if (addList != null && addList.Count >= 1)
{
conn.BatchInsert(addList, "dc_report_cash_flow_log");
BatchInsertDatas(conn, addList);
}
if (updateList != null && updateList.Count >= 1)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment