lixiaojun
2024-11-18 a302d7d16e6bed80511cb49813d16829eb933560
Service/HStation.Service.Assets.Core/05-service/01-PumpMain/07-PumpMainAndPartMapping/AssetsPumpMainAndPartMapping.cs
ÎļþÃû´Ó Service/HStation.Service.Assets.Core/05-service/01-PumpMain/07-PumpMainAndPartMap/PumpMainAndPartMap.cs ÐÞ¸Ä
@@ -8,16 +8,16 @@
        #region Cache
        //获取缓存
        private static List<Model.AssetsPumpMainAndPartMap> GetCache()
        private static List<Model.AssetsPumpMainAndPartMapping> GetCache()
        {
            var all = AssetsPumpMainAndPartMapCacheHelper.GetSet(() =>
            var all = AssetsPumpMainAndPartMappingCacheHelper.GetSet(() =>
            {
                var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsPumpMainAndPartMap>();
                var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsPumpMainAndPartMapping>();
                var entity_list = dal.GetAll();
                var model_list = Entity2Models(entity_list);
                if (model_list == null)
                {
                    model_list = new List<Model.AssetsPumpMainAndPartMap>();
                    model_list = new List<Model.AssetsPumpMainAndPartMapping>();
                }
                return model_list;
            }, Yw.Service.ConfigHelper.CacheKeepTime, Yw.Service.ConfigHelper.CacheRandomTime);
@@ -27,7 +27,7 @@
        //通过 ID æ›´æ–°ç¼“å­˜
        private static void UpdateCache(long ID)
        {
            var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsPumpMainAndPartMap>();
            var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsPumpMainAndPartMapping>();
            var entity_ds = dal.GetByID(ID);
            var model_ds = Entity2Model(entity_ds);
            var all = GetCache();
@@ -46,9 +46,9 @@
        //通过 PartID æ›´æ–°ç¼“å­˜
        public static void UpdateCacheByPartID(long ID)
        {
            var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsPumpMainAndPartMap>();
            var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsPumpMainAndPartMapping>();
            var alllist = dal.GetAll();
            var select = alllist.Find(x => x.PumpPartID == ID);
            var select = alllist.Find(x => x.PartID == ID);
            var model_ds = Entity2Model(select);
            var all = GetCache();
            var model = all.Find(x => x.ID == ID);
@@ -70,7 +70,7 @@
            {
                return;
            }
            var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsPumpMainAndPartMap>();
            var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsPumpMainAndPartMapping>();
            var entity_list = dal.GetByIds(Ids);
            var model_list = Entity2Models(entity_list);
            var all = GetCache();
@@ -94,7 +94,7 @@
        public static void RemoveCacheByGroupID(long ID)
        {
            var all = GetCache();
            var maplist = AssetsPumpGroupAndMainMap.GetMainIDByGroupID(ID);
            var maplist = AssetsPumpGroupAndMainMapping.GetMainIDByGroupID(ID);
            all.RemoveAll(item => maplist.Any(mapItem => mapItem == item.ID));
            AssetsPumpSeriesCacheHelper.Trigger();
        }
@@ -114,7 +114,7 @@
        /// <summary>
        /// èŽ·å–æ‰€æœ‰
        /// </summary>
        public List<Model.AssetsPumpMainAndPartMap> GetAll()
        public List<Model.AssetsPumpMainAndPartMapping> GetAll()
        {
            var all = GetCache();
            return all;
@@ -123,7 +123,7 @@
        /// <summary>
        /// é€šè¿‡ ID èŽ·å–
        /// </summary>
        public Model.AssetsPumpMainAndPartMap GetByID(long ID)
        public Model.AssetsPumpMainAndPartMapping GetByID(long ID)
        {
            var all = GetAll();
            return all.Find(x => x.ID == ID);
@@ -132,7 +132,7 @@
        /// <summary>
        /// é€šè¿‡ ID èŽ·å–
        /// </summary>
        public List<Model.AssetsPumpMainAndPartMap> GetByIds(List<long> Ids)
        public List<Model.AssetsPumpMainAndPartMapping> GetByIds(List<long> Ids)
        {
            if (Ids == null || Ids.Count < 1)
            {
@@ -152,7 +152,7 @@
                return default;
            }
            var all = GetCache();
            return all.Where(x => x.PumpID == ID).Select(x => x.PumpPartID).ToList();
            return all.Where(x => x.MainID == ID).Select(x => x.PartID).ToList();
        }
        #endregion Query
@@ -162,13 +162,13 @@
        /// <summary>
        /// æ’入一条数据
        /// </summary>
        public long Insert(Model.AssetsPumpMainAndPartMap model)
        public long Insert(Model.AssetsPumpMainAndPartMapping model)
        {
            if (model == null)
            {
                return default;
            }
            var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsPumpMainAndPartMap>();
            var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsPumpMainAndPartMapping>();
            var entity = Model2Entity(model);
            var id = dal.Insert(entity);
            if (id > 0)
@@ -181,13 +181,13 @@
        /// <summary>
        /// æ’入多条
        /// </summary>
        public bool Inserts(List<Model.AssetsPumpMainAndPartMap> list)
        public bool Inserts(List<Model.AssetsPumpMainAndPartMapping> list)
        {
            if (list == null || list.Count < 1)
            {
                return false;
            }
            var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsPumpMainAndPartMap>();
            var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsPumpMainAndPartMapping>();
            var entity_list = Model2Entities(list);
            var ids = dal.InsertsR(entity_list);
            if (ids != null && ids.Count > 0)
@@ -205,14 +205,14 @@
        /// <summary>
        /// æ›´æ–°ä¸€æ¡
        /// </summary>
        public bool Update(Model.AssetsPumpMainAndPartMap model)
        public bool Update(Model.AssetsPumpMainAndPartMapping model)
        {
            if (model == null)
            {
                return false;
            }
            var entity = Model2Entity(model);
            var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsPumpMainAndPartMap>();
            var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsPumpMainAndPartMapping>();
            var bol = dal.Update(entity);
            if (bol)
            {
@@ -224,7 +224,7 @@
        /// <summary>
        /// æ‰¹é‡æ›´æ–°
        /// </summary>
        public bool Updates(List<Model.AssetsPumpMainAndPartMap> list)
        public bool Updates(List<Model.AssetsPumpMainAndPartMapping> list)
        {
            if (list == null || list.Count < 1)
            {
@@ -235,7 +235,7 @@
                return false;
            }
            var entity_list = Model2Entities(list);
            var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsPumpMainAndPartMap>();
            var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsPumpMainAndPartMapping>();
            var bol = dal.Updates(entity_list);
            if (bol)
            {
@@ -254,7 +254,7 @@
        public bool DeleteByID(long ID, out string Msg)
        {
            Msg = string.Empty;
            var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsPumpMainAndPartMap>();
            var dal = DALCreateHelper.CreateDAL<HStation.DAL.IAssetsPumpMainAndPartMapping>();
            var bol = dal.DeleteByID(ID);
            if (bol)
            {