| | |
| | | using MathNet.Numerics.Distributions; |
| | | using System.Collections.Generic; |
| | | |
| | | namespace IStation.DAL |
| | | namespace IStation.DAL |
| | | { |
| | | /// <summary> |
| | | /// |
| | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 大批量插入 |
| | | /// </summary> |
| | | public bool BulkInserts(string runFlag, List<Entity.ScheduleConclusion> list) |
| | | { |
| | | if (list == null || list.Count < 1) |
| | | return default; |
| | | var tableName = GetTableName(runFlag); |
| | | using (SqlSugarClient db = Connection) |
| | | { |
| | | return db.Fastest<Entity.ScheduleConclusion>().AS(tableName).BulkCopy(list) > 0; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 大批量插入 |
| | | /// </summary> |
| | | public async Task<bool> BulkInserts_Create_Async(string runFlag, List<Entity.ScheduleConclusion> list) |
| | | { |
| | | if (list == null || list.Count < 1) |
| | | return default; |
| | | var tableName = GetTableName(runFlag); |
| | | using (SqlSugarClient db = Connection) |
| | | { |
| | | var exist_sql = $"select count(*) from sqlite_master where type = 'table' and name = '{tableName}' ;"; |
| | | if (db.Ado.GetInt(exist_sql) < 1) |
| | | { |
| | | var sql_create_table = $"CREATE TABLE {tableName} (\r\n ID BIGINT NOT NULL\r\n PRIMARY KEY,\r\n ScheduleCombineID BIGINT,\r\n RunFlag VARCHAR (255),\r\n Pump1 REAL,\r\n Pump2 REAL,\r\n Pump3 REAL,\r\n Head REAL,\r\n Flow REAL,\r\n Power REAL,\r\n WP REAL,\r\n UWP REAL\r\n);"; |
| | | if (db.Ado.ExecuteCommand(sql_create_table) < 1) |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | return await db.Fastest<Entity.ScheduleConclusion>().AS(tableName).BulkCopyAsync(list) > 0; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 大批量插入 |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 大批量插入 |
| | | /// </summary> |
| | | public bool BulkInserts_SplitTable_Create(string runFlag, List<Entity.ScheduleConclusion> list) |
| | | public bool BulkInserts_Create(string runFlag, List<Entity.ScheduleConclusion> list) |
| | | { |
| | | if (list == null || list.Count < 1) |
| | | return default; |
| | |
| | | if (db.Ado.GetInt(exist_sql) < 1) |
| | | { |
| | | var sql_create_table = $"CREATE TABLE {tableName} (\r\n ID BIGINT NOT NULL\r\n PRIMARY KEY,\r\n ScheduleCombineID BIGINT,\r\n RunFlag VARCHAR (255),\r\n Pump1 REAL,\r\n Pump2 REAL,\r\n Pump3 REAL,\r\n Head REAL,\r\n Flow REAL,\r\n Power REAL,\r\n WP REAL,\r\n UWP REAL\r\n);"; |
| | | if (db.Ado.ExecuteCommand(sql_create_table) < 1) |
| | | { |
| | | return false; |
| | | } |
| | | db.Ado.ExecuteCommand(sql_create_table); |
| | | } |
| | | //大数据写入 |
| | | return db.Fastest<Entity.ScheduleConclusion>().AS(tableName).BulkCopy(list) > 0; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 大批量插入 |
| | | /// </summary> |
| | | public bool BulkInserts(string runFlag, List<Entity.ScheduleConclusion> list) |
| | | { |
| | | if (list == null || list.Count < 1) |
| | | return default; |
| | | var tableName = GetTableName(runFlag); |
| | | using (SqlSugarClient db = Connection) |
| | | { |
| | | return db.Fastest<Entity.ScheduleConclusion>().AS(tableName).BulkCopy(list) > 0; |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |