| | |
| | | { |
| | | return MonitorPointGroupCacheHelper.GetSet(projectId, () => |
| | | { |
| | | var entities = _dal.QueryAll(projectId); |
| | | var entities = _dal.GetAll(projectId); |
| | | var models = Entity2Models(entities); |
| | | if (models == null) |
| | | { |
| | |
| | | //根据 Id 更新缓存 |
| | | private void UpdateProjectCache(long projectId, long Id) |
| | | { |
| | | var entity_ds = _dal.QueryById(projectId, Id); |
| | | var entity_ds = _dal.GetById(projectId, Id); |
| | | var model_ds = Entity2Model(entity_ds); |
| | | var all = GetProjectCache(projectId); |
| | | var model = all.Find(x => x.Id == Id); |
| | |
| | | { |
| | | if (Ids == null || Ids.Count() < 1) |
| | | return; |
| | | var entities = _dal.QueryByIds(projectId, Ids); |
| | | var entities = _dal.GetByIds(projectId, Ids); |
| | | var models = Entity2Models(entities); |
| | | var all = GetProjectCache(projectId); |
| | | all.RemoveAll(x => Ids.Contains(x.Id)); |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region Query |
| | | #region Get |
| | | |
| | | /// <summary> |
| | | /// 查询全部 |
| | | /// </summary> |
| | | public List<Model.MonitorPointGroup> QueryAll(long projectId) |
| | | public List<Model.MonitorPointGroup> GetAll(long projectId) |
| | | { |
| | | var all = GetProjectCache(projectId); |
| | | return all.OrderBy(x => x.SortCode).ToList(); |
| | |
| | | /// <summary> |
| | | /// 根据 Id查询 |
| | | /// </summary> |
| | | public Model.MonitorPointGroup QueryById(long projectId, long Id) |
| | | public Model.MonitorPointGroup GetById(long projectId, long Id) |
| | | { |
| | | var all = QueryAll(projectId); |
| | | var all = GetAll(projectId); |
| | | return all.Find(x => x.Id == Id); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据 Ids 查询 |
| | | /// </summary> |
| | | public List<Model.MonitorPointGroup> QueryByIds(long projectId, IEnumerable<long> Ids) |
| | | public List<Model.MonitorPointGroup> GetByIds(long projectId, IEnumerable<long> Ids) |
| | | { |
| | | if (Ids == null || Ids.Count() < 1) |
| | | return default; |
| | | var all = QueryAll(projectId); |
| | | var all = GetAll(projectId); |
| | | return all.Where(x => Ids.Contains(x.Id)).ToList(); |
| | | } |
| | | |
| | |
| | | /// <summary> |
| | | /// 根据 BelongType BelongId 查询 |
| | | /// </summary> |
| | | public List<Model.MonitorPointGroup> QueryByBelongTypeAndBelongId(long projectId, string belongType, long belongId) |
| | | public List<Model.MonitorPointGroup> GetByBelongTypeAndBelongId(long projectId, string belongType, long belongId) |
| | | { |
| | | var all = QueryAll(projectId); |
| | | var all = GetAll(projectId); |
| | | return all.Where(x => x.BelongType == belongType && x.BelongId == belongId).ToList(); |
| | | } |
| | | #endregion |
| | |
| | | /// </summary> |
| | | public bool IsExistById(long projectId, long Id) |
| | | { |
| | | var all = QueryAll(projectId); |
| | | var all = GetAll(projectId); |
| | | return all.Exists(x => x.Id == Id); |
| | | } |
| | | #endregion |