public async Task <ApiResult> UpdateSystemAsync(SystemInfoDO model) { var state = this.State; if (state.SystemInfos.Any(m => m.Id == model.Id)) { var systemInfoDO = state.SystemInfos.First(mbox => mbox.Id == model.Id); string oldConnection = systemInfoDO.DbConnection; systemInfoDO.IsDel = model.IsDel; systemInfoDO.SystemName = string.IsNullOrWhiteSpace(model.SystemName) ? systemInfoDO.SystemName : model.SystemName; systemInfoDO.DbConnection = string.IsNullOrWhiteSpace(model.DbConnection) ? systemInfoDO.DbConnection : model.DbConnection; systemInfoDO.Desc = string.IsNullOrWhiteSpace(model.Desc) ? systemInfoDO.Desc : model.Desc; systemInfoDO.Version++; systemInfoDO.ModityDate = DateTime.Now; systemInfoDO.Firm = string.IsNullOrWhiteSpace(model.Firm) ? systemInfoDO.Firm : model.Firm; systemInfoDO.Line = string.IsNullOrWhiteSpace(model.Line) ? systemInfoDO.Line : model.Line; bool bRet = await _systemInfoRepository.SetAsync(systemInfoDO); if (!bRet) { return(ApiResultUtil.IsFailed("更新失败!")); } //if (oldConnection != model.DbConnection || oldDbType != model.DbType) { //修改了数据库配置需要刷新缓存 var groupCodes = state.TableInfos.Where(m => m.SystemId == model.Id).Select(mbox => mbox.GroupCode).Distinct(); await RefrshGroupState(groupCodes.ToList()); } await this.Persist(Kaneko.Core.Contract.ProcessAction.Update, this.State); } return(ApiResultUtil.IsFailed($"系统ID【{model.Id}】不存在!")); }
public Task <ApiResult> UpdateSystemAsync(SystemInfoDO model) { return(factory.GetGrain <IDataSyncSettingAllStateGrain>(System.Guid.Empty).UpdateSystemAsync(model)); }