using AStation.HttpClient; using SqlSugar; namespace AStation.DAL { public class SoftSetting : BaseDAL { public override ConnectionConfig ConnectionConfig { get { return ConnectionFactory.BuildConnection(); } } /// /// 通过 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 && AStation.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; } } } }