| | |
| | | |
| | | #endregion |
| | | |
| | | #region Query |
| | | #region Get |
| | | |
| | | /// <summary> |
| | | /// 查询全部 |
| | | /// </summary> |
| | | public List<Entity.MonitorPointMapping> QueryAll(long projectId) |
| | | public List<Entity.MonitorPointMapping> GetAll(long projectId) |
| | | { |
| | | if (projectId < 1) |
| | | return default; |
| | | var path = GetFolderPath(projectId); |
| | | var all = FileIdHelper<Entity.MonitorPointMapping>.QueryAll(path); |
| | | var all = FileIdHelper<Entity.MonitorPointMapping>.GetAll(path); |
| | | var entities = all?.OrderBy(x => x.SortCode).ToList(); |
| | | return entities; |
| | | } |
| | |
| | | /// <summary> |
| | | /// 根据 Id查询 |
| | | /// </summary> |
| | | public Entity.MonitorPointMapping QueryById(long projectId, long Id) |
| | | public Entity.MonitorPointMapping GetById(long projectId, long Id) |
| | | { |
| | | if (projectId < 1) |
| | | return default; |
| | | if (Id < 0) |
| | | return default; |
| | | var all = QueryAll(projectId); |
| | | var all = GetAll(projectId); |
| | | var entities = all?.ToList(); |
| | | return entities?.Find(t => t.Id == Id); |
| | | } |
| | |
| | | /// <summary> |
| | | /// 根据 Id集合查询 |
| | | /// </summary> |
| | | public List<Entity.MonitorPointMapping> QueryByIds(long projectId, IEnumerable<long> Ids) |
| | | public List<Entity.MonitorPointMapping> GetByIds(long projectId, IEnumerable<long> Ids) |
| | | { |
| | | if (projectId < 1) |
| | | return default; |
| | | if (Ids == null || Ids.Count() < 1) |
| | | return default; |
| | | var all = QueryAll(projectId); |
| | | var all = GetAll(projectId); |
| | | var entities = all?.Where(x => Ids.Contains(x.Id)).ToList(); |
| | | return entities; |
| | | } |
| | |
| | | /// <summary> |
| | | /// 根据 MonitorPointId 查询 |
| | | /// </summary> |
| | | public List<Entity.MonitorPointMapping> QueryByMonitorPointId(long projectId, long monitorPointId) |
| | | public List<Entity.MonitorPointMapping> GetByMonitorPointId(long projectId, long monitorPointId) |
| | | { |
| | | if (projectId < 1) |
| | | return default; |
| | | if (monitorPointId < 0) |
| | | return default; |
| | | var all = QueryAll(projectId); |
| | | var all = GetAll(projectId); |
| | | var entities = all?.Where(x => x.MonitorPointId == monitorPointId).ToList(); |
| | | return entities; |
| | | } |
| | |
| | | /// <summary> |
| | | ///根据 ObjectType 和 ObjectId 查询 |
| | | /// </summary> |
| | | public List<Entity.MonitorPointMapping> QueryByObjectTypeAndObjectId(long projectId, string objectType, long objectId) |
| | | public List<Entity.MonitorPointMapping> GetByObjectTypeAndObjectId(long projectId, string objectType, long objectId) |
| | | { |
| | | if (projectId < 1) |
| | | return default; |
| | | if (objectId < 0) |
| | | return default; |
| | | var all = QueryAll(projectId); |
| | | var all = GetAll(projectId); |
| | | var entities = all?.Where(x => x.ObjectType == objectType && x.ObjectId == objectId).ToList(); |
| | | return entities; |
| | | } |
| | |
| | | return default; |
| | | if (objectIds == null || objectIds.Count() < 1) |
| | | return default; |
| | | var all = QueryAll(projectId); |
| | | var all = GetAll(projectId); |
| | | var entities = all?.Where(x => x.ObjectType == objectType && objectIds.Contains(x.ObjectId)).ToList(); |
| | | return entities; |
| | | } |
| | |
| | | { |
| | | return DeleteByObjectTypeAndObjectId(projectId, objectType, objectId); |
| | | } |
| | | var all = QueryAll(projectId); |
| | | var all = GetAll(projectId); |
| | | if (all == null) |
| | | all = new List<Entity.MonitorPointMapping>(); |
| | | all.RemoveAll(x => x.ObjectType == objectType && x.ObjectId == objectId); |
| | |
| | | if (monitorPointId < 0) |
| | | return default; |
| | | var path = GetFolderPath(projectId); |
| | | var list = QueryByMonitorPointId(projectId, monitorPointId); |
| | | var list = GetByMonitorPointId(projectId, monitorPointId); |
| | | if (list != null && list.Count > 0) |
| | | { |
| | | var Ids = list.Select(x => x.Id); |
| | |
| | | if (objectId < 0) |
| | | return default; |
| | | var path = GetFolderPath(projectId); |
| | | var list = QueryByObjectTypeAndObjectId(projectId, objectType, objectId); |
| | | var list = GetByObjectTypeAndObjectId(projectId, objectType, objectId); |
| | | if (list != null && list.Count > 0) |
| | | { |
| | | var Ids = list.Select(x => x.Id); |