| | |
| | | public class MonitorDataSetSummaryHelper |
| | | { |
| | | |
| | | #region Query |
| | | #region Get |
| | | |
| | | /// <summary> |
| | | /// 查询全部 |
| | | /// </summary> |
| | | public static List<Model.MonitorDataSetSummary> QueryAll(string path) |
| | | public static List<Model.MonitorDataSetSummary> GetAll(string path) |
| | | { |
| | | if (string.IsNullOrEmpty(path)) |
| | | return default; |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据Id查询 |
| | | /// 根据 Id查询 |
| | | /// </summary> |
| | | public static Model.MonitorDataSetSummary QueryById(string path, long Id) |
| | | public static Model.MonitorDataSetSummary GetById(string path, long Id) |
| | | { |
| | | var list = QueryAll(path); |
| | | var list = GetAll(path); |
| | | if (list == null || list.Count < 1) |
| | | return default; |
| | | return list.Find(t => t.Id == Id); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据Id集合查询 |
| | | /// 根据 Id集合查询 |
| | | /// </summary> |
| | | public static IEnumerable<Model.MonitorDataSetSummary> QueryByIds(string path, IEnumerable<long> Ids) |
| | | public static IEnumerable<Model.MonitorDataSetSummary> GetByIds(string path, IEnumerable<long> Ids) |
| | | { |
| | | if (Ids == null || Ids.Count() < 1) |
| | | return default; |
| | | var list = QueryAll(path); |
| | | var list = GetAll(path); |
| | | return list?.Where(x => Ids.Contains(x.Id)); |
| | | } |
| | | |
| | |
| | | |
| | | #region Delete |
| | | /// <summary> |
| | | /// 根据Id删除 |
| | | /// 根据 Id删除 |
| | | /// </summary> |
| | | public static bool DeleteById(string path, long Id) |
| | | { |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据Id集合删除 |
| | | /// 根据 Id集合删除 |
| | | /// </summary> |
| | | public static bool DeleteByIds(string path, IEnumerable<long> Ids) |
| | | { |
| | |
| | | var fileName = FileHelper.GetFilePath<Model.MonitorDataSetSummary>(path); |
| | | if (!File.Exists(fileName)) |
| | | return false; |
| | | var all = QueryAll(path); |
| | | var all = GetAll(path); |
| | | if (all == null || all.Count < 1) |
| | | return false; |
| | | return true; |