namespace IStation.DAL.PostgreSql { /// /// /// public partial class ScheduleScada : IScheduleScada { /// /// /// public ConnectionConfig ConnectionConfig { get { return ConfigHelper.PostgreSqlConnectionConfig; } } /// /// 批量插入 /// public bool Inserts(List list) { if (list == null || list.Count < 1) { return false; } using (SqlSugarClient sqlSugarClient = new SqlSugarClient(ConnectionConfig)) { return sqlSugarClient.Insertable(list).ExecuteCommand() > 0; } } /// /// 大批量插入 /// public bool BulkInserts(List list) { if (list == null || list.Count < 1) { return false; } using (SqlSugarClient sqlSugarClient = new SqlSugarClient(ConnectionConfig)) { return sqlSugarClient.Fastest().BulkCopy(list) > 0; } } /// /// 删除全部 /// public bool DeleteAll() { using (SqlSugarClient sqlSugarClient = new SqlSugarClient(ConnectionConfig)) { return sqlSugarClient.DbMaintenance.TruncateTable(); } } /// /// 查询全部 /// /// public List GetAll() { using (SqlSugarClient sqlSugarClient = new SqlSugarClient(ConnectionConfig)) { return sqlSugarClient.Queryable().ToList(); } } /// /// 根据时间查询 /// /// public List GetByDate(DateTime start, DateTime end) { using (SqlSugarClient sqlSugarClient = new SqlSugarClient(ConnectionConfig)) { return sqlSugarClient.Queryable().Where(x => x.Time >= start && x.Time <= end).ToList(); } } } }