using SqlSugar; using TProduct.HttpClient; namespace TProduct.DAL { public class SoftSetting : BaseLiteSqlDAL_DataSync { public override ISqlSugarClient Connection { get { return TProduct.DAL.SQLite.ConfigHelper.MainConn; } } /// /// 通过 SetName 获取 /// public Entity.SoftSetting GetBySetName(string Type, string SetName) { using (ISqlSugarClient db = Connection) { return db.Queryable().Single(x => x.Name == SetName && x.Type == Type); } } /// /// 更新 SetValue /// public bool UpdateSetValue(string Type, string Name, string SetValue) { using (ISqlSugarClient db = Connection) { var result = db.Updateable() .SetColumns("Value", SetValue) .Where(x => x.Type == Type && x.Name == Name).ExecuteCommandHasChange(); if (result && TProduct.CorpConfig.Instance.RealTimeRemoteService.IsSynMainData) { var dtos = db.Queryable().Where(x => x.Type == Type && x.Name == Name); HttpClientHelper.Build(this.TableName, "Updates@V1.0").Put(dtos); } return result; } } } }