| | |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 大批量插入 |
| | | /// </summary> |
| | | public bool BulkInserts_SplitTable_Create(string runFlag, List<Entity.ScheduleCombine> list) |
| | | public async Task<bool> BulkInserts_Create_Async(string runFlag, List<Entity.ScheduleCombine> 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 RunFlag VARCHAR (255),\r\n RunCount INTEGER,\r\n Pump1 REAL,\r\n Pump2 REAL,\r\n Pump3 REAL,\r\n CurveQH VARCHAR (255),\r\n CurveQP VARCHAR (255),\r\n AnaStatus BIT\r\n);"; |
| | | if (db.Ado.ExecuteCommand(sql_create_table) < 1) |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | return await db.Fastest<Entity.ScheduleCombine>().AS(tableName).BulkCopyAsync(list) > 0; |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 大批量插入 |
| | | /// </summary> |
| | | public bool BulkInserts_Create(string runFlag, List<Entity.ScheduleCombine> list) |
| | | { |
| | | if (list == null || list.Count < 1) |
| | | return default; |
| | |
| | | if (db.Ado.ExecuteCommand(exist_sql) < 1) |
| | | { |
| | | var sql_create_table = $"CREATE TABLE {tableName} (\r\n ID BIGINT NOT NULL\r\n PRIMARY KEY,\r\n RunFlag VARCHAR (255),\r\n RunCount INTEGER,\r\n Pump1 REAL,\r\n Pump2 REAL,\r\n Pump3 REAL,\r\n CurveQH VARCHAR (255),\r\n CurveQP VARCHAR (255),\r\n AnaStatus BIT\r\n);"; |
| | | if (db.Ado.ExecuteCommand(sql_create_table) < 1) |
| | | { |
| | | return false; |
| | | } |
| | | db.Ado.ExecuteCommand(sql_create_table); |
| | | } |
| | | //大数据写入 |
| | | return db.Fastest<Entity.ScheduleCombine>().AS(tableName).BulkCopy(list) > 0; |