lixiaojun
2024-07-17 a60f3ee45a6b86de936d19a122acdfb30570a867
Yw.Service.Run.Core/07-service/01-configure/RunAnalyConfigure.cs
@@ -69,6 +69,14 @@
        }
        //移除缓存
        private static void RemoveCacheByObjectTypeAndObjectID(string ObjectType, long ObjectID)
        {
            var all = GetCache();
            all.RemoveAll(x => x.ObjectType == ObjectType && x.ObjectID == ObjectID);
            RunAnalyConfigureCacheHelper.Trigger();
        }
        //移除缓存
        private static void RemoveCache()
        {
            RunAnalyConfigureCacheHelper.Remove();
@@ -168,6 +176,26 @@
            return false;
        }
        /// <summary>
        /// 插入或更新
        /// </summary>
        public long InsertOrUpdate(Model.RunAnalyConfigurePure pure)
        {
            if (pure == null)
            {
                return default;
            }
            var dal = DALCreateHelper.CreateDAL<Yw.DAL.IRunAnalyConfigure>();
            var entity = pure.ToEntity();
            var id = dal.InsertOrUpdate(entity);
            if (id > 0)
            {
                UpdateCache(id);
            }
            return id;
        }
        #endregion
        #region Update
@@ -179,11 +207,11 @@
        {
            if (model == null)
            {
                return default;
                return false;
            }
            if (model.ID < 1)
            {
                return default;
                return false;
            }
            var dal = DALCreateHelper.CreateDAL<Yw.DAL.IRunAnalyConfigure>();
            var entity = Model2Entity(model);
@@ -202,14 +230,14 @@
        {
            if (list == null || list.Count < 1)
            {
                return default;
                return false;
            }
            if (list.ToList().Exists(x => x.ID < 1))
            if (list.Exists(x => x.ID < 1))
            {
                return default;
                return false;
            }
            var dal = DALCreateHelper.CreateDAL<Yw.DAL.IRunAnalyConfigure>();
            var entity_list = Model2Entities(list.ToList());
            var entity_list = Model2Entities(list);
            var bol = dal.Updates(entity_list);
            if (bol)
            {
@@ -250,6 +278,21 @@
            return bol;
        }
        /// <summary>
        /// 通过 ObjectType 和 ObjectID 删除
        /// </summary>
        public bool DeleteByObjectTypeAndObjectID(string ObjectType, long ObjectID, out string Msg)
        {
            Msg = string.Empty;
            var dal = DALCreateHelper.CreateDAL<Yw.DAL.IRunAnalyConfigure>();
            var bol = dal.DeleteByObjectTypeAndObjectID(ObjectType, ObjectID);
            if (bol)
            {
                RemoveCacheByObjectTypeAndObjectID(ObjectType, ObjectID);
            }
            return bol;
        }
        #endregion
        #region Set
@@ -257,9 +300,14 @@
        /// <summary>
        /// 设置
        /// </summary>
        public bool Set(List<Model.RunAnalyConfigure> list)
        public bool Set(List<Model.RunAnalyConfigurePure> list, out string Msg)
        {
            var entityList = Model2Entities(list);
            Msg = string.Empty;
            if (list == null || list.Count < 1)
            {
                return false;
            }
            var entityList = list.ToEntityList();
            var dal = DALCreateHelper.CreateDAL<Yw.DAL.IRunAnalyConfigure>();
            var bol = dal.Set(entityList);
            if (bol)