From 7dd4262d2fb1450d171a133b56186d9f4fa5847b Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期四, 12 十二月 2024 18:52:30 +0800 Subject: [PATCH] 冷却塔 --- Service/HStation.Service.Assets.Core/05-service/21-cooling/03-factor/Cache/AssetsCoolingFactorCacheHelper.cs | 71 + Service/HStation.Service.Assets.Core/02-model/22-cooling/AssetsCoolingFactor.cs | 94 ++ Service/HStation.Service.Assets.Core/05-service/21-cooling/02-main/AssetsCoolingMain_Instance.cs | 73 + Service/HStation.Service.Assets.Core/05-service/21-cooling/01-series/AssetsCoolingSeries_Instance.cs | 73 + Service/HStation.Service.Assets.Core/04-dal/01-interface/21-cooling/IAssetsCoolingFactor.cs | 11 Service/HStation.Service.Assets.Core/04-dal/01-interface/21-cooling/IAssetsCoolingSeries.cs | 11 Service/HStation.Service.Assets.Core/04-dal/01-interface/21-cooling/IAssetsCoolingMain.cs | 15 Service/HStation.Service.Assets.Core/05-service/21-cooling/01-series/Cache/AssetsCoolingSeriesCacheHelper.cs | 71 + Service/HStation.Service.Assets.Core/02-model/22-cooling/AssetsCoolingSeries.cs | 92 ++ Service/HStation.Service.Assets.Core/05-service/21-cooling/01-series/AssetsCoolingSeries.cs | 493 ++++++++++++ Service/HStation.Service.Assets.Core/02-model/22-cooling/AssetsCoolingMain.cs | 130 +++ Service/HStation.Service.Assets.Core/05-service/21-cooling/02-main/AssetsCoolingMain.cs | 398 ++++++++++ Service/HStation.Service.Assets.Core/01-entity/21-cooling/AssetsCoolingSeries.cs | 85 ++ Service/HStation.Service.Assets.Core/01-entity/21-cooling/AssetsCoolingFactor.cs | 80 ++ Service/HStation.Service.Assets.Core/05-service/21-cooling/03-factor/AssetsCoolingFactor_Instance.cs | 59 + Service/HStation.Service.Assets.Core/05-service/21-cooling/02-main/Cache/AssetsCoolingMainCacheHelper.cs | 71 + Service/HStation.Service.Assets.Core/05-service/21-cooling/03-factor/AssetsCoolingFactor.cs | 275 +++++++ Service/HStation.Service.Assets.Core/05-service/00-core/03-helper/KeyWordHelper.cs | 36 Service/HStation.Service.Assets.Core/01-entity/21-cooling/AssetsCoolingMain.cs | 118 +++ 19 files changed, 2,244 insertions(+), 12 deletions(-) diff --git a/Service/HStation.Service.Assets.Core/01-entity/21-cooling/AssetsCoolingFactor.cs b/Service/HStation.Service.Assets.Core/01-entity/21-cooling/AssetsCoolingFactor.cs new file mode 100644 index 0000000..834f3a6 --- /dev/null +++ b/Service/HStation.Service.Assets.Core/01-entity/21-cooling/AssetsCoolingFactor.cs @@ -0,0 +1,80 @@ +锘縰sing Yw.Entity; + +namespace HStation.Entity +{ + /// <summary> + /// 鍐峰嵈濉旂郴鏁� + /// </summary> + [SysType("assets_cooling_factor")] + [SugarTable("assets_cooling_factor")] + public class AssetsCoolingFactor : BaseEntity, ISorter, System.ICloneable + { + /// <summary> + /// + /// </summary> + public AssetsCoolingFactor() { } + + public AssetsCoolingFactor(AssetsCoolingFactor rhs) : base(rhs) + { + this.Name = rhs.Name; + this.Material = rhs.Material; + this.Caliber = rhs.Caliber; + this.Coefficient = rhs.Coefficient; + this.LowerLimit = rhs.LowerLimit; + this.SortCode = rhs.SortCode; + this.Description = rhs.Description; + } + + /// <summary> + /// 鍚嶇О + /// </summary> + [SugarColumn(Length = 50, IsNullable = true)] + public string Name { get; set; } + + /// <summary> + /// 鏉愭枡 + /// </summary> + [SugarColumn(Length = 100, IsNullable = true)] + public string Material { get; set; } + + /// <summary> + /// 鍙e緞 + /// </summary> + public double? Caliber { get; set; } + + /// <summary> + /// 鍠峰皠绯绘暟 + /// </summary> + public double Coefficient { get; set; } + + /// <summary> + /// 鏈�灏忓帇鍔� m + /// </summary> + public double LowerLimit { get; set; } + + /// <summary> + /// 鎺掑簭鐮� + /// </summary> + public int SortCode { get; set; } + + /// <summary> + /// 璇存槑 + /// </summary> + [SugarColumn(ColumnDataType = StaticConfig.CodeFirst_BigString, IsNullable = true)] + public string Description { get; set; } + + /// <summary> + /// + /// </summary> + public AssetsCoolingFactor Clone() + { + return (AssetsCoolingFactor)this.MemberwiseClone(); + } + + object ICloneable.Clone() + { + return this.MemberwiseClone(); + } + + } +} \ No newline at end of file diff --git a/Service/HStation.Service.Assets.Core/01-entity/21-cooling/AssetsCoolingMain.cs b/Service/HStation.Service.Assets.Core/01-entity/21-cooling/AssetsCoolingMain.cs new file mode 100644 index 0000000..3d7969e --- /dev/null +++ b/Service/HStation.Service.Assets.Core/01-entity/21-cooling/AssetsCoolingMain.cs @@ -0,0 +1,118 @@ +锘縰sing Yw.Entity; + +namespace HStation.Entity +{ + /// <summary> + /// 鍐峰嵈濉斿瀷鍙� + /// </summary> + [SysType("assets_cooling_main")] + [SugarTable("assets_cooling_main")] + public class AssetsCoolingMain : BaseEntity, IParas, IFlags, ITagName, ISorter, System.ICloneable + { + /// <summary> + /// + /// </summary> + public AssetsCoolingMain() { } + + /// <summary> + /// + /// </summary> + public AssetsCoolingMain(AssetsCoolingMain rhs) : base(rhs) + { + this.SeriesID = rhs.SeriesID; + this.Name = rhs.Name; + this.Material = rhs.Material; + this.Caliber = rhs.Caliber; + this.Coefficient = rhs.Coefficient; + this.LowerLimit = rhs.LowerLimit; + this.KeyWords = rhs.KeyWords; + this.Paras = rhs.Paras; + this.Flags = rhs.Flags; + this.TagName = rhs.TagName; + this.SortCode = rhs.SortCode; + this.Description = rhs.Description; + } + + /// <summary> + /// 绯诲垪id + /// </summary> + public long SeriesID { get; set; } + + /// <summary> + /// 鍚嶇О + /// </summary> + [SugarColumn(Length = 50, IsNullable = true)] + public string Name { get; set; } + + /// <summary> + /// 鏉愭枡 + /// </summary> + [SugarColumn(Length = 100, IsNullable = true)] + public string Material { get; set; } + + /// <summary> + /// 鍙e緞 mm + /// </summary> + public double? Caliber { get; set; } + + /// <summary> + /// 鍠峰皠绯绘暟 + /// </summary> + public double Coefficient { get; set; } + + /// <summary> + /// 鏈�灏忓帇鍔� m + /// </summary> + public double LowerLimit { get; set; } + + /// <summary> + /// 鍏抽敭瀛� + /// </summary> + [SugarColumn(ColumnDataType = StaticConfig.CodeFirst_BigString, IsNullable = true)] + public string KeyWords { get; set; } + + /// <summary> + /// 鍙傛暟 + /// </summary> + [SugarColumn(ColumnDataType = StaticConfig.CodeFirst_BigString, IsNullable = true)] + public string Paras { get; set; } + + /// <summary> + /// 鏍囩 + /// </summary> + [SugarColumn(ColumnDataType = StaticConfig.CodeFirst_BigString, IsNullable = true)] + public string Flags { get; set; } + + /// <summary> + /// 鏍囧織 + /// </summary> + [SugarColumn(Length = 500, IsNullable = true)] + public string TagName { get; set; } + + /// <summary> + /// 鎺掑簭鐮� + /// </summary> + public int SortCode { get; set; } + + /// <summary> + /// 璇存槑 + /// </summary> + [SugarColumn(ColumnDataType = StaticConfig.CodeFirst_BigString, IsNullable = true)] + public string Description { get; set; } + + /// <summary> + /// + /// </summary> + public AssetsCoolingMain Clone() + { + return (AssetsCoolingMain)this.MemberwiseClone(); + } + + object ICloneable.Clone() + { + return this.MemberwiseClone(); + } + + + } +} \ No newline at end of file diff --git a/Service/HStation.Service.Assets.Core/01-entity/21-cooling/AssetsCoolingSeries.cs b/Service/HStation.Service.Assets.Core/01-entity/21-cooling/AssetsCoolingSeries.cs new file mode 100644 index 0000000..875bd21 --- /dev/null +++ b/Service/HStation.Service.Assets.Core/01-entity/21-cooling/AssetsCoolingSeries.cs @@ -0,0 +1,85 @@ +锘縰sing Yw.Entity; + +namespace HStation.Entity +{ + /// <summary> + /// 鍐峰嵈濉旂郴鍒� + /// </summary> + [SysType("assets_cooling_series")] + [SugarTable("assets_cooling_series")] + public class AssetsCoolingSeries : BaseEntity, IParas, IFlags, ITagName, ITreeSorter, System.ICloneable + { + /// <summary> + /// + /// </summary> + public AssetsCoolingSeries() { } + + /// <summary> + /// + /// </summary> + public AssetsCoolingSeries(AssetsCoolingSeries rhs) : base(rhs) + { + this.ParentIds = rhs.ParentIds; + this.Name = rhs.Name; + this.Paras = rhs.Paras; + this.Flags = rhs.Flags; + this.TagName = rhs.TagName; + this.SortCode = rhs.SortCode; + this.Description = rhs.Description; + } + + /// <summary> + /// 鐖剁骇id鍒楄〃 + /// </summary> + [SugarColumn(ColumnDataType = StaticConfig.CodeFirst_BigString, IsNullable = true)] + public string ParentIds { get; set; } + + /// <summary> + /// 鍚嶇О + /// </summary> + [SugarColumn(Length = 50, IsNullable = true)] + public string Name { get; set; } + + /// <summary> + /// 鍙傛暟 + /// </summary> + [SugarColumn(ColumnDataType = StaticConfig.CodeFirst_BigString, IsNullable = true)] + public string Paras { get; set; } + + /// <summary> + /// 鏍囩 + /// </summary> + [SugarColumn(ColumnDataType = StaticConfig.CodeFirst_BigString, IsNullable = true)] + public string Flags { get; set; } + + /// <summary> + /// 鏍囧織 + /// </summary> + [SugarColumn(Length = 500, IsNullable = true)] + public string TagName { get; set; } + + /// <summary> + /// 鎺掑簭鐮� + /// </summary> + public int SortCode { get; set; } + + /// <summary> + /// 璇存槑 + /// </summary> + [SugarColumn(ColumnDataType = StaticConfig.CodeFirst_BigString, IsNullable = true)] + public string Description { get; set; } + + /// <summary> + /// + /// </summary> + public AssetsCoolingSeries Clone() + { + return (AssetsCoolingSeries)this.MemberwiseClone(); + } + + object ICloneable.Clone() + { + return this.MemberwiseClone(); + } + } +} \ No newline at end of file diff --git a/Service/HStation.Service.Assets.Core/02-model/22-cooling/AssetsCoolingFactor.cs b/Service/HStation.Service.Assets.Core/02-model/22-cooling/AssetsCoolingFactor.cs new file mode 100644 index 0000000..62eba42 --- /dev/null +++ b/Service/HStation.Service.Assets.Core/02-model/22-cooling/AssetsCoolingFactor.cs @@ -0,0 +1,94 @@ +锘縰sing Yw.Model; + +namespace HStation.Model +{ + /// <summary> + /// 鍐峰嵈濉旂郴鏁� + /// </summary> + public class AssetsCoolingFactor : BaseModel, ISorter, System.ICloneable + { + /// <summary> + /// + /// </summary> + public AssetsCoolingFactor() { } + + /// <summary> + /// + /// </summary> + public AssetsCoolingFactor(AssetsCoolingFactor rhs) : base(rhs) + { + this.Name = rhs.Name; + this.Material = rhs.Material; + this.Caliber = rhs.Caliber; + this.Coefficient = rhs.Coefficient; + this.LowerLimit = rhs.LowerLimit; + this.SortCode = rhs.SortCode; + this.Description = rhs.Description; + } + + + /// <summary> + /// + /// </summary> + public void Reset(AssetsCoolingFactor rhs) + { + this.ID = rhs.ID; + this.Name = rhs.Name; + this.Material = rhs.Material; + this.Caliber = rhs.Caliber; + this.Coefficient = rhs.Coefficient; + this.LowerLimit = rhs.LowerLimit; + this.SortCode = rhs.SortCode; + this.Description = rhs.Description; + } + + /// <summary> + /// 鍚嶇О + /// </summary> + public string Name { get; set; } + + /// <summary> + /// 鏉愭枡 + /// </summary> + public string Material { get; set; } + + /// <summary> + /// 鍙e緞 + /// </summary> + public double? Caliber { get; set; } + + /// <summary> + /// 鍠峰皠绯绘暟 + /// </summary> + public double Coefficient { get; set; } + + /// <summary> + /// 鏈�灏忓帇鍔� m + /// </summary> + public double LowerLimit { get; set; } + + /// <summary> + /// 鎺掑簭鐮� + /// </summary> + public int SortCode { get; set; } + + /// <summary> + /// 璇存槑 + /// </summary> + public string Description { get; set; } + + /// <summary> + /// + /// </summary> + public AssetsCoolingFactor Clone() + { + return new AssetsCoolingFactor(this); + } + + object ICloneable.Clone() + { + return this.Clone(); + } + + } +} \ No newline at end of file diff --git a/Service/HStation.Service.Assets.Core/02-model/22-cooling/AssetsCoolingMain.cs b/Service/HStation.Service.Assets.Core/02-model/22-cooling/AssetsCoolingMain.cs new file mode 100644 index 0000000..ffc57e5 --- /dev/null +++ b/Service/HStation.Service.Assets.Core/02-model/22-cooling/AssetsCoolingMain.cs @@ -0,0 +1,130 @@ +锘縰sing Yw.Model; + +namespace HStation.Model +{ + /// <summary> + /// 鍐峰嵈濉斿瀷鍙� + /// </summary> + public class AssetsCoolingMain : BaseModel, IParas, IFlags, ITagName, ISorter, System.ICloneable + { + /// <summary> + /// + /// </summary> + public AssetsCoolingMain() { } + + /// <summary> + /// + /// </summary> + public AssetsCoolingMain(AssetsCoolingMain rhs) : base(rhs) + { + this.SeriesID = rhs.SeriesID; + this.Name = rhs.Name; + this.Material = rhs.Material; + this.Caliber = rhs.Caliber; + this.Coefficient = rhs.Coefficient; + this.LowerLimit = rhs.LowerLimit; + this.KeyWords = rhs.KeyWords?.ToList(); + this.Paras = rhs.Paras == null ? null : new Dictionary<string, string>(rhs.Paras); + this.Flags = rhs.Flags?.ToList(); + this.TagName = rhs.TagName; + this.SortCode = rhs.SortCode; + this.Description = rhs.Description; + } + + /// <summary> + /// + /// </summary> + public void Reset(AssetsCoolingMain rhs) + { + this.ID = rhs.ID; + this.SeriesID = rhs.SeriesID; + this.Name = rhs.Name; + this.Material = rhs.Material; + this.Caliber = rhs.Caliber; + this.Coefficient = rhs.Coefficient; + this.LowerLimit = rhs.LowerLimit; + this.KeyWords = rhs.KeyWords?.ToList(); + this.Paras = rhs.Paras == null ? null : new Dictionary<string, string>(rhs.Paras); + this.Flags = rhs.Flags?.ToList(); + this.TagName = rhs.TagName; + this.SortCode = rhs.SortCode; + this.Description = rhs.Description; + } + + /// <summary> + /// 绯诲垪id + /// </summary> + public long SeriesID { get; set; } + + /// <summary> + /// 鍚嶇О + /// </summary> + public string Name { get; set; } + + /// <summary> + /// 鏉愭枡 + /// </summary> + public string Material { get; set; } + + /// <summary> + /// 鍙e緞 mm + /// </summary> + public double? Caliber { get; set; } + + /// <summary> + /// 鍠峰皠绯绘暟 + /// </summary> + public double Coefficient { get; set; } + + /// <summary> + /// 鏈�灏忓帇鍔� m + /// </summary> + public double LowerLimit { get; set; } + + /// <summary> + /// 鍏抽敭瀛� + /// </summary> + public List<string> KeyWords { get; set; } + + /// <summary> + /// 鍙傛暟 + /// </summary> + public Dictionary<string, string> Paras { get; set; } + + /// <summary> + /// 鏍囩 + /// </summary> + public List<string> Flags { get; set; } + + /// <summary> + /// 鏍囧織 + /// </summary> + public string TagName { get; set; } + + /// <summary> + /// 鎺掑簭鐮� + /// </summary> + public int SortCode { get; set; } + + /// <summary> + /// 璇存槑 + /// </summary> + public string Description { get; set; } + + + /// <summary> + /// + /// </summary> + public AssetsCoolingMain Clone() + { + return new AssetsCoolingMain(this); + } + + object ICloneable.Clone() + { + return this.Clone(); + } + + + } +} \ No newline at end of file diff --git a/Service/HStation.Service.Assets.Core/02-model/22-cooling/AssetsCoolingSeries.cs b/Service/HStation.Service.Assets.Core/02-model/22-cooling/AssetsCoolingSeries.cs new file mode 100644 index 0000000..ecec83c --- /dev/null +++ b/Service/HStation.Service.Assets.Core/02-model/22-cooling/AssetsCoolingSeries.cs @@ -0,0 +1,92 @@ +锘縰sing Yw.Model; + +namespace HStation.Model +{ + /// <summary> + /// 鍐峰嵈濉旂郴鍒� + /// </summary> + public class AssetsCoolingSeries : BaseModel, IParas, IFlags, ITagName, ITreeSorter, System.ICloneable + { + /// <summary> + /// + /// </summary> + public AssetsCoolingSeries() { } + + /// <summary> + /// + /// </summary> + public AssetsCoolingSeries(AssetsCoolingSeries rhs) : base(rhs) + { + this.ParentIds = rhs.ParentIds?.ToList(); + this.Name = rhs.Name; + this.Paras = rhs.Paras == null ? null : new Dictionary<string, string>(); + this.Flags = rhs.Flags?.ToList(); + this.TagName = rhs.TagName; + this.SortCode = rhs.SortCode; + this.Description = rhs.Description; + } + + /// <summary> + /// + /// </summary> + public void Reset(AssetsCoolingSeries rhs) + { + this.ID = rhs.ID; + this.ParentIds = rhs.ParentIds?.ToList(); + this.Name = rhs.Name; + this.Paras = rhs.Paras == null ? null : new Dictionary<string, string>(); + this.Flags = rhs.Flags?.ToList(); + this.TagName = rhs.TagName; + this.SortCode = rhs.SortCode; + this.Description = rhs.Description; + } + + /// <summary> + /// 鐖剁骇id鍒楄〃 + /// </summary> + public List<long> ParentIds { get; set; } + + /// <summary> + /// 鍚嶇О + /// </summary> + public string Name { get; set; } + + /// <summary> + /// 鍙傛暟 + /// </summary> + public Dictionary<string, string> Paras { get; set; } + + /// <summary> + /// 鏍囩 + /// </summary> + public List<string> Flags { get; set; } + + /// <summary> + /// 鏍囧織 + /// </summary> + public string TagName { get; set; } + + /// <summary> + /// 鎺掑簭鐮� + /// </summary> + public int SortCode { get; set; } + + /// <summary> + /// 璇存槑 + /// </summary> + public string Description { get; set; } + + /// <summary> + /// + /// </summary> + public AssetsCoolingSeries Clone() + { + return new AssetsCoolingSeries(this); + } + + object ICloneable.Clone() + { + return this.Clone(); + } + } +} \ No newline at end of file diff --git a/Service/HStation.Service.Assets.Core/04-dal/01-interface/21-cooling/IAssetsCoolingFactor.cs b/Service/HStation.Service.Assets.Core/04-dal/01-interface/21-cooling/IAssetsCoolingFactor.cs new file mode 100644 index 0000000..f2f226c --- /dev/null +++ b/Service/HStation.Service.Assets.Core/04-dal/01-interface/21-cooling/IAssetsCoolingFactor.cs @@ -0,0 +1,11 @@ +锘縰sing Yw.DAL; + +namespace HStation.DAL +{ + /// <summary> + /// + /// </summary> + public interface IAssetsCoolingFactor : IBaseDAL<Entity.AssetsCoolingFactor>, IUpdateSorter + { + } +} \ No newline at end of file diff --git a/Service/HStation.Service.Assets.Core/04-dal/01-interface/21-cooling/IAssetsCoolingMain.cs b/Service/HStation.Service.Assets.Core/04-dal/01-interface/21-cooling/IAssetsCoolingMain.cs new file mode 100644 index 0000000..3ac9ad5 --- /dev/null +++ b/Service/HStation.Service.Assets.Core/04-dal/01-interface/21-cooling/IAssetsCoolingMain.cs @@ -0,0 +1,15 @@ +锘縰sing Yw.DAL; + +namespace HStation.DAL +{ + /// <summary> + /// + /// </summary> + public interface IAssetsCoolingMain : IBaseDAL<Entity.AssetsCoolingMain>, IUpdateParas, IUpdateFlags, IUpdateTagName, IUpdateSorter + { + /// <summary> + /// + /// </summary> + List<Entity.AssetsCoolingMain> GetBySeriesID(long SeriesID); + } +} \ No newline at end of file diff --git a/Service/HStation.Service.Assets.Core/04-dal/01-interface/21-cooling/IAssetsCoolingSeries.cs b/Service/HStation.Service.Assets.Core/04-dal/01-interface/21-cooling/IAssetsCoolingSeries.cs new file mode 100644 index 0000000..8e7280f --- /dev/null +++ b/Service/HStation.Service.Assets.Core/04-dal/01-interface/21-cooling/IAssetsCoolingSeries.cs @@ -0,0 +1,11 @@ +锘縰sing Yw.DAL; + +namespace HStation.DAL +{ + /// <summary> + /// + /// </summary> + public interface IAssetsCoolingSeries : IBaseDAL<Entity.AssetsCoolingSeries>, IUpdateParas, IUpdateFlags, IUpdateTagName, IUpdateTreeSorter + { + } +} \ No newline at end of file diff --git a/Service/HStation.Service.Assets.Core/05-service/00-core/03-helper/KeyWordHelper.cs b/Service/HStation.Service.Assets.Core/05-service/00-core/03-helper/KeyWordHelper.cs index 0d457a9..0241f57 100644 --- a/Service/HStation.Service.Assets.Core/05-service/00-core/03-helper/KeyWordHelper.cs +++ b/Service/HStation.Service.Assets.Core/05-service/00-core/03-helper/KeyWordHelper.cs @@ -1,25 +1,37 @@ 锘縩amespace HStation.Service { + /// <summary> + /// + /// </summary> public class KeyWordHelper { - public static List<string> ToList(string keyword) - { - if (string.IsNullOrEmpty(keyword)) - { - return new List<string>(); - } - return keyword.Split(new string[1] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList(); - } + //鍒嗗壊瀛楃 + private const char _split = ','; - public static string ToString(List<string> KeyWord) + /// <summary> + /// 杞寲涓哄瓧绗︿覆 + /// </summary> + public static string ToString(IEnumerable<string> list) { - if (KeyWord == null || KeyWord.Count < 1) + if (list == null || list.Count() < 1) { return string.Empty; } - - return string.Join(",", KeyWord); + return string.Join(_split.ToString(), list.Select(x => x.Trim())); } + + /// <summary> + /// 杞寲涓哄垪琛� + /// </summary> + public static List<string> ToList(string str) + { + if (string.IsNullOrEmpty(str)) + { + return new List<string>(); + } + return str.Split(_split, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()).ToList(); + } + } } \ No newline at end of file diff --git a/Service/HStation.Service.Assets.Core/05-service/21-cooling/01-series/AssetsCoolingSeries.cs b/Service/HStation.Service.Assets.Core/05-service/21-cooling/01-series/AssetsCoolingSeries.cs new file mode 100644 index 0000000..fe04c85 --- /dev/null +++ b/Service/HStation.Service.Assets.Core/05-service/21-cooling/01-series/AssetsCoolingSeries.cs @@ -0,0 +1,493 @@ +锘縩amespace HStation.Service +{ + /// <summary> + /// + /// </summary> + public partial class AssetsCoolingSeries + { + #region Cache + + //鑾峰彇缂撳瓨 + private static List<Model.AssetsCoolingSeries> GetCache() + { + var all = AssetsCoolingSeriesCacheHelper.GetSet(() => + { + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingSeries>(); + var entity_list = dal.GetAll(); + var model_list = Entity2Models(entity_list); + if (model_list == null) + { + model_list = new List<Model.AssetsCoolingSeries>(); + } + return model_list; + }, Yw.Service.ConfigHelper.CacheKeepTime, Yw.Service.ConfigHelper.CacheRandomTime); + return all; + } + + //閫氳繃 ID 鏇存柊缂撳瓨 + private static void UpdateCache(long ID) + { + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingSeries>(); + var entity_ds = dal.GetByID(ID); + var model_ds = Entity2Model(entity_ds); + var all = GetCache(); + var model = all.Find(x => x.ID == ID); + if (model == null) + { + all.Add(model_ds); + } + else + { + model.Reset(model_ds); + } + AssetsCoolingSeriesCacheHelper.Trigger(); + } + + //閫氳繃 Ids 鏇存柊缂撳瓨 + private static void UpdateCache(List<long> Ids) + { + if (Ids == null || Ids.Count < 1) + { + return; + } + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingSeries>(); + var entity_list = dal.GetByIds(Ids); + var model_list = Entity2Models(entity_list); + var all = GetCache(); + all.RemoveAll(x => Ids.Contains(x.ID)); + if (model_list != null && model_list.Count > 0) + { + all.AddRange(model_list); + } + AssetsCoolingSeriesCacheHelper.Trigger(); + } + + //绉婚櫎缂撳瓨 + private static void RemoveCache(long ID) + { + var all = GetCache(); + all.RemoveAll(x => x.ID == ID); + AssetsCoolingSeriesCacheHelper.Trigger(); + } + + /// <summary> + /// 鍙戝竷缂撳瓨 + /// </summary> + public static void PublishCache(string key) + { + AssetsCoolingSeriesCacheHelper.Publish(key); + } + + #endregion + + #region Query + + /// <summary> + /// 鑾峰彇鎵�鏈� + /// </summary> + public List<Model.AssetsCoolingSeries> GetAll() + { + var all = GetCache(); + return all.OrderBy(x => x.ParentIds.Count).ThenBy(x => x.SortCode).ToList(); + } + + /// <summary> + /// 閫氳繃 ID 鑾峰彇 + /// </summary> + public Model.AssetsCoolingSeries GetByID(long ID) + { + var all = GetAll(); + return all.Find(x => x.ID == ID); + } + + /// <summary> + /// 閫氳繃 ID 鑾峰彇 + /// </summary> + public List<Model.AssetsCoolingSeries> GetByIds(List<long> Ids) + { + if (Ids == null || Ids.Count < 1) + { + return default; + } + var all = GetAll(); + return all.Where(x => Ids.Contains(x.ID)).OrderBy(x => x.ParentIds.Count).ThenBy(x => x.SortCode).ToList(); + } + + /// <summary> + /// 閫氳繃 ID 鑾峰彇瀛愮骇鍙婅嚜韬� + /// </summary> + public List<Model.AssetsCoolingSeries> GetChildAndSelfByID(long ID) + { + var all = GetAll(); + var list = all.Where(x => x.ID == ID || x.ParentIds.Contains(ID)).OrderBy(x => x.ParentIds.Count).ThenBy(x => x.SortCode).ToList(); + return list; + } + + /// <summary> + /// 閫氳繃 ID 鑾峰彇瀛愮骇 + /// </summary> + public List<Model.AssetsCoolingSeries> GetChildrenByID(long ID) + { + var all = GetAll(); + var list = all.Where(x => x.ParentIds.Contains(ID)).OrderBy(x => x.ParentIds.Count).ThenBy(x => x.SortCode).ToList(); + return list; + } + + /// <summary> + /// 閫氳繃 ID 鑾峰彇鐖剁骇 + /// </summary> + public List<Model.AssetsCoolingSeries> GetParentByID(long ID) + { + var all = GetAll(); + var model = all.Find(x => x.ID == ID); + if (model == null) + { + return default; + } + return all.Where(x => model.ParentIds.Contains(x.ID)).OrderBy(x => x.ParentIds.Count).ThenBy(x => x.SortCode).ToList(); + } + + /// <summary> + /// 閫氳繃 ID 鑾峰彇鐖剁骇鍙婅嚜韬� + /// </summary> + public List<Model.AssetsCoolingSeries> GetParentAndSelfByID(long ID) + { + var all = GetAll(); + var model = all.Find(x => x.ID == ID); + if (model == null) + { + return default; + } + return all.Where(x => model.ParentIds.Contains(x.ID) || x.ID == ID).OrderBy(x => x.ParentIds.Count).ThenBy(x => x.SortCode).ToList(); + } + + /// <summary> + /// 閫氳繃 ParentID 鑾峰彇 + /// </summary> + public List<Model.AssetsCoolingSeries> GetByParentID(long ParentID) + { + var all = GetAll(); + return all.Where(x => x.ParentIds.LastOrDefault() == ParentID).OrderBy(x => x.SortCode).ToList(); + } + + /// <summary> + /// 鏄惁鍖呭惈瀛愰」 + /// </summary> + public bool HasChildren(long ID) + { + var all = GetAll(); + return all.Exists(x => x.ParentIds.Contains(ID)); + } + + /// <summary> + /// 鑾峰彇鏈�澶ф帓搴忕爜 + /// </summary> + public int GetMaxSortCode(long ParentID) + { + List<Model.AssetsCoolingSeries> list = null; + if (ParentID < 1) + { + list = GetAll(); + list = list?.Where(x => x.ParentIds.Count < 1).ToList(); + } + else + { + list = GetByParentID(ParentID); + } + if (list == null || list.Count < 1) + { + return 0; + } + return list.Max(x => x.SortCode); + } + + #endregion + + #region Insert + + /// <summary> + /// 鎻掑叆涓�鏉℃暟鎹� + /// </summary> + public long Insert(Model.AssetsCoolingSeries model) + { + if (model == null) + { + return default; + } + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingSeries>(); + var entity = Model2Entity(model); + var id = dal.Insert(entity); + if (id > 0) + { + UpdateCache(id); + } + return id; + } + + /// <summary> + /// 鎻掑叆澶氭潯 + /// </summary> + public bool Inserts(List<Model.AssetsCoolingSeries> list) + { + if (list == null || list.Count < 1) + { + return false; + } + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingSeries>(); + var entity_list = Model2Entities(list); + var ids = dal.InsertsR(entity_list); + if (ids != null && ids.Count > 0) + { + UpdateCache(ids); + return true; + } + return false; + } + + #endregion + + #region Update + + /// <summary> + /// 鏇存柊涓�鏉� + /// </summary> + public bool Update(Model.AssetsCoolingSeries model) + { + if (model == null) + { + return false; + } + var entity = Model2Entity(model); + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingSeries>(); + var bol = dal.Update(entity); + if (bol) + { + UpdateCache(model.ID); + } + return bol; + } + + /// <summary> + /// 鎵归噺鏇存柊 + /// </summary> + public bool Updates(List<Model.AssetsCoolingSeries> list) + { + if (list == null || list.Count < 1) + { + return false; + } + if (list.Exists(x => x.ID < 1)) + { + return false; + } + var entity_list = Model2Entities(list); + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingSeries>(); + var bol = dal.Updates(entity_list); + if (bol) + { + UpdateCache(list.Select(x => x.ID).ToList()); + } + return bol; + } + + /// <summary> + /// 鏇存柊鎺掑簭鐮� + /// </summary> + public bool UpdateSortCode(long ID, int SortCode) + { + if (ID < 1) + { + return false; + } + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingSeries>(); + var bol = dal.UpdateSortCode(ID, SortCode); + if (bol) + { + UpdateCache(ID); + } + return bol; + } + + /// <summary> + /// 鏇存柊鎺掑簭 + /// </summary> + public bool UpdateSorter(List<Yw.Model.Sorter> sorters) + { + if (sorters == null || sorters.Count < 1) + { + return false; + } + if (sorters.Exists(x => x.ID < 1)) + { + return false; + } + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingSeries>(); + var bol = dal.UpdateSorter(sorters.ToEntityList()); + if (bol) + { + UpdateCache(sorters.Select(x => x.ID).ToList()); + } + return bol; + } + + /// <summary> + /// 鏇存柊鏍戞帓搴忕爜 + /// </summary> + public bool UpdateTreeSortCode(long ID, List<long> ParentIds, int SortCode) + { + if (ID < 1) + { + return false; + } + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingSeries>(); + var bol = dal.UpdateTreeSortCode(ID, TreeParentIdsHelper.ToString(ParentIds), SortCode); + if (bol) + { + UpdateCache(ID); + } + return bol; + } + + /// <summary> + /// 鏇存柊鏍戞帓搴� + /// </summary> + public bool UpdateTreeSorter(List<Yw.Model.TreeSorter> sorters) + { + if (sorters == null || sorters.Count < 1) + { + return false; + } + if (sorters.Exists(x => x.ID < 1)) + { + return false; + } + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingSeries>(); + var bol = dal.UpdateTreeSorter(sorters.ToEntityList()); + if (bol) + { + UpdateCache(sorters.Select(x => x.ID).ToList()); + } + return bol; + } + + /// <summary> + /// 鏇存柊 Paras + /// </summary> + public bool UpdateParas(long ID, Dictionary<string, string> Paras) + { + if (ID < 1) + { + return false; + } + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingSeries>(); + var bol = dal.UpdateParas(ID, ParasHelper.ToString(Paras)); + if (bol) + { + UpdateCache(ID); + } + return bol; + } + + /// <summary> + /// 鏇存柊 Flags + /// </summary> + public bool UpdateFlags(long ID, List<string> Flags) + { + if (ID < 1) + { + return false; + } + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingSeries>(); + var bol = dal.UpdateFlags(ID, FlagsHelper.ToString(Flags)); + if (bol) + { + UpdateCache(ID); + } + return bol; + } + + /// <summary> + /// 鏇存柊 TagName + /// </summary> + public bool UpdateTagName(long ID, string TagName) + { + if (ID < 1) + { + return false; + } + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingSeries>(); + var bol = dal.UpdateTagName(ID, TagName); + if (bol) + { + UpdateCache(ID); + } + return bol; + } + + + #endregion + + #region Exist + + /// <summary> + /// 鍒ゆ柇 TagName 鏄惁瀛樺湪 + /// </summary> + public bool IsExistTagName(string TagName) + { + if (string.IsNullOrEmpty(TagName)) + { + return false; + } + var all = GetAll(); + return all.Exists(x => x.TagName == TagName); + } + + /// <summary> + /// 鍒ゆ柇 TagName 鏄惁瀛樺湪 ExceptID + /// </summary> + public bool IsExistTagNameExceptID(string TagName, long ExceptID) + { + if (string.IsNullOrEmpty(TagName)) + { + return false; + } + var all = GetAll(); + return all.Exists(x => x.TagName == TagName && x.ID != ExceptID); + } + + + #endregion + + #region Delete + + /// <summary> + /// 閫氳繃 ID 鍒犻櫎 + /// </summary> + public bool DeleteByID(long ID, out string Msg) + { + Msg = string.Empty; + if (HasChildren(ID)) + { + Msg = "瀛樺湪瀛愮骇锛岃鍒犻櫎鍚庨噸璇曪紒"; + return false; + } + var serviceMain = new AssetsCoolingMain(); + if (serviceMain.IsExistBySeriesID(ID)) + { + Msg = "瀛樺湪鍨嬪彿淇℃伅锛岃鍒犻櫎鍚庨噸璇曪紒"; + return false; + } + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingSeries>(); + var bol = dal.DeleteByID(ID); + if (bol) + { + RemoveCache(ID); + } + return bol; + } + + #endregion + + + } +} \ No newline at end of file diff --git a/Service/HStation.Service.Assets.Core/05-service/21-cooling/01-series/AssetsCoolingSeries_Instance.cs b/Service/HStation.Service.Assets.Core/05-service/21-cooling/01-series/AssetsCoolingSeries_Instance.cs new file mode 100644 index 0000000..73f315c --- /dev/null +++ b/Service/HStation.Service.Assets.Core/05-service/21-cooling/01-series/AssetsCoolingSeries_Instance.cs @@ -0,0 +1,73 @@ +锘縩amespace HStation.Service +{ + public partial class AssetsCoolingSeries + { + //Entity to GetModel + internal static Model.AssetsCoolingSeries Entity2Model(Entity.AssetsCoolingSeries entity) + { + if (entity == null) + return default; + var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Entity.AssetsCoolingSeries, Model.AssetsCoolingSeries>() + .ForMember(d => d.ParentIds, opt => opt.MapFrom(src => TreeParentIdsHelper.ToList(src.ParentIds))) + .ForMember(d => d.Paras, opt => opt.MapFrom(src => ParasHelper.ToDictionary(src.Paras))) + .ForMember(d => d.Flags, opt => opt.MapFrom(src => FlagsHelper.ToList(src.Flags))) + ).CreateMapper(); + var model = mapper.Map<Entity.AssetsCoolingSeries, Model.AssetsCoolingSeries>(entity); + return model; + } + //Entities to GetModels + internal static List<Model.AssetsCoolingSeries> Entity2Models(List<Entity.AssetsCoolingSeries> entities) + { + if (entities == null || entities.Count < 1) + return default; + var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Entity.AssetsCoolingSeries, Model.AssetsCoolingSeries>() + .ForMember(d => d.ParentIds, opt => opt.MapFrom(src => TreeParentIdsHelper.ToList(src.ParentIds))) + .ForMember(d => d.Paras, opt => opt.MapFrom(src => ParasHelper.ToDictionary(src.Paras))) + .ForMember(d => d.Flags, opt => opt.MapFrom(src => FlagsHelper.ToList(src.Flags))) + ).CreateMapper(); + var models = mapper.Map<List<Entity.AssetsCoolingSeries>, List<Model.AssetsCoolingSeries>>(entities); + return models; + } + + //Model to Entity + internal static Entity.AssetsCoolingSeries Model2Entity(Model.AssetsCoolingSeries model) + { + if (model == null) + return default; + var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.AssetsCoolingSeries, Entity.AssetsCoolingSeries>() + .ForMember(d => d.ParentIds, opt => opt.MapFrom(src => TreeParentIdsHelper.ToString(src.ParentIds))) + .ForMember(d => d.Paras, opt => opt.MapFrom(src => ParasHelper.ToString(src.Paras))) + .ForMember(d => d.Flags, opt => opt.MapFrom(src => FlagsHelper.ToString(src.Flags))) + ).CreateMapper(); + var entity = mapper.Map<Model.AssetsCoolingSeries, Entity.AssetsCoolingSeries>(model); + return entity; + } + + //Models to Entities + internal static List<Entity.AssetsCoolingSeries> Model2Entities(List<Model.AssetsCoolingSeries> models) + { + if (models == null || models.Count < 1) + return default; + var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.AssetsCoolingSeries, Entity.AssetsCoolingSeries>() + .ForMember(d => d.ParentIds, opt => opt.MapFrom(src => TreeParentIdsHelper.ToString(src.ParentIds))) + .ForMember(d => d.Paras, opt => opt.MapFrom(src => ParasHelper.ToString(src.Paras))) + .ForMember(d => d.Flags, opt => opt.MapFrom(src => FlagsHelper.ToString(src.Flags))) + ).CreateMapper(); + var entities = mapper.Map<List<Model.AssetsCoolingSeries>, List<Entity.AssetsCoolingSeries>>(models); + return entities; + } + + //Model to Entity + internal static void Model2Entity(Model.AssetsCoolingSeries model, Entity.AssetsCoolingSeries entity) + { + if (model == null || entity == null) + return; + var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.AssetsCoolingSeries, Entity.AssetsCoolingSeries>() + .ForMember(d => d.ParentIds, opt => opt.MapFrom(src => TreeParentIdsHelper.ToString(src.ParentIds))) + .ForMember(d => d.Paras, opt => opt.MapFrom(src => ParasHelper.ToString(src.Paras))) + .ForMember(d => d.Flags, opt => opt.MapFrom(src => FlagsHelper.ToString(src.Flags))) + ).CreateMapper(); + mapper.Map(model, entity); + } + } +} diff --git a/Service/HStation.Service.Assets.Core/05-service/21-cooling/01-series/Cache/AssetsCoolingSeriesCacheHelper.cs b/Service/HStation.Service.Assets.Core/05-service/21-cooling/01-series/Cache/AssetsCoolingSeriesCacheHelper.cs new file mode 100644 index 0000000..f7f3fe8 --- /dev/null +++ b/Service/HStation.Service.Assets.Core/05-service/21-cooling/01-series/Cache/AssetsCoolingSeriesCacheHelper.cs @@ -0,0 +1,71 @@ +锘縩amespace HStation.Service +{ + /// <summary> + /// AssetsCoolingSeries + /// 缂撳瓨杈呭姪绫� + /// </summary> + internal class AssetsCoolingSeriesCacheHelper + { + private const string _contentKey = "AssetsCoolingSeriesList"; + + internal static string GetCacheKey() + { + return CacheHelper.GetCacheKey(_contentKey); + } + + /// <summary> + /// 璁剧疆缂撳瓨 + /// </summary> + public static void Set(List<Model.AssetsCoolingSeries> list, int Minites = 30, int RandomSeconds = 0) + { + var cacheKey = GetCacheKey(); + MemoryCacheHelper.Set(cacheKey, list, Minites * 60 + RandomSeconds); + } + + /// <summary> + /// 鑾峰彇缂撳瓨 + /// </summary> + /// <returns></returns> + public static List<Model.AssetsCoolingSeries> Get() + { + var cacheKey = GetCacheKey(); + return MemoryCacheHelper.Get<List<Model.AssetsCoolingSeries>>(cacheKey); + } + + /// <summary> + /// 鑾峰彇璁剧疆缂撳瓨 + /// </summary> + public static List<Model.AssetsCoolingSeries> GetSet(Func<List<Model.AssetsCoolingSeries>> func, int Minites = 30, int RandomSeconds = 0) + { + var cacheKey = GetCacheKey(); + return MemoryCacheHelper.GetSet(cacheKey, func, Minites * 60 + RandomSeconds); + } + + /// <summary> + /// 绉婚櫎缂撳瓨 + /// </summary> + public static void Remove() + { + var cacheKey = GetCacheKey(); + MemoryCacheHelper.Remove(cacheKey); + } + + /// <summary> + /// 鍙戝竷 + /// </summary> + public static void Publish(string key) + { + var cacheKey = GetCacheKey(); + MemoryCacheWipeRelationHelper.Set(key, cacheKey); + } + + /// <summary> + /// 瑙﹀彂 + /// </summary> + public static void Trigger() + { + var cacheKey = GetCacheKey(); + MemoryCacheWipeRelationHelper.Trigger(cacheKey); + } + } +} \ No newline at end of file diff --git a/Service/HStation.Service.Assets.Core/05-service/21-cooling/02-main/AssetsCoolingMain.cs b/Service/HStation.Service.Assets.Core/05-service/21-cooling/02-main/AssetsCoolingMain.cs new file mode 100644 index 0000000..29c06dd --- /dev/null +++ b/Service/HStation.Service.Assets.Core/05-service/21-cooling/02-main/AssetsCoolingMain.cs @@ -0,0 +1,398 @@ +锘縩amespace HStation.Service +{ + /// <summary> + /// + /// </summary> + public partial class AssetsCoolingMain + { + #region Cache + + //鑾峰彇缂撳瓨 + private static List<Model.AssetsCoolingMain> GetCache() + { + var all = AssetsCoolingMainCacheHelper.GetSet(() => + { + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingMain>(); + var entity_list = dal.GetAll(); + var model_list = Entity2Models(entity_list); + if (model_list == null) + { + model_list = new List<Model.AssetsCoolingMain>(); + } + return model_list; + }, Yw.Service.ConfigHelper.CacheKeepTime, Yw.Service.ConfigHelper.CacheRandomTime); + return all; + } + + //閫氳繃 ID 鏇存柊缂撳瓨 + private static void UpdateCache(long ID) + { + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingMain>(); + var entity_ds = dal.GetByID(ID); + var model_ds = Entity2Model(entity_ds); + var all = GetCache(); + var model = all.Find(x => x.ID == ID); + if (model == null) + { + all.Add(model_ds); + } + else + { + model.Reset(model_ds); + } + AssetsCoolingMainCacheHelper.Trigger(); + } + + //閫氳繃 Ids 鏇存柊缂撳瓨 + private static void UpdateCache(List<long> Ids) + { + if (Ids == null || Ids.Count < 1) + { + return; + } + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingMain>(); + var entity_list = dal.GetByIds(Ids); + var model_list = Entity2Models(entity_list); + var all = GetCache(); + all.RemoveAll(x => Ids.Contains(x.ID)); + if (model_list != null && model_list.Count > 0) + { + all.AddRange(model_list); + } + AssetsCoolingMainCacheHelper.Trigger(); + } + + //绉婚櫎缂撳瓨 + private static void RemoveCache(long ID) + { + var all = GetCache(); + all.RemoveAll(x => x.ID == ID); + AssetsCoolingMainCacheHelper.Trigger(); + } + + /// <summary> + /// 鍙戝竷缂撳瓨 + /// </summary> + public static void PublishCache(string key) + { + AssetsCoolingMainCacheHelper.Publish(key); + } + + #endregion + + #region Query + + /// <summary> + /// 鑾峰彇鎵�鏈� + /// </summary> + public List<Model.AssetsCoolingMain> GetAll() + { + var all = GetCache(); + return all.OrderBy(x => x.SortCode).ToList(); + } + + /// <summary> + /// 閫氳繃 ID 鑾峰彇 + /// </summary> + public Model.AssetsCoolingMain GetByID(long ID) + { + var all = GetAll(); + return all.Find(x => x.ID == ID); + } + + /// <summary> + /// 閫氳繃 ID 鑾峰彇 + /// </summary> + public List<Model.AssetsCoolingMain> GetByIds(List<long> Ids) + { + if (Ids == null || Ids.Count < 1) + { + return default; + } + var all = GetAll(); + return all.Where(x => Ids.Contains(x.ID)).OrderBy(x => x.SortCode).ToList(); + } + + /// <summary> + /// 閫氳繃 SeriesID 鑾峰彇 + /// </summary> + public List<Model.AssetsCoolingMain> GetBySeriesID(long SeriesID) + { + var all = GetAll(); + return all.Where(x => x.SeriesID == SeriesID).OrderBy(x => x.SortCode).ToList(); + } + + /// <summary> + /// 閫氳繃 SeriesIds 鑾峰彇 + /// </summary> + public List<Model.AssetsCoolingMain> GetBySeriesIds(List<long> SeriesIds) + { + if (SeriesIds == null || SeriesIds.Count < 1) + { + return default; + } + var all = GetAll(); + return all.Where(x => SeriesIds.Contains(x.SeriesID)).OrderBy(x => x.SortCode).ToList(); + } + + /// <summary> + /// 鑾峰彇鏈�澶ф帓搴忕爜 + /// </summary> + public int GetMaxSortCode(long SeriesID) + { + var all = GetBySeriesID(SeriesID); + if (all == null || all.Count < 1) + { + return 0; + } + return all.Max(x => x.SortCode); + } + + #endregion + + #region Insert + + /// <summary> + /// 鎻掑叆涓�鏉℃暟鎹� + /// </summary> + public long Insert(Model.AssetsCoolingMain model) + { + if (model == null) + { + return default; + } + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingMain>(); + var entity = Model2Entity(model); + var id = dal.Insert(entity); + if (id > 0) + { + UpdateCache(id); + } + return id; + } + + /// <summary> + /// 鎻掑叆澶氭潯 + /// </summary> + public bool Inserts(List<Model.AssetsCoolingMain> list) + { + if (list == null || list.Count < 1) + { + return false; + } + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingMain>(); + var entity_list = Model2Entities(list); + var ids = dal.InsertsR(entity_list); + if (ids != null && ids.Count > 0) + { + UpdateCache(ids); + return true; + } + return false; + } + + #endregion + + #region Update + + /// <summary> + /// 鏇存柊涓�鏉� + /// </summary> + public bool Update(Model.AssetsCoolingMain model) + { + if (model == null) + { + return false; + } + var entity = Model2Entity(model); + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingMain>(); + var bol = dal.Update(entity); + if (bol) + { + UpdateCache(model.ID); + } + return bol; + } + + /// <summary> + /// 鎵归噺鏇存柊 + /// </summary> + public bool Updates(List<Model.AssetsCoolingMain> list) + { + if (list == null || list.Count < 1) + { + return false; + } + if (list.Exists(x => x.ID < 1)) + { + return false; + } + var entity_list = Model2Entities(list); + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingMain>(); + var bol = dal.Updates(entity_list); + if (bol) + { + UpdateCache(list.Select(x => x.ID).ToList()); + } + return bol; + } + + /// <summary> + /// 鏇存柊鎺掑簭鐮� + /// </summary> + public bool UpdateSortCode(long ID, int SortCode) + { + if (ID < 1) + { + return false; + } + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingMain>(); + var bol = dal.UpdateSortCode(ID, SortCode); + if (bol) + { + UpdateCache(ID); + } + return bol; + } + + /// <summary> + /// 鏇存柊鎺掑簭 + /// </summary> + public bool UpdateSorter(List<Yw.Model.Sorter> sorters) + { + if (sorters == null || sorters.Count < 1) + { + return false; + } + if (sorters.Exists(x => x.ID < 1)) + { + return false; + } + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingMain>(); + var bol = dal.UpdateSorter(sorters.ToEntityList()); + if (bol) + { + UpdateCache(sorters.Select(x => x.ID).ToList()); + } + return bol; + } + + /// <summary> + /// 鏇存柊 Paras + /// </summary> + public bool UpdateParas(long ID, Dictionary<string, string> Paras) + { + if (ID < 1) + { + return false; + } + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingMain>(); + var bol = dal.UpdateParas(ID, ParasHelper.ToString(Paras)); + if (bol) + { + UpdateCache(ID); + } + return bol; + } + + /// <summary> + /// 鏇存柊 Flags + /// </summary> + public bool UpdateFlags(long ID, List<string> Flags) + { + if (ID < 1) + { + return false; + } + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingMain>(); + var bol = dal.UpdateFlags(ID, FlagsHelper.ToString(Flags)); + if (bol) + { + UpdateCache(ID); + } + return bol; + } + + /// <summary> + /// 鏇存柊 TagName + /// </summary> + public bool UpdateTagName(long ID, string TagName) + { + if (ID < 1) + { + return false; + } + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingMain>(); + var bol = dal.UpdateTagName(ID, TagName); + if (bol) + { + UpdateCache(ID); + } + return bol; + } + + + #endregion + + #region Exist + + /// <summary> + /// 鍒ゆ柇 TagName 鏄惁瀛樺湪 + /// </summary> + public bool IsExistTagName(string TagName) + { + if (string.IsNullOrEmpty(TagName)) + { + return false; + } + var all = GetAll(); + return all.Exists(x => x.TagName == TagName); + } + + /// <summary> + /// 鍒ゆ柇 TagName 鏄惁瀛樺湪 ExceptID + /// </summary> + public bool IsExistTagNameExceptID(string TagName, long ExceptID) + { + if (string.IsNullOrEmpty(TagName)) + { + return false; + } + var all = GetAll(); + return all.Exists(x => x.TagName == TagName && x.ID != ExceptID); + } + + /// <summary> + /// 閫氳繃 SeriesID 鍒ゆ柇鏄惁瀛樺湪 + /// </summary> + public bool IsExistBySeriesID(long SeriesID) + { + var all = GetAll(); + return all.Exists(x => x.SeriesID == SeriesID); + } + + + #endregion + + #region Delete + + /// <summary> + /// 閫氳繃 ID 鍒犻櫎 + /// </summary> + public bool DeleteByID(long ID, out string Msg) + { + Msg = string.Empty; + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingMain>(); + var bol = dal.DeleteByID(ID); + if (bol) + { + RemoveCache(ID); + } + return bol; + } + + #endregion + + + } +} \ No newline at end of file diff --git a/Service/HStation.Service.Assets.Core/05-service/21-cooling/02-main/AssetsCoolingMain_Instance.cs b/Service/HStation.Service.Assets.Core/05-service/21-cooling/02-main/AssetsCoolingMain_Instance.cs new file mode 100644 index 0000000..c971922 --- /dev/null +++ b/Service/HStation.Service.Assets.Core/05-service/21-cooling/02-main/AssetsCoolingMain_Instance.cs @@ -0,0 +1,73 @@ +锘縩amespace HStation.Service +{ + public partial class AssetsCoolingMain + { + //Entity to GetModel + internal static Model.AssetsCoolingMain Entity2Model(Entity.AssetsCoolingMain entity) + { + if (entity == null) + return default; + var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Entity.AssetsCoolingMain, Model.AssetsCoolingMain>() + .ForMember(d => d.KeyWords, opt => opt.MapFrom(src => KeyWordHelper.ToList(src.KeyWords))) + .ForMember(d => d.Paras, opt => opt.MapFrom(src => ParasHelper.ToDictionary(src.Paras))) + .ForMember(d => d.Flags, opt => opt.MapFrom(src => FlagsHelper.ToList(src.Flags))) + ).CreateMapper(); + var model = mapper.Map<Entity.AssetsCoolingMain, Model.AssetsCoolingMain>(entity); + return model; + } + //Entities to GetModels + internal static List<Model.AssetsCoolingMain> Entity2Models(List<Entity.AssetsCoolingMain> entities) + { + if (entities == null || entities.Count < 1) + return default; + var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Entity.AssetsCoolingMain, Model.AssetsCoolingMain>() + .ForMember(d => d.KeyWords, opt => opt.MapFrom(src => KeyWordHelper.ToList(src.KeyWords))) + .ForMember(d => d.Paras, opt => opt.MapFrom(src => ParasHelper.ToDictionary(src.Paras))) + .ForMember(d => d.Flags, opt => opt.MapFrom(src => FlagsHelper.ToList(src.Flags))) + ).CreateMapper(); + var models = mapper.Map<List<Entity.AssetsCoolingMain>, List<Model.AssetsCoolingMain>>(entities); + return models; + } + + //Model to Entity + internal static Entity.AssetsCoolingMain Model2Entity(Model.AssetsCoolingMain model) + { + if (model == null) + return default; + var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.AssetsCoolingMain, Entity.AssetsCoolingMain>() + .ForMember(d => d.KeyWords, opt => opt.MapFrom(src => KeyWordHelper.ToString(src.KeyWords))) + .ForMember(d => d.Paras, opt => opt.MapFrom(src => ParasHelper.ToString(src.Paras))) + .ForMember(d => d.Flags, opt => opt.MapFrom(src => FlagsHelper.ToString(src.Flags))) + ).CreateMapper(); + var entity = mapper.Map<Model.AssetsCoolingMain, Entity.AssetsCoolingMain>(model); + return entity; + } + + //Models to Entities + internal static List<Entity.AssetsCoolingMain> Model2Entities(List<Model.AssetsCoolingMain> models) + { + if (models == null || models.Count < 1) + return default; + var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.AssetsCoolingMain, Entity.AssetsCoolingMain>() + .ForMember(d => d.KeyWords, opt => opt.MapFrom(src => KeyWordHelper.ToString(src.KeyWords))) + .ForMember(d => d.Paras, opt => opt.MapFrom(src => ParasHelper.ToString(src.Paras))) + .ForMember(d => d.Flags, opt => opt.MapFrom(src => FlagsHelper.ToString(src.Flags))) + ).CreateMapper(); + var entities = mapper.Map<List<Model.AssetsCoolingMain>, List<Entity.AssetsCoolingMain>>(models); + return entities; + } + + //Model to Entity + internal static void Model2Entity(Model.AssetsCoolingMain model, Entity.AssetsCoolingMain entity) + { + if (model == null || entity == null) + return; + var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.AssetsCoolingMain, Entity.AssetsCoolingMain>() + .ForMember(d => d.KeyWords, opt => opt.MapFrom(src => KeyWordHelper.ToString(src.KeyWords))) + .ForMember(d => d.Paras, opt => opt.MapFrom(src => ParasHelper.ToString(src.Paras))) + .ForMember(d => d.Flags, opt => opt.MapFrom(src => FlagsHelper.ToString(src.Flags))) + ).CreateMapper(); + mapper.Map(model, entity); + } + } +} diff --git a/Service/HStation.Service.Assets.Core/05-service/21-cooling/02-main/Cache/AssetsCoolingMainCacheHelper.cs b/Service/HStation.Service.Assets.Core/05-service/21-cooling/02-main/Cache/AssetsCoolingMainCacheHelper.cs new file mode 100644 index 0000000..b4f19fd --- /dev/null +++ b/Service/HStation.Service.Assets.Core/05-service/21-cooling/02-main/Cache/AssetsCoolingMainCacheHelper.cs @@ -0,0 +1,71 @@ +锘縩amespace HStation.Service +{ + /// <summary> + /// AssetsCoolingMain + /// 缂撳瓨杈呭姪绫� + /// </summary> + internal class AssetsCoolingMainCacheHelper + { + private const string _contentKey = "AssetsCoolingMainList"; + + internal static string GetCacheKey() + { + return CacheHelper.GetCacheKey(_contentKey); + } + + /// <summary> + /// 璁剧疆缂撳瓨 + /// </summary> + public static void Set(List<Model.AssetsCoolingMain> list, int Minites = 30, int RandomSeconds = 0) + { + var cacheKey = GetCacheKey(); + MemoryCacheHelper.Set(cacheKey, list, Minites * 60 + RandomSeconds); + } + + /// <summary> + /// 鑾峰彇缂撳瓨 + /// </summary> + /// <returns></returns> + public static List<Model.AssetsCoolingMain> Get() + { + var cacheKey = GetCacheKey(); + return MemoryCacheHelper.Get<List<Model.AssetsCoolingMain>>(cacheKey); + } + + /// <summary> + /// 鑾峰彇璁剧疆缂撳瓨 + /// </summary> + public static List<Model.AssetsCoolingMain> GetSet(Func<List<Model.AssetsCoolingMain>> func, int Minites = 30, int RandomSeconds = 0) + { + var cacheKey = GetCacheKey(); + return MemoryCacheHelper.GetSet(cacheKey, func, Minites * 60 + RandomSeconds); + } + + /// <summary> + /// 绉婚櫎缂撳瓨 + /// </summary> + public static void Remove() + { + var cacheKey = GetCacheKey(); + MemoryCacheHelper.Remove(cacheKey); + } + + /// <summary> + /// 鍙戝竷 + /// </summary> + public static void Publish(string key) + { + var cacheKey = GetCacheKey(); + MemoryCacheWipeRelationHelper.Set(key, cacheKey); + } + + /// <summary> + /// 瑙﹀彂 + /// </summary> + public static void Trigger() + { + var cacheKey = GetCacheKey(); + MemoryCacheWipeRelationHelper.Trigger(cacheKey); + } + } +} \ No newline at end of file diff --git a/Service/HStation.Service.Assets.Core/05-service/21-cooling/03-factor/AssetsCoolingFactor.cs b/Service/HStation.Service.Assets.Core/05-service/21-cooling/03-factor/AssetsCoolingFactor.cs new file mode 100644 index 0000000..36490f5 --- /dev/null +++ b/Service/HStation.Service.Assets.Core/05-service/21-cooling/03-factor/AssetsCoolingFactor.cs @@ -0,0 +1,275 @@ +锘縩amespace HStation.Service +{ + /// <summary> + /// + /// </summary> + public partial class AssetsCoolingFactor + { + #region Cache + + //鑾峰彇缂撳瓨 + private static List<Model.AssetsCoolingFactor> GetCache() + { + var all = AssetsCoolingFactorCacheHelper.GetSet(() => + { + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingFactor>(); + var entity_list = dal.GetAll(); + var model_list = Entity2Models(entity_list); + if (model_list == null) + { + model_list = new List<Model.AssetsCoolingFactor>(); + } + return model_list; + }, Yw.Service.ConfigHelper.CacheKeepTime, Yw.Service.ConfigHelper.CacheRandomTime); + return all; + } + + //閫氳繃 ID 鏇存柊缂撳瓨 + private static void UpdateCache(long ID) + { + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingFactor>(); + var entity_ds = dal.GetByID(ID); + var model_ds = Entity2Model(entity_ds); + var all = GetCache(); + var model = all.Find(x => x.ID == ID); + if (model == null) + { + all.Add(model_ds); + } + else + { + model.Reset(model_ds); + } + AssetsCoolingFactorCacheHelper.Trigger(); + } + + //閫氳繃 Ids 鏇存柊缂撳瓨 + private static void UpdateCache(List<long> Ids) + { + if (Ids == null || Ids.Count < 1) + { + return; + } + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingFactor>(); + var entity_list = dal.GetByIds(Ids); + var model_list = Entity2Models(entity_list); + var all = GetCache(); + all.RemoveAll(x => Ids.Contains(x.ID)); + if (model_list != null && model_list.Count > 0) + { + all.AddRange(model_list); + } + AssetsCoolingFactorCacheHelper.Trigger(); + } + + //绉婚櫎缂撳瓨 + private static void RemoveCache(long ID) + { + var all = GetCache(); + all.RemoveAll(x => x.ID == ID); + AssetsCoolingFactorCacheHelper.Trigger(); + } + + //绉婚櫎鎵�鏈夌紦瀛� + private static void RemoveAllCache() + { + var all = GetCache(); + all.Clear(); + AssetsCoolingFactorCacheHelper.Trigger(); + } + + /// <summary> + /// 鍙戝竷缂撳瓨 + /// </summary> + public static void PublishCache(string key) + { + AssetsCoolingFactorCacheHelper.Publish(key); + } + + #endregion + + #region Query + + /// <summary> + /// 鑾峰彇鎵�鏈� + /// </summary> + public List<Model.AssetsCoolingFactor> GetAll() + { + var all = GetCache(); + return all; + } + + /// <summary> + /// 閫氳繃 ID 鑾峰彇 + /// </summary> + public Model.AssetsCoolingFactor GetByID(long ID) + { + var all = GetAll(); + return all.Find(x => x.ID == ID); + } + + /// <summary> + /// 閫氳繃 ID 鑾峰彇 + /// </summary> + public List<Model.AssetsCoolingFactor> GetByIds(List<long> Ids) + { + if (Ids == null || Ids.Count < 1) + { + return default; + } + var all = GetAll(); + return all.Where(x => Ids.Contains(x.ID)).ToList(); + } + + #endregion + + #region Insert + + /// <summary> + /// 鎻掑叆涓�鏉℃暟鎹� + /// </summary> + public long Insert(Model.AssetsCoolingFactor model) + { + if (model == null) + { + return default; + } + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingFactor>(); + var entity = Model2Entity(model); + var id = dal.Insert(entity); + if (id > 0) + { + UpdateCache(id); + } + return id; + } + + /// <summary> + /// 鎻掑叆澶氭潯 + /// </summary> + public bool Inserts(List<Model.AssetsCoolingFactor> list) + { + if (list == null || list.Count < 1) + { + return false; + } + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingFactor>(); + var entity_list = Model2Entities(list); + var ids = dal.InsertsR(entity_list); + if (ids != null && ids.Count > 0) + { + UpdateCache(ids); + return true; + } + return false; + } + + #endregion + + #region Update + + /// <summary> + /// 鏇存柊涓�鏉� + /// </summary> + public bool Update(Model.AssetsCoolingFactor model) + { + if (model == null) + { + return false; + } + var entity = Model2Entity(model); + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingFactor>(); + var bol = dal.Update(entity); + if (bol) + { + UpdateCache(model.ID); + } + return bol; + } + + /// <summary> + /// 鎵归噺鏇存柊 + /// </summary> + public bool Updates(List<Model.AssetsCoolingFactor> list) + { + if (list == null || list.Count < 1) + { + return false; + } + if (list.Exists(x => x.ID < 1)) + { + return false; + } + var entity_list = Model2Entities(list); + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingFactor>(); + var bol = dal.Updates(entity_list); + if (bol) + { + UpdateCache(list.Select(x => x.ID).ToList()); + } + return bol; + } + + /// <summary> + /// 鏇存柊鎺掑簭鐮� + /// </summary> + public bool UpdateSortCode(long ID, int SortCode) + { + if (ID < 1) + { + return false; + } + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingMain>(); + var bol = dal.UpdateSortCode(ID, SortCode); + if (bol) + { + UpdateCache(ID); + } + return bol; + } + + /// <summary> + /// 鏇存柊鎺掑簭 + /// </summary> + public bool UpdateSorter(List<Yw.Model.Sorter> sorters) + { + if (sorters == null || sorters.Count < 1) + { + return false; + } + if (sorters.Exists(x => x.ID < 1)) + { + return false; + } + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingMain>(); + var bol = dal.UpdateSorter(sorters.ToEntityList()); + if (bol) + { + UpdateCache(sorters.Select(x => x.ID).ToList()); + } + return bol; + } + + #endregion + + #region Delete + + /// <summary> + /// 閫氳繃 ID 鍒犻櫎 + /// </summary> + public bool DeleteByID(long ID, out string Msg) + { + Msg = string.Empty; + var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsCoolingFactor>(); + var bol = dal.DeleteByID(ID); + if (bol) + { + RemoveCache(ID); + } + return bol; + } + + + #endregion + } +} \ No newline at end of file diff --git a/Service/HStation.Service.Assets.Core/05-service/21-cooling/03-factor/AssetsCoolingFactor_Instance.cs b/Service/HStation.Service.Assets.Core/05-service/21-cooling/03-factor/AssetsCoolingFactor_Instance.cs new file mode 100644 index 0000000..483a8d6 --- /dev/null +++ b/Service/HStation.Service.Assets.Core/05-service/21-cooling/03-factor/AssetsCoolingFactor_Instance.cs @@ -0,0 +1,59 @@ +锘縩amespace HStation.Service +{ + public partial class AssetsCoolingFactor + { + //Entity to GetModel + internal static Model.AssetsCoolingFactor Entity2Model(Entity.AssetsCoolingFactor entity) + { + if (entity == null) + return default; + var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Entity.AssetsCoolingFactor, Model.AssetsCoolingFactor>() + ).CreateMapper(); + var model = mapper.Map<Entity.AssetsCoolingFactor, Model.AssetsCoolingFactor>(entity); + return model; + } + + //Entities to GetModels + internal static List<Model.AssetsCoolingFactor> Entity2Models(List<Entity.AssetsCoolingFactor> entities) + { + if (entities == null || entities.Count < 1) + return default; + var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Entity.AssetsCoolingFactor, Model.AssetsCoolingFactor>() + ).CreateMapper(); + var models = mapper.Map<List<Entity.AssetsCoolingFactor>, List<Model.AssetsCoolingFactor>>(entities); + return models; + } + + //Model to Entity + internal static Entity.AssetsCoolingFactor Model2Entity(Model.AssetsCoolingFactor model) + { + if (model == null) + return default; + var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.AssetsCoolingFactor, Entity.AssetsCoolingFactor>() + ).CreateMapper(); + var entity = mapper.Map<Model.AssetsCoolingFactor, Entity.AssetsCoolingFactor>(model); + return entity; + } + + //Models to Entities + internal static List<Entity.AssetsCoolingFactor> Model2Entities(List<Model.AssetsCoolingFactor> models) + { + if (models == null || models.Count < 1) + return default; + var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.AssetsCoolingFactor, Entity.AssetsCoolingFactor>() + ).CreateMapper(); + var entities = mapper.Map<List<Model.AssetsCoolingFactor>, List<Entity.AssetsCoolingFactor>>(models); + return entities; + } + + //Model to Entity + internal static void Model2Entity(Model.AssetsCoolingFactor model, Entity.AssetsCoolingFactor entity) + { + if (model == null || entity == null) + return; + var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.AssetsCoolingFactor, Entity.AssetsCoolingFactor>() + ).CreateMapper(); + mapper.Map(model, entity); + } + } +} \ No newline at end of file diff --git a/Service/HStation.Service.Assets.Core/05-service/21-cooling/03-factor/Cache/AssetsCoolingFactorCacheHelper.cs b/Service/HStation.Service.Assets.Core/05-service/21-cooling/03-factor/Cache/AssetsCoolingFactorCacheHelper.cs new file mode 100644 index 0000000..a6f4c8e --- /dev/null +++ b/Service/HStation.Service.Assets.Core/05-service/21-cooling/03-factor/Cache/AssetsCoolingFactorCacheHelper.cs @@ -0,0 +1,71 @@ +锘縩amespace HStation.Service +{ + /// <summary> + /// AssetsCoolingFactor + /// 缂撳瓨杈呭姪绫� + /// </summary> + internal class AssetsCoolingFactorCacheHelper + { + private const string _contentKey = "AssetsCoolingFactorList"; + + internal static string GetCacheKey() + { + return CacheHelper.GetCacheKey(_contentKey); + } + + /// <summary> + /// 璁剧疆缂撳瓨 + /// </summary> + public static void Set(List<Model.AssetsCoolingFactor> list, int Minites = 30, int RandomSeconds = 0) + { + var cacheKey = GetCacheKey(); + MemoryCacheHelper.Set(cacheKey, list, Minites * 60 + RandomSeconds); + } + + /// <summary> + /// 鑾峰彇缂撳瓨 + /// </summary> + /// <returns></returns> + public static List<Model.AssetsCoolingFactor> Get() + { + var cacheKey = GetCacheKey(); + return MemoryCacheHelper.Get<List<Model.AssetsCoolingFactor>>(cacheKey); + } + + /// <summary> + /// 鑾峰彇璁剧疆缂撳瓨 + /// </summary> + public static List<Model.AssetsCoolingFactor> GetSet(Func<List<Model.AssetsCoolingFactor>> func, int Minites = 30, int RandomSeconds = 0) + { + var cacheKey = GetCacheKey(); + return MemoryCacheHelper.GetSet(cacheKey, func, Minites * 60 + RandomSeconds); + } + + /// <summary> + /// 绉婚櫎缂撳瓨 + /// </summary> + public static void Remove() + { + var cacheKey = GetCacheKey(); + MemoryCacheHelper.Remove(cacheKey); + } + + /// <summary> + /// 鍙戝竷 + /// </summary> + public static void Publish(string key) + { + var cacheKey = GetCacheKey(); + MemoryCacheWipeRelationHelper.Set(key, cacheKey); + } + + /// <summary> + /// 瑙﹀彂 + /// </summary> + public static void Trigger() + { + var cacheKey = GetCacheKey(); + MemoryCacheWipeRelationHelper.Trigger(cacheKey); + } + } +} \ No newline at end of file -- Gitblit v1.9.3